def make():
  #check server module to build
  if(not config.check_option("module", "server")):
    return

  server_dir = base.get_script_dir() + "/../../server"

  base.cmd_in_dir(server_dir, "npm", ["install"])
  base.cmd_in_dir(server_dir, "grunt", ["--no-color", "-v"] + base.server_addons_param())

    #env variables
  product_version = base.get_env('PRODUCT_VERSION')
  if(not product_version):
    product_version = "0.0.0"

  build_number = base.get_env('BUILD_NUMBER')
  if(not build_number):
    build_number = "0"

  cur_date = datetime.date.today().strftime("%m/%d/%Y")

  server_build_dir = server_dir + "/build/server"

  base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js", "const buildNumber = [0-9]*", "const buildNumber = " + build_number)
  base.replaceInFileRE(server_build_dir + "/Common/sources/license.js", "const buildDate = '[0-9-/]*'", "const buildDate = '" + cur_date + "'")
  base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js", "const buildVersion = '[0-9.]*'", "const buildVersion = '" + product_version + "'")

  pkg_target = "node10"

  if ("linux" == base.host_platform()):
    pkg_target += "-linux"

  if ("windows" == base.host_platform()):
    pkg_target += "-win"

  base.cmd_in_dir(server_build_dir + "/DocService", "pkg", [".", "-t", pkg_target, "--options", "max_old_space_size=4096", "-o", "docservice"])
  base.cmd_in_dir(server_build_dir + "/FileConverter", "pkg", [".", "-t", pkg_target, "-o", "converter"])
  base.cmd_in_dir(server_build_dir + "/Metrics", "pkg", [".", "-t", pkg_target, "-o", "metrics"])
  base.cmd_in_dir(server_build_dir + "/SpellChecker", "pkg", [".", "-t", pkg_target, "-o", "spellchecker"])

  example_dir = base.get_script_dir() + "/../../document-server-integration/web/documentserver-example/nodejs"
  base.cmd_in_dir(example_dir, "npm", ["install"])
  base.cmd_in_dir(example_dir, "pkg", [".", "-t", pkg_target, "-o", "example"])
def make():
    #check server module to build
    if (not config.check_option("module", "server")):
        return

    git_dir = base.get_script_dir() + "/../.."
    server_dir = base.get_script_dir() + "/../../server"
    branding_dir = server_dir + "/branding"

    if ("" != config.option("branding")):
        branding_dir = git_dir + '/' + config.option("branding") + '/server'

    base.cmd_in_dir(server_dir, "npm", ["install"])
    base.cmd_in_dir(server_dir, "grunt",
                    ["--no-color", "-v"] + base.server_addons_param())

    #env variables
    product_version = base.get_env('PRODUCT_VERSION')
    if (not product_version):
        product_version = "0.0.0"

    build_number = base.get_env('BUILD_NUMBER')
    if (not build_number):
        build_number = "0"

    license_connections = base.get_env('LICENSE_CONNECTIONS')
    if (not license_connections):
        license_connections = "99999"

    cur_date = datetime.date.today().strftime("%m/%d/%Y")

    server_build_dir = server_dir + "/build/server"

    base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js",
                         "const buildNumber = [0-9]*",
                         "const buildNumber = " + build_number)
    base.replaceInFileRE(server_build_dir + "/Common/sources/license.js",
                         "const buildDate = '[0-9-/]*'",
                         "const buildDate = '" + cur_date + "'")
    base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js",
                         "const buildVersion = '[0-9.]*'",
                         "const buildVersion = '" + product_version + "'")
    base.replaceInFileRE(
        server_build_dir + "/Common/sources/constants.js",
        "exports.LICENSE_CONNECTIONS = '[0-9]*'",
        "exports.LICENSE_CONNECTIONS = '" + license_connections + "'")

    custom_public_key = branding_dir + '/debug.js'

    if (base.is_exist(custom_public_key)):
        base.copy_file(custom_public_key, server_build_dir + '/Common/sources')

    pkg_target = "node10"

    if ("linux" == base.host_platform()):
        pkg_target += "-linux"

    if ("windows" == base.host_platform()):
        pkg_target += "-win"

    base.cmd_in_dir(server_build_dir + "/DocService", "pkg", [
        ".", "-t", pkg_target, "--options", "max_old_space_size=4096", "-o",
        "docservice"
    ])
    base.cmd_in_dir(server_build_dir + "/FileConverter", "pkg",
                    [".", "-t", pkg_target, "-o", "converter"])
    base.cmd_in_dir(server_build_dir + "/Metrics", "pkg",
                    [".", "-t", pkg_target, "-o", "metrics"])
    base.cmd_in_dir(server_build_dir + "/SpellChecker", "pkg",
                    [".", "-t", pkg_target, "-o", "spellchecker"])

    example_dir = base.get_script_dir(
    ) + "/../../document-server-integration/web/documentserver-example/nodejs"
    base.delete_dir(example_dir + "/node_modules")
    base.cmd_in_dir(example_dir, "npm", ["install"])
    sync_rpc_lib_dir = example_dir + "/node_modules/sync-rpc/lib"
    patch_file = base.get_script_dir() + "/../tools/linux/sync-rpc.patch"
    if ("linux" == base.host_platform()):
        base.cmd_in_dir(sync_rpc_lib_dir, "patch", ["-N", "-i", patch_file])
    if ("windows" == base.host_platform()):
        patch_exe_dir = base.git_dir() + "/usr/bin"
        base.cmd_in_dir(patch_exe_dir, "patch.exe",
                        ["-N", "-d", sync_rpc_lib_dir, "-i", patch_file])
    base.cmd_in_dir(example_dir, "pkg",
                    [".", "-t", pkg_target, "-o", "example"])
