Exemple #1
0
def restart_win_rabbit():
  base.print_info('restart RabbitMQ node to prevent "Erl.exe high CPU usage every Monday morning on Windows" https://groups.google.com/forum/#!topic/rabbitmq-users/myl74gsYyYg')
  rabbitmqctl = find_rabbitmqctl(os.environ['ProgramFiles']) or find_rabbitmqctl(os.environ['ProgramFiles(x86)'])
  if rabbitmqctl is not None:
    base.cmd_in_dir(base.get_script_dir(rabbitmqctl), 'rabbitmqctl.bat', ['stop_app'])
    base.cmd_in_dir(base.get_script_dir(rabbitmqctl), 'rabbitmqctl.bat', ['start_app'])
  else:
    base.print_info('Missing rabbitmqctl.bat')
Exemple #2
0
def make(args=[]):
    try:
        base.configure_common_apps()

        platform = base.host_platform()
        if ("windows" == platform):
            dependence.check_pythonPath()
            dependence.check_gitPath()
            restart_win_rabbit()
        elif ("mac" == platform):
            start_mac_services()
        elif ("linux" == platform):
            start_linux_services()

        branch = base.run_command('git rev-parse --abbrev-ref HEAD')['stdout']

        base.print_info('Build modules')
        base.cmd_in_dir('../../', 'python', [
            'configure.py', '--branch', branch or 'develop', '--develop', '1',
            '--module', 'server', '--update', '1', '--update-light', '1',
            '--clean', '0'
        ] + args)
        base.cmd_in_dir('../../', 'python', ['make.py'])

        run_integration_example()

        base.create_dir('../../../server/App_Data')

        install_module('../../../server/DocService')
        install_module('../../../server/Common')
        install_module('../../../server/FileConverter')

        base.set_env('NODE_ENV', 'development-' + platform)
        base.set_env('NODE_CONFIG_DIR', '../Common/config')

        if ("mac" == platform):
            base.set_env('DYLD_LIBRARY_PATH', '../FileConverter/bin/')
        elif ("linux" == platform):
            base.set_env('LD_LIBRARY_PATH', '../FileConverter/bin/')

        run_module('../../../server/DocService', ['sources/server.js'])
        #    run_module('../../../server/DocService', ['sources/gc.js'])
        run_module('../../../server/FileConverter',
                   ['sources/convertermaster.js'])


#    run_module('../../../server/SpellChecker', ['sources/server.js'])
    except SystemExit:
        input("Ignoring SystemExit. Press Enter to continue...")
        exit(0)
    except KeyboardInterrupt:
        pass
    except:
        input("Unexpected error. " + traceback.format_exc() +
              "Press Enter to continue...")
Exemple #3
0
def make():
    if ("1" != config.option("develop")):
        return
    if not dependence.check_dependencies():
        exit(1)
    build_server.build_server_develop()
    build_js.build_js_develop(base_dir + "/../../..")
    develop_config_server.make()
    if ("" != config.option("branding")):
        branding_develop_script_dir = base_dir + "/../../../" + config.option(
            "branding") + "/build_tools/scripts"
        if base.is_file(branding_develop_script_dir + "/develop.py"):
            base.cmd_in_dir(branding_develop_script_dir, "python",
                            ["develop.py"], True)
    exit(0)
Exemple #4
0
def check_dependencies():
  if (host_platform == 'windows' and not check_vc_components()):
    return False
  if (host_platform == 'mac'):
    return True

  checksResult = CDependencies()

  checksResult.append(check_git())
  checksResult.append(check_nodejs())
  if (host_platform == 'linux'):
    checksResult.append(check_npm())
    checksResult.append(check_curl())
    checksResult.append(check_7z())
  checksResult.append(check_java())
  checksResult.append(check_erlang())
  checksResult.append(check_rabbitmq())
  checksResult.append(check_gruntcli())
  if (host_platform == 'windows'):
    checksResult.append(check_buildTools())
  if (config.option("sql-type") == 'mysql'):
    checksResult.append(check_mysqlServer())
  else:
    checksResult.append(check_postgreSQL())

  server_addons = []
  if (config.option("server-addons") != ""):
    server_addons = config.option("server-addons").rsplit(", ")
  if ("server-lockstorage" in server_addons):
    checksResult.append(check_redis())

  if (len(checksResult.install) > 0):
    install_args = ['install.py']
    install_args += checksResult.get_uninstall()
    install_args += checksResult.get_removepath()
    install_args += checksResult.get_install()
    if (host_platform == 'windows'):
      install_args[0] = './scripts/develop/' + install_args[0]
      code = libwindows.sudo(unicode(sys.executable), install_args)
    elif (host_platform == 'linux'):
      base.cmd_in_dir('./scripts/develop/', 'python', install_args)
      get_updates()
  
  check_npmPath()
  if (config.option("sql-type") == 'mysql'):
    return check_MySQLConfig(checksResult.sqlPath)
  return check_postgreConfig(checksResult.sqlPath)
Exemple #5
0
def install_qt():
    # qt
    if not base.is_file("./qt_source_5.9.9.tar.xz"):
        base.download(
            "https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz",
            "./qt_source_5.9.9.tar.xz")

    if not base.is_dir("./qt-everywhere-opensource-src-5.9.9"):
        base.cmd("tar", ["-xf", "./qt_source_5.9.9.tar.xz"])

    qt_params = [
        "-opensource", "-confirm-license", "-release", "-shared",
        "-accessibility", "-prefix", "./../qt_build/Qt-5.9.9/gcc_64",
        "-qt-zlib", "-qt-libpng", "-qt-libjpeg", "-qt-xcb", "-qt-pcre",
        "-no-sql-sqlite", "-no-qml-debug", "-gstreamer", "1.0", "-nomake",
        "examples", "-nomake", "tests", "-skip", "qtenginio", "-skip",
        "qtlocation", "-skip", "qtserialport", "-skip", "qtsensors", "-skip",
        "qtxmlpatterns", "-skip", "qt3d", "-skip", "qtwebview", "-skip",
        "qtwebengine"
    ]

    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "./configure",
                    qt_params)
    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make",
                    ["-j", "4"])
    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make",
                    ["install"])
    return
Exemple #6
0
def _run_npm(directory):
    return base.cmd_in_dir(
        directory, "npm",
        ["install", "--registry=https://registry.npm.taobao.org"])
Exemple #7
0
def _run_npm(directory):
    return base.cmd_in_dir(directory, "npm", ["install"])
Exemple #8
0
for arg in array_args:
    if (0 == arg.find("--")):
        indexEq = arg.find("=")
        if (-1 != indexEq):
            config[arg[2:indexEq]] = arg[indexEq + 1:]
    else:
        array_modules.append(arg)

if ("branch" in config):
    branch = config["branch"]

print("---------------------------------------------")
print("build branch: " + branch)
print("---------------------------------------------")

modules = " ".join(array_modules)
if "" == modules:
    modules = "desktop builder server"

print("---------------------------------------------")
print("build modules: " + modules)
print("---------------------------------------------")

build_tools_params = [
    "--branch", branch, "--module", modules, "--update", "1", "--qt-dir",
    os.getcwd() + "/qt_build/Qt-5.9.9"
]

base.cmd_in_dir("../..", "./configure.py", build_tools_params)
base.cmd_in_dir("../..", "./make.py")
Exemple #9
0
def _run_npm_cli(directory):
    return base.cmd_in_dir(directory, "npm", ["install", "-g", "grunt-cli"])
Exemple #10
0
def _run_grunt(directory, params=[]):
    return base.cmd_in_dir(directory, "grunt", params)
Exemple #11
0
base.set_env("BUILD_PLATFORM", config.option("platform"))

# branding
if ("1" != base.get_env("OO_RUNNING_BRANDING")) and (
        "" != config.option("branding")):
    branding_dir = base_dir + "/../" + config.option("branding")

    if ("1" == config.option("update")):
        is_exist = True
        if not base.is_dir(branding_dir):
            is_exist = False
            base.cmd(
                "git",
                ["clone", config.option("branding-url"), branding_dir])

        base.cmd_in_dir(branding_dir, "git", ["fetch"], True)

        if not is_exist or ("1" != config.option("update-light")):
            base.cmd_in_dir(
                branding_dir, "git",
                ["checkout", "-f", config.option("branch")])

        base.cmd_in_dir(branding_dir, "git", ["pull"], True)

    if base.is_file(branding_dir + "/build_tools/make.py"):
        base.check_build_version(branding_dir + "/build_tools")
        base.set_env("OO_RUNNING_BRANDING", "1")
        base.set_env("OO_BRANDING", config.option("branding"))
        base.cmd_in_dir(branding_dir + "/build_tools", "python", ["make.py"])
        exit(0)