Beispiel #3
0
def make(packages):
    base_dir = base.get_script_dir() + "/../out"
    git_dir = base.get_script_dir() + "/../.."

    for package in packages:

        if -1 != package.find("diskimage"):
            macos_dir = os.path.abspath(git_dir + "/desktop-apps/macos")
            update_dir = macos_dir + "/build/update"
            changes_dir = macos_dir + "/ONLYOFFICE/update/updates/ONLYOFFICE/changes"

            if (package == "diskimage-x86_64"):
                lane = "release_x86_64"
                scheme = "ONLYOFFICE-x86_64"
            elif (package == "diskimage-v8-x86_64"):
                lane = "release_v8"
                scheme = "ONLYOFFICE-v8"
            elif (package == "diskimage-arm64"):
                lane = "release_arm"
                scheme = "ONLYOFFICE-arm"
            else:
                exit(1)

            print("Build package " + scheme)

            print("$ bundler exec fastlane " + lane + " skip_git_bump:true")
            base.cmd_in_dir(macos_dir, "bundler",
                            ["exec", "fastlane", lane, "skip_git_bump:true"])

            print("Build updates")

            app_version = base.run_command(
                "/usr/libexec/PlistBuddy -c 'print :CFBundleShortVersionString' "
                + macos_dir +
                "/build/ONLYOFFICE.app/Contents/Info.plist")['stdout']
            zip_filename = scheme + "-" + app_version
            macos_zip = macos_dir + "/build/" + zip_filename + ".zip"
            update_storage_dir = base.get_env(
                "ARCHIVES_DIR") + "/" + scheme + "/_updates"

            base.create_dir(update_dir)
            base.copy_dir_content(update_storage_dir, update_dir, ".zip")
            base.copy_dir_content(update_storage_dir, update_dir, ".html")
            base.copy_file(macos_zip, update_dir)

            notes_src = changes_dir + "/" + app_version + "/ReleaseNotes.html"
            notes_dst = update_dir + "/" + zip_filename + ".html"
            cur_date = base.run_command(
                "LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"")['stdout']
            if base.is_exist(notes_src):
                base.copy_file(notes_src, notes_dst)
                base.replaceInFileRE(
                    notes_dst, r"(<span class=\"releasedate\">).+(</span>)",
                    "\\1 - " + cur_date + "\\2")
            else:
                base.writeFile(notes_dst, "placeholder\n")

            notes_src = changes_dir + "/" + app_version + "/ReleaseNotesRU.html"
            notes_dst = update_dir + "/" + zip_filename + ".ru.html"
            cur_date = base.run_command(
                "LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"")['stdout']
            if base.is_exist(notes_src):
                base.copy_file(notes_src, notes_dst)
                base.replaceInFileRE(
                    notes_dst, r"(<span class=\"releasedate\">).+(</span>)",
                    "\\1 - " + cur_date + "\\2")
            else:
                base.writeFile(notes_dst, "placeholder\n")

            print("$ ./generate_appcast " + update_dir)
            base.cmd(macos_dir + "/Vendor/Sparkle/bin/generate_appcast",
                     [update_dir])

            print("Edit Sparkle appcast links")

            sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
            if (package == "diskimage-x86_64"): sparkle_base_url += "/x86_64"
            elif (package == "diskimage-v8-x86_64"): sparkle_base_url += "/v8"
            elif (package == "diskimage-arm64"): sparkle_base_url += "/arm"

            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + sparkle_base_url +
                "/updates/changes/\\2/ReleaseNotes.html\\3")
            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + sparkle_base_url +
                "/updates/changes/\\2/ReleaseNotesRU.html\\3")
            base.replaceInFileRE(update_dir + "/onlyoffice.xml",
                                 r"(url=\")(?:.+/)(ONLYOFFICE.+\")",
                                 "\\1" + sparkle_base_url + "/updates/\\2")

            print("Delete unnecessary files")

            for file in os.listdir(update_dir):
                if (-1 == file.find(app_version)) and (file.endswith(".zip") or
                                                       file.endswith(".html")):
                    base.delete_file(update_dir + "/" + file)

    return