Exemple #12
0
def build_server_develop():
    server_dir = base.get_script_dir() + "/../../server"
    base.cmd_in_dir(server_dir, "npm",
                    ["install", "--registry=https://registry.npm.taobao.org"])
    base.cmd_in_dir(server_dir, "grunt",
                    ["develop", "-v"] + base.server_addons_param())
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
Exemple #14
0

branch_from = 'release/v6.2.0'
branches_to = ['develop']

platform = base.host_platform()
if ("windows" == platform):
    dependence.check_pythonPath()
    dependence.check_gitPath()

if (dependence.check_gh() != True or dependence.check_gh_auth() != True):
    sys.exit(0)

base.cmd_in_dir('../../', 'python', [
    'configure.py', '--branding', 'onlyoffice', '--branding-url',
    'https://github.com/ONLYOFFICE/onlyoffice.git', '--branch', branch_from,
    '--module', 'core desktop builder server mobile', '--update', '1',
    '--update-light', '1', '--clean', '0'
])

# parse configuration
config.parse()

base.git_update('onlyoffice')

# correct defaults (the branding repo is already updated)
config.parse_defaults()

repositories = base.get_repositories()

# Add other plugins
repositories.update(
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"

    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 + "'")

    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 = "node14"

    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"])

    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"])
    base.cmd_in_dir(example_dir, "pkg",
                    [".", "-t", pkg_target, "-o", "example"])
parser.add_option("--package",
                  action="store",
                  type="string",
                  dest="package",
                  default="",
                  help="defines packages")

(options, args) = parser.parse_args(sys.argv[1:])
configOptions = vars(options)

branding = configOptions["branding"]
product = configOptions["product"]
package_list = configOptions["package"]
base_dir = base.get_script_dir(__file__)

# branding
if ("" != branding):
    branding_dir = base_dir + "/../" + branding

    if base.is_file(branding_dir + "/build_tools/make_packages.py"):
        base.check_build_version(branding_dir + "/build_tools")
        base.cmd_in_dir(branding_dir + "/build_tools", "python3", [
            "make_packages.py", '--product', product, '--package', package_list
        ])
        exit(0)

base.check_build_version(base_dir)

# build packages
packages.make(product, package_list)
Exemple #17
0
#!/usr/bin/env python

import sys
sys.path.append(sys.argv[1] + '/build_tools/scripts')
import build_js
import config
import base

base.cmd_in_dir(sys.argv[1] + '/build_tools/', 'python', ['configure.py'])
config.parse()

build_js.build_js_develop(sys.argv[1])
Exemple #18
0
def run_integration_example():
  base.cmd_in_dir('../document-server-integration/web/documentserver-example/nodejs', 'python', ['run-develop.py'])

try:
  base.print_info('check Node.js version')
  if (True != check_nodejs_version()):
    exit(0)

  platform = base.host_platform()
  if ("windows" == platform):
    restart_win_rabbit()
  elif ("mac" == platform):
    start_mac_services()

  base.print_info('Build modules')
  base.cmd_in_dir('../build_tools', 'python', ['configure.py', '--branch', 'develop', '--module', 'develop', '--update', '1', '--update-light', '1', '--clean', '0', '--sdkjs-addon', 'comparison', '--sdkjs-addon', 'content-controls', '--web-apps-addon', 'mobile', '--sdkjs-addon', 'sheet-views'])
  base.cmd_in_dir('../build_tools', 'python', ['make.py'])
  
  run_integration_example()
  
  base.create_dir('App_Data')

  install_module('DocService')
  install_module('Common')
  install_module('FileConverter')
  install_module('SpellChecker')

  base.set_env('NODE_ENV', 'development-' + platform)
  base.set_env('NODE_CONFIG_DIR', '../../Common/config')

  if ("mac" == platform):
Exemple #19
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
Exemple #20
0
#!/usr/bin/env python

import sys
sys.path.append('../../../../build_tools/scripts')
import config
import base
import os
import build

base_directory = os.getcwd()