def make():
    base_dir = base.get_script_dir() + "/../out"
    git_dir = base.get_script_dir() + "/../.."
    branding = config.branding()

    platforms = config.option("platform").split()
    for native_platform in platforms:
        if not native_platform in config.platforms:
            continue

        isWindowsXP = False if (-1 == native_platform.find("_xp")) else True
        platform = native_platform[0:-3] if isWindowsXP else native_platform

        if (0 == platform.find("mac")):
            macos_dir = git_dir + "/desktop-apps/macos"
            update_dir = macos_dir + "/build/update"

            isX86 = True if ("" != base.get_env("_X86")) else False

            target = "release" if not isX86 else "release_x86"
            base.cmd_in_dir(macos_dir, "bundler",
                            ["exec", "fastlane", target, "skip_git_bump:true"])

            package = "ONLYOFFICE" if not isX86 else "ONLYOFFICE-x86"
            app_version = base.run_command("mdls -name kMDItemVersion -raw " +
                                           macos_dir +
                                           "/build/ONLYOFFICE.app")['stdout']
            macos_zip = macos_dir + "/build/" + package + "-" + app_version + ".zip"
            update_storage = base.get_env(
                "ARCHIVES_DIR") + "/" + package + "/_updates"
            changes_dir = macos_dir + "/ONLYOFFICE/update/updates/ONLYOFFICE/changes/" + app_version
            base.delete_dir(update_dir)
            base.delete_dir(
                os.path.expanduser(
                    "~/Library/Caches/Sparkle_generate_appcast"))
            base.create_dir(update_dir)
            base.copy_dir_content(update_storage, update_dir, ".zip")
            base.copy_file(macos_zip, update_dir)
            for file in os.listdir(update_dir):
                if file.endswith(".zip"):
                    base.copy_file(
                        changes_dir + "/ReleaseNotes.html",
                        update_dir + "/" + os.path.splitext(file)[0] + ".html")
                    base.copy_file(
                        changes_dir + "/ReleaseNotesRU.html", update_dir +
                        "/" + os.path.splitext(file)[0] + ".ru.html")

            base.cmd(macos_dir + "/Vendor/Sparkle/bin/generate_appcast",
                     [update_dir])

            base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
            changes_url = base_url + "/updates/onlyoffice/changes"
            update_url = base_url + ("/updates/onlyoffice"
                                     if not isX86 else "/x86")

            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE(?:|-x86)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + changes_url + "/\\2/ReleaseNotes.html\\3")
            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE(?:|-x86)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + changes_url + "/\\2/ReleaseNotesRU.html\\3")
            base.replaceInFileRE(update_dir + "/onlyoffice.xml",
                                 r"(url=\")(?:.+/)(ONLYOFFICE.+\")",
                                 "\\1" + update_url + "/\\2")

            for file in os.listdir(update_dir):
                if -1 == file.find(app_version) and (file.endswith(".zip") or
                                                     file.endswith(".html")):
                    base.delete_dir(update_dir + "/" + file)

    return