if not base.is_dir("gumbo-parser"):
  base.cmd("git", ["clone", "https://github.com/google/gumbo-parser.git"])
  base.cmd_in_dir("gumbo-parser", "git", ["checkout", "aa91b27b02c0c80c482e24348a457ed7c3c088e0"])

if not base.is_dir("katana-parser"):
  base.cmd("git", ["clone", "https://github.com/hackers-painters/katana-parser.git"])
  base.cmd_in_dir("katana-parser", "git", ["checkout", "499118d32c387a893fdc9dda2cb95eee524bdb9b"])

  # fix katana
  base.replaceInFile(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool katana_is_html_space(char c);", "static inline bool2 katana_is_html_space(char c);")
  base.replaceInFile(base_directory + "/katana-parser/src/tokenizer.c", "inline bool katana_is_html_space(char c)", "static inline bool katana_is_html_space(char c)")
  base.replaceInFile(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool2 katana_is_html_space(char c);", "static inline bool katana_is_html_space(char c);")
  base.replaceInFile(base_directory + "/katana-parser/src/parser.c", "katanaget_text(parser->scanner)", "/*katanaget_text(parser->scanner)*/\"error\"")

def make():
  base_dir = base.get_script_dir() + "/../../core/Common/3dParty/html"
  base.cmd_in_dir(base_dir, "python", ["fetch.py"])
  return
def build_server_develop():
    server_dir = base.get_script_dir() + "/../../server"
    base.cmd_in_dir(server_dir, "npm", ["install"])
    base.cmd_in_dir(server_dir, "grunt",
                    ["develop", "-v"] + base.server_addons_param())
Exemple #23
0
def install_module(path):
    base.print_info('Install: ' + path)
    base.cmd_in_dir(path, 'npm', ['install'])
Exemple #24
0
def make():
    if not is_main_platform():
        make_xp()
        return

    base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
    if ("ios" == config.option("platform")):
        return

    if (-1 != config.option("platform").find("android")):
        base.cmd_in_dir(base_dir + "/android", "python", ["./make.py"])
        if (-1 == config.option("platform").find("linux")) and (
                -1 == config.option("platform").find("mac")) and (
                    -1 == config.option("platform").find("win")):
            return

    print("[fetch & build]: v8")
    old_env = dict(os.environ)

    old_cur = os.getcwd()
    os.chdir(base_dir)

    if ("windows" == base.host_platform()):
        base.set_env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0")
        base.set_env("GYP_MSVS_VERSION", "2015")

    base.common_check_version("v8", "1", clean)

    if not base.is_dir("v8/out.gn"):
        clean()

    if not base.is_dir("depot_tools"):
        base.cmd(
            "git",
            ["clone", "http://120.92.49.206:3232/chromiumsrc/depot_tools.git"])
        if ("windows" == base.host_platform()):
            # hack for 32 bit system!!!
            if base.is_file("depot_tools/cipd.ps1"):
                base.replaceInFile("depot_tools/cipd.ps1", "windows-386",
                                   "windows-amd64")
        if base.is_file("depot_tools/fetch_configs/v8.py"):
            base.replaceInFile("depot_tools/fetch_configs/v8.py",
                               "https://chromium.googlesource.com/v8/v8.git",
                               "https://gitee.com/mirrors/V8.git")

    os.environ[
        "PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]

    if not base.is_dir("v8/out.gn"):
        base.cmd("gclient")

    # --------------------------------------------------------------------------
    # fetch
    if not base.is_dir("v8"):
        base.cmd("./depot_tools/fetch", ["v8"], True)
        os.chdir(base_dir + "/v8")
        base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True)
        os.chdir(base_dir)

    # --------------------------------------------------------------------------
    # correct
    if not base.is_dir("v8/out.gn"):

        # windows hack (delete later) ----------------------
        if ("windows" == base.host_platform()):
            base.delete_dir_with_access_error("v8/buildtools/win")
            base.cmd("git", ["config", "--system", "core.longpaths", "true"])
            base.cmd("gclient", ["sync", "--force"], True)
        else:
            base.cmd("gclient", ["sync"], True)

        # normal version !!!
        #base.cmd("gclient", ["sync"], True)
        # --------------------------------------------------

        if ("linux" == base.host_platform()):
            if base.is_dir("v8/third_party/binutils/Linux_x64/Release"):
                base.delete_dir("v8/third_party/binutils/Linux_x64/Release")
            if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"):
                base.delete_dir("v8/third_party/binutils/Linux_ia32/Release")

            base.cmd("gclient", ["sync", "--no-history"])

            if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"):
                for file in os.listdir(
                        "v8/third_party/binutils/Linux_x64/Release/bin"):
                    name = file.split("/")[-1]
                    if ("ld.gold" != name):
                        base.cmd("mv", [
                            "v8/third_party/binutils/Linux_x64/Release/bin/" +
                            name,
                            "v8/third_party/binutils/Linux_x64/Release/bin/old_"
                            + name
                        ])
                        base.cmd("ln", [
                            "-s", "/usr/bin/" + name,
                            "v8/third_party/binutils/Linux_x64/Release/bin/" +
                            name
                        ])

            if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"):
                for file in os.listdir(
                        "v8/third_party/binutils/Linux_ia32/Release/bin"):
                    name = file.split("/")[-1]
                    if ("ld.gold" != name):
                        base.cmd("mv", [
                            "v8/third_party/binutils/Linux_ia32/Release/bin/" +
                            name,
                            "v8/third_party/binutils/Linux_ia32/Release/bin/old_"
                            + name
                        ])
                        base.cmd("ln", [
                            "-s", "/usr/bin/" + name,
                            "v8/third_party/binutils/Linux_ia32/Release/bin/" +
                            name
                        ])

        if ("windows" == base.host_platform()):
            base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt",
                               ":dynamic_crt")
        if ("mac" == base.host_platform()):
            base.replaceInFile(
                "v8/build/config/mac/mac_sdk.gni",
                "if (mac_sdk_version != mac_sdk_min_build_override",
                "if (false && mac_sdk_version != mac_sdk_min_build_override")
            base.replaceInFile("v8/build/mac/find_sdk.py",
                               "^MacOSX(10\\.\\d+)\\.sdk$",
                               "^MacOSX(1\\d\\.\\d+)\\.sdk$")

    # --------------------------------------------------------------------------
    # build
    os.chdir("v8")

    base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"
    base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"

    if config.check_option("platform", "linux_64"):
        base.cmd2("gn", [
            "gen", "out.gn/linux_64", "--args=\"is_debug=false " +
            base_args64 + " is_clang=" + is_use_clang() +
            " use_sysroot=false treat_warnings_as_errors=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/linux_64"])

    if config.check_option("platform", "linux_32"):
        base.cmd2("gn", [
            "gen", "out.gn/linux_32", "--args=\"is_debug=false " +
            base_args32 + " is_clang=" + is_use_clang() +
            " use_sysroot=false treat_warnings_as_errors=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/linux_32"])

    if config.check_option("platform", "mac_64"):
        base.cmd2("gn", [
            "gen", "out.gn/mac_64",
            "--args=\"is_debug=false " + base_args64 + "\""
        ])
        base.cmd("ninja", ["-C", "out.gn/mac_64"])

    if config.check_option("platform", "win_64"):
        if (-1 != config.option("config").lower().find("debug")):
            base.cmd2("gn", [
                "gen", "out.gn/win_64/debug",
                "--args=\"is_debug=true " + base_args64 + " is_clang=false\""
            ])
            base.cmd("ninja", ["-C", "out.gn/win_64/debug"])

        base.cmd2("gn", [
            "gen", "out.gn/win_64/release",
            "--args=\"is_debug=false " + base_args64 + " is_clang=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/win_64/release"])

    if config.check_option("platform", "win_32"):
        if (-1 != config.option("config").lower().find("debug")):
            base.cmd2("gn", [
                "gen", "out.gn/win_32/debug",
                "--args=\"is_debug=true " + base_args32 + " is_clang=false\""
            ])
            base.cmd("ninja", ["-C", "out.gn/win_32/debug"])

        base.cmd2("gn", [
            "gen", "out.gn/win_32/release",
            "--args=\"is_debug=false " + base_args32 + " is_clang=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/win_32/release"])

    os.chdir(old_cur)
    os.environ.clear()
    os.environ.update(old_env)

    make_xp()
    return
Exemple #25
0
def run_integration_example():
    base.cmd_in_dir(
        '../../../document-server-integration/web/documentserver-example/nodejs',
        'python', ['run-develop.py'])