mirror of
https://github.com/ONLYOFFICE/build_tools.git
synced 2026-04-07 14:06:31 +08:00
Compare commits
196 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba83513fa3 | |||
| e37c9bce92 | |||
| 073e60d040 | |||
| 66badba0a2 | |||
| 9e09b2737a | |||
| 6dc374c6bf | |||
| 119dc6af77 | |||
| 251a5923f2 | |||
| 602f78ab2a | |||
| 4ee720333d | |||
| b403f04bb6 | |||
| 7e59c568d5 | |||
| e7d609f85c | |||
| 344bf5152a | |||
| e116b9d6f4 | |||
| fc2db8dd7e | |||
| ce748fa881 | |||
| 27e7cc2253 | |||
| a9aead5547 | |||
| 1a2d610039 | |||
| 9ec7f2e29a | |||
| f5d4abd5ac | |||
| 3f72bebfb1 | |||
| 14f857d3a8 | |||
| d95ca411ae | |||
| ebb29f3dd0 | |||
| 6988327dbc | |||
| 4f3694ddb9 | |||
| ff32728095 | |||
| 55a580eb00 | |||
| 7e02786cd3 | |||
| 2a7f301f45 | |||
| 8cba53e8b5 | |||
| e69b69a616 | |||
| 20907e7cab | |||
| b77f139fd2 | |||
| 78ad21d89d | |||
| 88e63978e9 | |||
| e9954f3a47 | |||
| 0861578c14 | |||
| d0738a3585 | |||
| 72b3baf36d | |||
| a8eacdad02 | |||
| 276b2f9c6c | |||
| 8e2b57ea21 | |||
| e49e5a8cc2 | |||
| a18547c771 | |||
| c3eb2e6c9d | |||
| fb6e5efa8b | |||
| 149e928a8c | |||
| fd746856cd | |||
| 410516bf8e | |||
| f8ce636d1a | |||
| 09806db27f | |||
| 4cc0bd8696 | |||
| 25dc0d8937 | |||
| f6105aabd9 | |||
| 827b2d384a | |||
| 62dc58387a | |||
| d78d457064 | |||
| be1368d0df | |||
| 8cccfb95d3 | |||
| fa46b0a8d2 | |||
| 275c1cf63b | |||
| d8522fba35 | |||
| 4ccf7afdac | |||
| 6eab11335c | |||
| c4c2bf341d | |||
| 9085b1965b | |||
| 43142b56b5 | |||
| 3686e77360 | |||
| 15c8159b8d | |||
| b918b0e179 | |||
| 670d255de1 | |||
| af2af9dfc8 | |||
| 8719ac760b | |||
| 82e3a81d72 | |||
| 97d9bbbd1d | |||
| 88ade05b03 | |||
| c1a54ffa7a | |||
| d5813b4506 | |||
| 479db29d51 | |||
| 3461f8c86e | |||
| 87f67c2ed1 | |||
| 0f065be011 | |||
| bc56a130ff | |||
| 2a4bdd43bc | |||
| 08cb8dbe59 | |||
| fe0f63a085 | |||
| f284c9951a | |||
| 8f3fcdfc04 | |||
| de24cdf87c | |||
| 798c1d4c8a | |||
| c0ed15331e | |||
| 02b032e8b8 | |||
| 685a9378f4 | |||
| bb5e60c285 | |||
| 13e9224483 | |||
| 0600e328b2 | |||
| 41a03cedc4 | |||
| d25257abfd | |||
| 23b8c73979 | |||
| cd02fe3ce5 | |||
| 04fb01ac86 | |||
| 0af070e895 | |||
| d62cc2aa74 | |||
| 1ce5f56063 | |||
| 8dcc1e16b4 | |||
| f22853785a | |||
| 0786d40aa3 | |||
| b5deccb8c3 | |||
| e2b83924f2 | |||
| a57f3e7a6e | |||
| 2ceca89488 | |||
| 7ed37328ea | |||
| 4d34ef329e | |||
| 88a9f44409 | |||
| bcb0261944 | |||
| 76ea37dcef | |||
| 632d572dcc | |||
| 0a3415ab9b | |||
| 2213252489 | |||
| 9ab087bb80 | |||
| aee17a98ee | |||
| dd0dec49f8 | |||
| c5fa42edb9 | |||
| 041782b2d9 | |||
| e3f5ee7ed1 | |||
| 001f921199 | |||
| fdb35262d5 | |||
| d3f2a22225 | |||
| 5fed163fad | |||
| 53fff2bbba | |||
| 1c6c44644b | |||
| 619e8004af | |||
| 53a039fcc2 | |||
| f35172aced | |||
| e620f2fd0e | |||
| 3db780f641 | |||
| 42e5be64b0 | |||
| 8b21c54892 | |||
| c6e9dded78 | |||
| f9d7ad4a14 | |||
| 205f1cac11 | |||
| d2ef744fe0 | |||
| 84a55eee4e | |||
| 50e8402dd2 | |||
| f961e91196 | |||
| bf3c8be37d | |||
| 10983f5ba5 | |||
| 5788b5e0e9 | |||
| 7b925419e6 | |||
| 787aae5038 | |||
| b37a57d9c1 | |||
| 0225c5030e | |||
| 60b1a52394 | |||
| d8e1fa0bc4 | |||
| 2d3208ee1f | |||
| 70d30f4db3 | |||
| 1aba51fcc1 | |||
| 90da8d975c | |||
| cf4a1b9545 | |||
| f144f286ca | |||
| 47fb1a4a74 | |||
| 82a728f183 | |||
| b3b2def10c | |||
| f5117abc3f | |||
| be0b236b1d | |||
| 64fb225c90 | |||
| 2f08f7e413 | |||
| c3461c229e | |||
| 9c3a764001 | |||
| 8b60ddfdda | |||
| ffddb2015f | |||
| b562870211 | |||
| e8d77c24f9 | |||
| 68545075fb | |||
| 786b62081b | |||
| 3dece370dd | |||
| 38479b6329 | |||
| 2342a0e57f | |||
| 7be19f6e21 | |||
| 7887d09fbb | |||
| b8475b7560 | |||
| a8b072c830 | |||
| c60a92759a | |||
| a3c0f75db5 | |||
| 4e64d49c88 | |||
| e72c742dcd | |||
| b2657d70fd | |||
| 6bb915f62e | |||
| f545523496 | |||
| a34d1cd413 | |||
| fb09f6799d | |||
| 8e95232846 | |||
| 90e03e5acb |
15
.github/workflows/check.yml
vendored
Normal file
15
.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: check
|
||||
on: [push]
|
||||
jobs:
|
||||
markdownlint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js 12
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
- name: Check *.md files by `markdownlint`
|
||||
run: |
|
||||
npm install -g markdownlint-cli
|
||||
markdownlint *.md
|
||||
@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
node_js: 12
|
||||
jobs:
|
||||
include:
|
||||
- stage: markdownlint
|
||||
script:
|
||||
- npm install -g markdownlint-cli
|
||||
- markdownlint *.md
|
||||
47
build.pro
47
build.pro
@ -32,19 +32,13 @@ core_linux {
|
||||
CONFIG += core_and_multimedia
|
||||
}
|
||||
core_mac {
|
||||
CONFIG += no_use_htmlfileinternal
|
||||
CONFIG += no_desktop_apps
|
||||
}
|
||||
build_xp {
|
||||
CONFIG += no_use_htmlfileinternal
|
||||
}
|
||||
core_ios {
|
||||
CONFIG += no_use_htmlfileinternal
|
||||
CONFIG += no_use_common_binary
|
||||
CONFIG += no_desktop_apps
|
||||
}
|
||||
core_android {
|
||||
CONFIG += no_use_htmlfileinternal
|
||||
CONFIG += no_use_common_binary
|
||||
CONFIG += no_desktop_apps
|
||||
}
|
||||
@ -60,8 +54,10 @@ SUBDIRS = \
|
||||
xpsfile \
|
||||
htmlrenderer \
|
||||
pdfreader \
|
||||
htmlfile \
|
||||
doctrenderer
|
||||
htmlfile2 \
|
||||
doctrenderer \
|
||||
fb2file \
|
||||
epubfile
|
||||
|
||||
!no_x2t {
|
||||
SUBDIRS += \
|
||||
@ -78,10 +74,6 @@ SUBDIRS += \
|
||||
x2t
|
||||
}
|
||||
|
||||
!no_use_htmlfileinternal {
|
||||
SUBDIRS += htmlfileinternal
|
||||
}
|
||||
|
||||
!no_use_common_binary {
|
||||
SUBDIRS += \
|
||||
allfontsgen \
|
||||
@ -142,9 +134,10 @@ ordered {
|
||||
removeFile($$CORE_ROOT_DIR/XpsFile/Makefile.XpsFile$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/HtmlRenderer/Makefile.htmlrenderer$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/PdfReader/Makefile.PdfReader$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/HtmlFile/Makefile.HtmlFile$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/HtmlFile2/Makefile.HtmlFile2$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/EpubFile/Makefile.EpubFile$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/Fb2File/Makefile.Fb2File$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/DesktopEditor/doctrenderer/Makefile.doctrenderer$$PRO_SUFFIX)
|
||||
removeFile($$ROOT_DIR/desktop-sdk/HtmlFile/Internal/Makefile.Internal$$PRO_SUFFIX)
|
||||
|
||||
removeFile($$CORE_ROOT_DIR/DesktopEditor/AllFontsGen/Makefile.AllFontsGen$$PRO_SUFFIX)
|
||||
removeFile($$CORE_ROOT_DIR/DesktopEditor/allthemesgen/Makefile.allthemesgen$$PRO_SUFFIX)
|
||||
@ -201,16 +194,17 @@ htmlrenderer.makefile = $$CORE_ROOT_DIR/HtmlRenderer/Makefile.htmlrenderer$
|
||||
pdfreader.file = $$CORE_ROOT_DIR/PdfReader/PdfReader.pro
|
||||
pdfreader.makefile = $$CORE_ROOT_DIR/PdfReader/Makefile.PdfReader$$PRO_SUFFIX
|
||||
|
||||
htmlfile.file = $$CORE_ROOT_DIR/HtmlFile/HtmlFile.pro
|
||||
htmlfile.makefile = $$CORE_ROOT_DIR/HtmlFile/Makefile.HtmlFile$$PRO_SUFFIX
|
||||
htmlfile2.file = $$CORE_ROOT_DIR/HtmlFile2/HtmlFile2.pro
|
||||
htmlfile2.makefile = $$CORE_ROOT_DIR/HtmlFile2/Makefile.HtmlFile2$$PRO_SUFFIX
|
||||
|
||||
doctrenderer.file = $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/doctrenderer.pro
|
||||
doctrenderer.makefile = $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/Makefile.doctrenderer$$PRO_SUFFIX
|
||||
|
||||
!no_use_htmlfileinternal {
|
||||
htmlfileinternal.file = $$ROOT_DIR/desktop-sdk/HtmlFile/Internal/Internal.pro
|
||||
htmlfileinternal.makefile = $$ROOT_DIR/desktop-sdk/HtmlFile/Internal/Makefile.Internal$$PRO_SUFFIX
|
||||
}
|
||||
fb2file.file = $$CORE_ROOT_DIR/Fb2File/Fb2File.pro
|
||||
fb2file.makefile = $$CORE_ROOT_DIR/Fb2File/Makefile.Fb2File$$PRO_SUFFIX
|
||||
|
||||
epubfile.file = $$CORE_ROOT_DIR/EpubFile/CEpubFile.pro
|
||||
epubfile.makefile = $$CORE_ROOT_DIR/EpubFile/Makefile.EpubFile$$PRO_SUFFIX
|
||||
|
||||
!no_use_common_binary {
|
||||
allfontsgen.file = $$CORE_ROOT_DIR/DesktopEditor/AllFontsGen/AllFontsGen.pro
|
||||
@ -298,18 +292,17 @@ core_and_multimedia {
|
||||
|
||||
# DEPENDS
|
||||
kernel.depends = cryptopp
|
||||
unicodeconverter.depends = kernel
|
||||
graphics.depends = kernel unicodeconverter
|
||||
pdfwriter.depends = kernel unicodeconverter graphics
|
||||
djvufile.depends = kernel unicodeconverter graphics pdfwriter
|
||||
xpsfile.depends = kernel unicodeconverter graphics pdfwriter
|
||||
htmlrenderer.depends = kernel unicodeconverter graphics pdfwriter
|
||||
pdfreader.depends = kernel unicodeconverter graphics pdfwriter htmlrenderer
|
||||
htmlfile.depends = kernel unicodeconverter graphics
|
||||
htmlfile2.depends = kernel unicodeconverter graphics
|
||||
doctrenderer.depends = kernel unicodeconverter graphics
|
||||
|
||||
!no_use_htmlfileinternal {
|
||||
htmlfileinternal.depends = kernel unicodeconverter graphics
|
||||
}
|
||||
fb2file.depends = kernel unicodeconverter graphics
|
||||
epubfile.depends = kernel unicodeconverter graphics htmlfile2
|
||||
|
||||
!no_use_common_binary {
|
||||
allfontsgen.depends = kernel unicodeconverter graphics
|
||||
@ -348,5 +341,7 @@ desktop {
|
||||
docformat \
|
||||
odffilereader \
|
||||
odffilewriter \
|
||||
xlsformat
|
||||
xlsformat \
|
||||
fb2file \
|
||||
epubfile
|
||||
}
|
||||
@ -11,11 +11,18 @@ parser.add_option("--update", action="store", type="string", dest="update", defa
|
||||
parser.add_option("--update-light", action="store", type="string", dest="update-light", default="", help="performs pull/clone without switching branches, can be used only if update is true.")
|
||||
parser.add_option("--branch", action="store", type="string", dest="branch", default="master", help="branch/tag name, used only if update is true and update_light is not used. Updates/clones all the repos and switches the branch to the proper one deleting all the local changes")
|
||||
parser.add_option("--clean", action="store", type="string", dest="clean", default="1", help="defines whether to build everything anew")
|
||||
parser.add_option("--module", action="store", type="string", dest="module", default="builder", help="defines what modules to build. You can specify several of them, e.g. --module 'core desktop builder server develop mobile'")
|
||||
parser.add_option("--module", action="store", type="string", dest="module", default="builder", help="defines what modules to build. You can specify several of them, e.g. --module 'core desktop builder server mobile'")
|
||||
parser.add_option("--develop", action="store", type="string", dest="develop", default="0", help="defines develop mode")
|
||||
parser.add_option("--beta", action="store", type="string", dest="beta", default="0", help="defines beta mode")
|
||||
parser.add_option("--platform", action="store", type="string", dest="platform", default="native", help="defines the destination platform for your build ['win_64', 'win_32', 'win_64_xp', 'win_32_xp', 'linux_64', 'linux_32', 'mac_64', 'ios', 'android_arm64_v8a', 'android_armv7', 'android_x86', 'android_x86_64'; combinations: 'native': your current system (windows/linux/mac only); 'all': all available systems; 'windows': win_64 win_32 win_64_xp win_32_xp; 'linux': linux_64 linux_32; 'mac': mac_64; 'android': android_arm64_v8a android_armv7 android_x86 android_x86_64]")
|
||||
parser.add_option("--config", action="store", type="string", dest="config", default="", help="provides ability to specify additional parameters for qmake")
|
||||
parser.add_option("--qt-dir", action="store", type="string", dest="qt-dir", default="", help="defines qmake directory path. qmake can be found in qt-dir/compiler/bin directory")
|
||||
parser.add_option("--qt-dir-xp", action="store", type="string", dest="qt-dir-xp", default="", help="defines qmake directory path for Windows XP. qmake can be found in 'qt-dir/compiler/bin directory")
|
||||
parser.add_option("--external-folder", action="store", type="string", dest="external-folder", default="", help="defines a directory with external folder")
|
||||
parser.add_option("--sql-type", action="store", type="string", dest="sql-type", default="mysql", help="defines the sql type wich will be used")
|
||||
parser.add_option("--db-port", action="store", type="string", dest="db-port", default="3306", help="defines the sql db-port wich will be used")
|
||||
parser.add_option("--db-user", action="store", type="string", dest="db-user", default="root", help="defines the sql db-user wich will be used")
|
||||
parser.add_option("--db-pass", action="store", type="string", dest="db-pass", default="onlyoffice", help="defines the sql db-pass wich will be used")
|
||||
parser.add_option("--compiler", action="store", type="string", dest="compiler", default="", help="defines compiler name. It is not recommended to use it as it's defined automatically (msvc2015, msvc2015_64, gcc, gcc_64, clang, clang_64, etc)")
|
||||
parser.add_option("--no-apps", action="store", type="string", dest="no-apps", default="0", help="disables building desktop apps that use qt")
|
||||
parser.add_option("--themesparams", action="store", type="string", dest="themesparams", default="", help="provides settings for generating presentation themes thumbnails")
|
||||
|
||||
38
make.py
38
make.py
@ -2,6 +2,8 @@
|
||||
|
||||
import sys
|
||||
sys.path.append('scripts')
|
||||
sys.path.append('scripts/develop')
|
||||
sys.path.append('scripts/develop/vendor')
|
||||
sys.path.append('scripts/core_common')
|
||||
sys.path.append('scripts/core_common/modules')
|
||||
import config
|
||||
@ -11,6 +13,8 @@ import build_js
|
||||
import build_server
|
||||
import deploy
|
||||
import make_common
|
||||
import config_server as develop_config_server
|
||||
import dependence
|
||||
|
||||
# parse configuration
|
||||
config.parse()
|
||||
@ -31,7 +35,7 @@ if ("1" != base.get_env("OO_RUNNING_BRANDING")) and ("" != config.option("brandi
|
||||
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", ["checkout", "-f", config.option("branch")], True)
|
||||
|
||||
base.cmd_in_dir(branding_dir, "git", ["pull"], True)
|
||||
|
||||
@ -49,36 +53,18 @@ base.check_build_version(base_dir)
|
||||
|
||||
# update
|
||||
if ("1" == config.option("update")):
|
||||
base.git_update("core")
|
||||
base.git_update("sdkjs")
|
||||
base.sdkjs_addons_checkout()
|
||||
base.sdkjs_plugins_checkout()
|
||||
base.sdkjs_plugins_server_checkout()
|
||||
base.git_update("web-apps")
|
||||
base.web_apps_addons_checkout()
|
||||
base.git_update("desktop-sdk")
|
||||
base.git_update("dictionaries")
|
||||
|
||||
if config.check_option("module", "builder"):
|
||||
base.git_update("DocumentBuilder")
|
||||
|
||||
if config.check_option("module", "desktop"):
|
||||
base.git_update("desktop-apps")
|
||||
|
||||
if (config.check_option("module", "develop") or config.check_option("module", "server")):
|
||||
base.git_update("server")
|
||||
base.server_addons_checkout()
|
||||
base.git_update("document-server-integration")
|
||||
|
||||
if (config.check_option("module", "develop") or config.check_option("module", "server") or config.check_option("platform", "ios")):
|
||||
base.git_update("core-fonts")
|
||||
repositories = base.get_repositories()
|
||||
base.update_repositories(repositories)
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
# developing...
|
||||
if ("develop" == config.option("module")):
|
||||
if ("1" == config.option("develop")):
|
||||
if not dependence.check_dependencies():
|
||||
exit(1)
|
||||
build_server.build_server_develop()
|
||||
build_js.build_js_develop(base_dir + "/..")
|
||||
deploy.make()
|
||||
develop_config_server.make()
|
||||
exit(0)
|
||||
|
||||
# check only js builds
|
||||
|
||||
262
scripts/base.py
262
scripts/base.py
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import platform
|
||||
import struct
|
||||
import glob
|
||||
import shutil
|
||||
import os
|
||||
@ -27,6 +28,12 @@ def host_platform():
|
||||
return "mac"
|
||||
return ret
|
||||
|
||||
def is_os_64bit():
|
||||
return platform.machine().endswith('64')
|
||||
|
||||
def is_python_64bit():
|
||||
return (struct.calcsize("P") == 8)
|
||||
|
||||
def get_path(path):
|
||||
if "windows" == host_platform():
|
||||
return path.replace("/", "\\")
|
||||
@ -41,7 +48,7 @@ def set_env(name, value):
|
||||
|
||||
def configure_common_apps(file=""):
|
||||
if ("windows" == host_platform()):
|
||||
os.environ["PATH"] = get_script_dir(file) + "/../tools/win/7z" + os.pathsep + get_script_dir() + "/../tools/win/curl" + os.pathsep + os.environ["PATH"]
|
||||
os.environ["PATH"] = get_script_dir(file) + "/../tools/win/7z" + os.pathsep + get_script_dir(file) + "/../tools/win/curl" + os.pathsep + get_script_dir(file) + "/../tools/win/vswhere" + os.pathsep + os.environ["PATH"]
|
||||
elif ("mac" == host_platform()):
|
||||
os.environ["PATH"] = get_script_dir(file) + "/../tools/mac" + os.pathsep + os.environ["PATH"]
|
||||
return
|
||||
@ -63,6 +70,13 @@ def print_info(info=""):
|
||||
print("------------------------------------------")
|
||||
return
|
||||
|
||||
def print_error(error=""):
|
||||
print("\033[91m" + error + "\033[0m")
|
||||
|
||||
def print_list(list):
|
||||
print('[%s]' % ', '.join(map(str, list)))
|
||||
return
|
||||
|
||||
# file system -------------------------------------------
|
||||
def is_file(path):
|
||||
return os.path.isfile(get_path(path))
|
||||
@ -293,6 +307,28 @@ def cmd_in_dir(directory, prog, args=[], is_no_errors=False):
|
||||
os.chdir(cur_dir)
|
||||
return ret
|
||||
|
||||
def run_command(sCommand):
|
||||
popen = subprocess.Popen(sCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
result = {'stdout' : '', 'stderr' : ''}
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
result['stdout'] = stdout.strip().decode('utf-8', errors='ignore')
|
||||
result['stderr'] = stderr.strip().decode('utf-8', errors='ignore')
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
|
||||
return result
|
||||
|
||||
def run_command_in_dir(directory, sCommand):
|
||||
dir = get_path(directory)
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(dir)
|
||||
ret = run_command(sCommand)
|
||||
os.chdir(cur_dir)
|
||||
return ret
|
||||
|
||||
def run_process(args=[]):
|
||||
subprocess.Popen(args)
|
||||
|
||||
@ -353,6 +389,86 @@ def git_update(repo, is_no_errors=False, is_current_dir=False):
|
||||
os.chdir(old_cur)
|
||||
return
|
||||
|
||||
def get_repositories():
|
||||
result = {}
|
||||
result["core"] = [False, False]
|
||||
result["sdkjs"] = [False, False]
|
||||
result.update(get_sdkjs_addons())
|
||||
result.update(get_sdkjs_plugins())
|
||||
result.update(get_sdkjs_plugins_server())
|
||||
result["web-apps"] = [False, False]
|
||||
result.update(get_web_apps_addons())
|
||||
result["dictionaries"] = [False, False]
|
||||
|
||||
if config.check_option("module", "builder"):
|
||||
result["DocumentBuilder"] = [False, False]
|
||||
|
||||
if config.check_option("module", "desktop"):
|
||||
result["desktop-sdk"] = [False, False]
|
||||
result["desktop-apps"] = [False, False]
|
||||
|
||||
if (config.check_option("module", "server")):
|
||||
result["server"] = [False, False]
|
||||
result.update(get_server_addons())
|
||||
result["document-server-integration"] = [False, False]
|
||||
|
||||
if (config.check_option("module", "server") or config.check_option("platform", "ios")):
|
||||
result["core-fonts"] = [False, False]
|
||||
return result
|
||||
|
||||
def create_pull_request(branches_to, repo, is_no_errors=False, is_current_dir=False):
|
||||
print("[git] create pull request: " + repo)
|
||||
url = "https://github.com/ONLYOFFICE/" + repo + ".git"
|
||||
if config.option("git-protocol") == "ssh":
|
||||
url = "git@github.com:ONLYOFFICE/" + repo + ".git"
|
||||
folder = get_script_dir() + "/../../" + repo
|
||||
if is_current_dir:
|
||||
folder = repo
|
||||
is_not_exit = False
|
||||
if not is_dir(folder):
|
||||
retClone = cmd("git", ["clone", url, folder], is_no_errors)
|
||||
if retClone != 0:
|
||||
return
|
||||
is_not_exit = True
|
||||
old_cur = os.getcwd()
|
||||
os.chdir(folder)
|
||||
cmd("git", ["checkout", "-f", config.option("branch")], is_no_errors)
|
||||
cmd("git", ["pull"], is_no_errors)
|
||||
for branch_to in branches_to:
|
||||
if "" != run_command("git log origin/" + branch_to + "..origin/" + config.option("branch"))["stdout"]:
|
||||
cmd("git", ["checkout", "-f", branch_to], is_no_errors)
|
||||
cmd("git", ["pull"], is_no_errors)
|
||||
cmd("hub", ["pull-request", "--force", "--base", branch_to, "--head", config.option("branch"), "--no-edit"], is_no_errors)
|
||||
if 0 != cmd("git", ["merge", "origin/" + config.option("branch"), "--no-ff", "--no-edit"], is_no_errors):
|
||||
print_error("[git] Conflicts merge " + "origin/" + config.option("branch") + " to " + branch_to + " in repo " + url)
|
||||
cmd("git", ["merge", "--abort"], is_no_errors)
|
||||
else:
|
||||
cmd("git", ["push"], is_no_errors)
|
||||
|
||||
os.chdir(old_cur)
|
||||
return
|
||||
|
||||
def update_repositories(repositories):
|
||||
for repo in repositories:
|
||||
value = repositories[repo]
|
||||
current_dir = value[1]
|
||||
if current_dir == False:
|
||||
git_update(repo, value[0], False)
|
||||
else:
|
||||
if is_dir(current_dir + "/.git"):
|
||||
delete_dir_with_access_error(current_dir);
|
||||
delete_dir(current_dir)
|
||||
if not is_dir(current_dir):
|
||||
create_dir(current_dir)
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(current_dir)
|
||||
git_update(repo, value[0], True)
|
||||
os.chdir(cur_dir)
|
||||
|
||||
def git_dir():
|
||||
if ("windows" == host_platform()):
|
||||
return run_command("git --info-path")['stdout'] + "/../../.."
|
||||
|
||||
# qmake -------------------------------------------------
|
||||
def qt_setup(platform):
|
||||
compiler = config.check_compiler(platform)
|
||||
@ -515,7 +631,7 @@ def generate_plist(path):
|
||||
bundle_version_natural = readFile(get_script_dir() + "/../../core/Common/version.txt").split(".")
|
||||
bundle_version = []
|
||||
for n in bundle_version_natural:
|
||||
bundle_version.append("255" if int(n) > 255 else n)
|
||||
bundle_version.append(n)
|
||||
|
||||
for file in glob.glob(path + "/*.framework"):
|
||||
if not is_dir(file):
|
||||
@ -556,76 +672,53 @@ def generate_plist(path):
|
||||
|
||||
return
|
||||
|
||||
def sdkjs_addons_checkout():
|
||||
def get_sdkjs_addons():
|
||||
result = {}
|
||||
if ("" == config.option("sdkjs-addons")):
|
||||
return
|
||||
return result
|
||||
addons_list = config.option("sdkjs-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.sdkjs_addons:
|
||||
git_update(config.sdkjs_addons[name], True)
|
||||
result[name] = [True, False]
|
||||
|
||||
if ("" != config.option("sdkjs-addons-desktop")):
|
||||
addons_list = config.option("sdkjs-addons-desktop").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.sdkjs_addons_desktop:
|
||||
git_update(config.sdkjs_addons_desktop[name], True)
|
||||
return
|
||||
result[name] = [True, False]
|
||||
return result
|
||||
|
||||
def server_addons_checkout():
|
||||
def get_server_addons():
|
||||
result = {}
|
||||
if ("" == config.option("server-addons")):
|
||||
return
|
||||
return result
|
||||
addons_list = config.option("server-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.server_addons:
|
||||
git_update(config.server_addons[name], True)
|
||||
return
|
||||
result[name] = [True, False]
|
||||
return result
|
||||
|
||||
def web_apps_addons_checkout():
|
||||
def get_web_apps_addons():
|
||||
result = {}
|
||||
if ("" == config.option("web-apps-addons")):
|
||||
return
|
||||
return result
|
||||
addons_list = config.option("web-apps-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.web_apps_addons:
|
||||
git_update(config.web_apps_addons[name], True)
|
||||
return
|
||||
result[name] = [True, False]
|
||||
return result
|
||||
|
||||
def sdkjs_plugins_checkout():
|
||||
plugins_list_config = config.option("sdkjs-plugin")
|
||||
if ("" == plugins_list_config):
|
||||
return
|
||||
plugins_list = plugins_list_config.rsplit(", ")
|
||||
def get_plugins(plugins_list=""):
|
||||
result = {}
|
||||
if ("" == plugins_list):
|
||||
return result
|
||||
plugins_list = plugins_list.rsplit(", ")
|
||||
plugins_dir = get_script_dir() + "/../../sdkjs-plugins"
|
||||
if is_dir(plugins_dir + "/.git"):
|
||||
delete_dir_with_access_error(plugins_dir);
|
||||
delete_dir(plugins_dir)
|
||||
if not is_dir(plugins_dir):
|
||||
create_dir(plugins_dir)
|
||||
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(plugins_dir)
|
||||
for name in plugins_list:
|
||||
git_update("plugin-" + name, True, True)
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
result["plugin-" + name] = [True, plugins_dir]
|
||||
return result
|
||||
|
||||
def sdkjs_plugins_server_checkout():
|
||||
plugins_list_config = config.option("sdkjs-plugin-server")
|
||||
if ("" == plugins_list_config):
|
||||
return
|
||||
plugins_list = plugins_list_config.rsplit(", ")
|
||||
plugins_dir = get_script_dir() + "/../../sdkjs-plugins"
|
||||
if is_dir(plugins_dir + "/.git"):
|
||||
delete_dir_with_access_error(plugins_dir);
|
||||
delete_dir(plugins_dir)
|
||||
if not is_dir(plugins_dir):
|
||||
create_dir(plugins_dir)
|
||||
def get_sdkjs_plugins():
|
||||
return get_plugins(config.option("sdkjs-plugin"))
|
||||
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(plugins_dir)
|
||||
for name in plugins_list:
|
||||
git_update("plugin-" + name, True, True)
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
def get_sdkjs_plugins_server():
|
||||
return get_plugins(config.option("sdkjs-plugin-server"))
|
||||
|
||||
def sdkjs_addons_param():
|
||||
if ("" == config.option("sdkjs-addons")):
|
||||
@ -633,8 +726,7 @@ def sdkjs_addons_param():
|
||||
params = []
|
||||
addons_list = config.option("sdkjs-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.sdkjs_addons:
|
||||
params.append("--addon=" + config.sdkjs_addons[name])
|
||||
params.append("--addon=" + name)
|
||||
return params
|
||||
|
||||
def sdkjs_addons_desktop_param():
|
||||
@ -643,8 +735,7 @@ def sdkjs_addons_desktop_param():
|
||||
params = []
|
||||
addons_list = config.option("sdkjs-addons-desktop").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.sdkjs_addons_desktop:
|
||||
params.append("--addon=" + config.sdkjs_addons_desktop[name])
|
||||
params.append("--addon=" + name)
|
||||
return params
|
||||
|
||||
def server_addons_param():
|
||||
@ -653,8 +744,7 @@ def server_addons_param():
|
||||
params = []
|
||||
addons_list = config.option("server-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.server_addons:
|
||||
params.append("--addon=" + config.server_addons[name])
|
||||
params.append("--addon=" + name)
|
||||
return params
|
||||
|
||||
def web_apps_addons_param():
|
||||
@ -663,8 +753,7 @@ def web_apps_addons_param():
|
||||
params = []
|
||||
addons_list = config.option("web-apps-addons").rsplit(", ")
|
||||
for name in addons_list:
|
||||
if name in config.web_apps_addons:
|
||||
params.append("--addon=" + config.web_apps_addons[name])
|
||||
params.append("--addon=" + name)
|
||||
return params
|
||||
|
||||
# common apps
|
||||
@ -758,27 +847,18 @@ def join_scripts(files, path):
|
||||
return
|
||||
|
||||
def get_file_last_modified_url(url):
|
||||
curl_command = 'curl --head %s' % (url)
|
||||
popen = subprocess.Popen(curl_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
retvalue = ""
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
|
||||
lines = stdout.strip().decode("utf-8").split("\n")
|
||||
for line in lines:
|
||||
if ':' not in line:
|
||||
continue
|
||||
line = line.strip()
|
||||
key, value = line.split(':', 1)
|
||||
key = key.upper()
|
||||
if key == "LAST-MODIFIED":
|
||||
retvalue = value
|
||||
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
|
||||
curl_command = 'curl --head %s' % (url)
|
||||
lines = run_command(curl_command)['stdout'].split("\n")
|
||||
for line in lines:
|
||||
if ':' not in line:
|
||||
continue
|
||||
line = line.strip()
|
||||
key, value = line.split(':', 1)
|
||||
key = key.upper()
|
||||
if key == "LAST-MODIFIED":
|
||||
retvalue = value
|
||||
|
||||
return retvalue
|
||||
|
||||
def mac_correct_rpath_binary(path, libs):
|
||||
@ -794,11 +874,13 @@ def mac_correct_rpath_x2t(dir):
|
||||
os.chdir(dir)
|
||||
mac_correct_rpath_library("icudata.58", [])
|
||||
mac_correct_rpath_library("icuuc.58", ["icudata.58"])
|
||||
mac_correct_rpath_library("UnicodeConverter", ["icuuc.58", "icudata.58"])
|
||||
mac_correct_rpath_library("UnicodeConverter", ["icuuc.58", "icudata.58", "kernel"])
|
||||
mac_correct_rpath_library("kernel", [])
|
||||
mac_correct_rpath_library("graphics", ["UnicodeConverter", "kernel"])
|
||||
mac_correct_rpath_library("doctrenderer", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("HtmlFile", ["UnicodeConverter", "kernel"])
|
||||
mac_correct_rpath_library("HtmlFile2", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("EpubFile", ["kernel", "HtmlFile2"])
|
||||
mac_correct_rpath_library("Fb2File", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("HtmlRenderer", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("PdfWriter", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("DjVuFile", ["kernel", "UnicodeConverter", "graphics", "PdfWriter"])
|
||||
@ -806,7 +888,7 @@ def mac_correct_rpath_x2t(dir):
|
||||
mac_correct_rpath_library("XpsFile", ["kernel", "UnicodeConverter", "graphics", "PdfWriter"])
|
||||
cmd("chmod", ["-v", "+x", "./x2t"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./x2t"], True)
|
||||
mac_correct_rpath_binary("./x2t", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "graphics", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "HtmlFile", "doctrenderer"])
|
||||
mac_correct_rpath_binary("./x2t", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "graphics", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer"])
|
||||
if is_file("./allfontsgen"):
|
||||
cmd("chmod", ["-v", "+x", "./allfontsgen"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./allfontsgen"], True)
|
||||
@ -874,6 +956,9 @@ def copy_sdkjs_plugin(src_dir, dst_dir, name, is_name_as_guid=False, is_desktop_
|
||||
delete_dir(dst_dir_path)
|
||||
create_dir(dst_dir_path)
|
||||
copy_dir_content(src_dir_path, dst_dir_path, "", ".git")
|
||||
if is_desktop_local:
|
||||
for file in glob.glob(dst_dir_path + "/*.html"):
|
||||
replaceInFile(file, "https://onlyoffice.github.io/sdkjs-plugins/", "../")
|
||||
return
|
||||
if not is_file(src_dir_path + "/config.json"):
|
||||
return
|
||||
@ -932,16 +1017,7 @@ def support_old_versions_plugins(out_dir):
|
||||
return
|
||||
|
||||
def get_xcode_major_version():
|
||||
popen = subprocess.Popen("xcodebuild -version", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
version = ""
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
version = stdout.strip().decode("utf-8")
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
|
||||
version = run_command("xcodebuild -version")['stdout']
|
||||
return int(version.split('.')[0][6:])
|
||||
|
||||
def hack_xcode_ios():
|
||||
|
||||
@ -13,7 +13,7 @@ def make_pro_file(makefiles_dir, pro_file):
|
||||
print("------------------------------------------")
|
||||
print("BUILD_PLATFORM: " + platform)
|
||||
print("------------------------------------------")
|
||||
old_env = os.environ.copy()
|
||||
old_env = dict(os.environ)
|
||||
|
||||
# if you need change output libraries path - set the env variable
|
||||
# base.set_env("DESTDIR_BUILD_OVERRIDE", os.getcwd() + "/out/android/" + config.branding() + "/mobile")
|
||||
@ -29,10 +29,7 @@ def make_pro_file(makefiles_dir, pro_file):
|
||||
new_path += (base.get_env("ANDROID_NDK_ROOT") + "/toolchains/llvm/prebuilt/" + toolchain_platform + "/bin:")
|
||||
new_path += old_path
|
||||
base.set_env("PATH", new_path)
|
||||
if ("android_arm64_v8a" == platform):
|
||||
base.set_env("ANDROID_NDK_PLATFORM", "android-21")
|
||||
else:
|
||||
base.set_env("ANDROID_NDK_PLATFORM", "android-16")
|
||||
base.set_env("ANDROID_NDK_PLATFORM", "android-21")
|
||||
|
||||
if (-1 != platform.find("ios")):
|
||||
base.hack_xcode_ios()
|
||||
@ -83,7 +80,8 @@ def make_pro_file(makefiles_dir, pro_file):
|
||||
qmake_bat.append("call nmake -f " + makefiles_dir + "/build.makefile_" + file_suff)
|
||||
base.run_as_bat(qmake_bat)
|
||||
|
||||
os.environ = old_env.copy()
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
|
||||
base.delete_file(".qmake.stash")
|
||||
|
||||
@ -92,5 +90,17 @@ def make():
|
||||
is_no_brandind_build = base.is_file("config")
|
||||
make_pro_file("makefiles", "build.pro")
|
||||
if config.check_option("module", "builder") and base.is_windows() and is_no_brandind_build:
|
||||
# check replace
|
||||
replace_path_lib = ""
|
||||
replace_path_lib_file = os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/docbuilder.h"
|
||||
option_branding = config.option("branding")
|
||||
if (option_branding != ""):
|
||||
replace_path_lib = "../../../build/" + option_branding + "/lib/"
|
||||
# replace
|
||||
if (replace_path_lib != ""):
|
||||
base.replaceInFile(replace_path_lib_file, "../../../build/lib/", replace_path_lib)
|
||||
base.bash("../core/DesktopEditor/doctrenderer/docbuilder.com/build")
|
||||
# restore
|
||||
if (replace_path_lib != ""):
|
||||
base.replaceInFile(replace_path_lib_file, replace_path_lib, "../../../build/lib/")
|
||||
return
|
||||
|
||||
@ -52,6 +52,7 @@ def make():
|
||||
# banners
|
||||
base.join_scripts([vendor_dir_src + "xregexp/xregexp-all-min.js",
|
||||
vendor_dir_src + "underscore/underscore-min.js",
|
||||
base_dir + "/../sdkjs/common/externs/jszip-utils.js",
|
||||
sdk_dir_src + "common/Native/native.js",
|
||||
sdk_dir_src + "../../common/Native/Wrappers/common.js",
|
||||
sdk_dir_src + "common/Native/jquery_native.js"],
|
||||
@ -80,30 +81,39 @@ def build_interface(directory):
|
||||
_run_grunt(directory, ["--force"] + base.web_apps_addons_param())
|
||||
return
|
||||
|
||||
def get_build_param(minimize=True):
|
||||
beta = "true" if config.check_option("beta", "1") else "false"
|
||||
params = ["--beta=" + beta]
|
||||
return params + (["--level=ADVANCED"] if minimize else ["--level=WHITESPACE_ONLY", "--formatting=PRETTY_PRINT"])
|
||||
|
||||
def build_sdk_desktop(directory):
|
||||
#_run_npm_cli(directory)
|
||||
_run_npm(directory)
|
||||
_run_grunt(directory, ["--level=ADVANCED", "--desktop=true"] + base.sdkjs_addons_param() + base.sdkjs_addons_desktop_param())
|
||||
_run_grunt(directory, get_build_param() + ["--desktop=true"] + base.sdkjs_addons_param() + base.sdkjs_addons_desktop_param())
|
||||
return
|
||||
|
||||
def build_sdk_builder(directory):
|
||||
#_run_npm_cli(directory)
|
||||
_run_npm(directory)
|
||||
_run_grunt(directory, ["--level=ADVANCED"] + base.sdkjs_addons_param())
|
||||
_run_grunt(directory, get_build_param() + base.sdkjs_addons_param())
|
||||
return
|
||||
|
||||
def build_sdk_native(directory):
|
||||
#_run_npm_cli(directory)
|
||||
_run_npm(directory)
|
||||
_run_grunt(directory, ["--level=ADVANCED", "--mobile=true"] + base.sdkjs_addons_param())
|
||||
_run_grunt(directory, get_build_param() + ["--mobile=true"] + base.sdkjs_addons_param())
|
||||
return
|
||||
|
||||
def build_js_develop(root_dir):
|
||||
#_run_npm_cli(root_dir + "/sdkjs/build")
|
||||
_run_npm(root_dir + "/sdkjs/build")
|
||||
_run_grunt(root_dir + "/sdkjs/build", ["--level=WHITESPACE_ONLY", "--formatting=PRETTY_PRINT"] + base.sdkjs_addons_param())
|
||||
_run_grunt(root_dir + "/sdkjs/build", ["develop"] + base.sdkjs_addons_param())
|
||||
_run_npm(root_dir + "/web-apps/build")
|
||||
_run_npm(root_dir + "/web-apps/build/sprites")
|
||||
_run_grunt(root_dir + "/web-apps/build/sprites", [])
|
||||
external_folder = config.option("--external-folder")
|
||||
if (external_folder != ""):
|
||||
external_folder = "/" + external_folder
|
||||
|
||||
_run_npm(root_dir + external_folder + "/sdkjs/build")
|
||||
_run_grunt(root_dir + external_folder + "/sdkjs/build", get_build_param(False) + base.sdkjs_addons_param())
|
||||
_run_grunt(root_dir + external_folder + "/sdkjs/build", ["develop"] + base.sdkjs_addons_param())
|
||||
_run_npm(root_dir + external_folder + "/web-apps/build")
|
||||
_run_npm(root_dir + external_folder + "/web-apps/build/sprites")
|
||||
_run_grunt(root_dir + external_folder + "/web-apps/build/sprites", [])
|
||||
return
|
||||
|
||||
@ -55,5 +55,18 @@ def make():
|
||||
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"])
|
||||
|
||||
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())
|
||||
|
||||
@ -71,25 +71,6 @@ def parse():
|
||||
if not "sdkjs-plugin-server" in options:
|
||||
options["sdkjs-plugin-server"] = "default"
|
||||
|
||||
global sdkjs_addons
|
||||
sdkjs_addons = {}
|
||||
sdkjs_addons["comparison"] = "sdkjs-comparison"
|
||||
sdkjs_addons["content-controls"] = "sdkjs-content-controls"
|
||||
sdkjs_addons["sheet-views"] = "sdkjs-sheet-views"
|
||||
|
||||
global sdkjs_addons_desktop
|
||||
sdkjs_addons_desktop = {}
|
||||
sdkjs_addons_desktop["disable-features"] = "sdkjs-disable-features"
|
||||
|
||||
global server_addons
|
||||
server_addons = {}
|
||||
server_addons["license"] = "server-license"
|
||||
server_addons["lockstorage"] = "server-lockstorage"
|
||||
|
||||
global web_apps_addons
|
||||
web_apps_addons = {}
|
||||
web_apps_addons["mobile"] = "web-apps-mobile"
|
||||
|
||||
return
|
||||
|
||||
def check_compiler(platform):
|
||||
@ -166,4 +147,6 @@ def parse_defaults():
|
||||
for name in defaults_options:
|
||||
if name in options:
|
||||
options[name] = options[name].replace("default", defaults_options[name])
|
||||
else:
|
||||
options[name] = defaults_options[name]
|
||||
return
|
||||
|
||||
@ -12,6 +12,7 @@ import cef
|
||||
import icu
|
||||
import openssl
|
||||
import v8
|
||||
import html2
|
||||
|
||||
def make():
|
||||
boost.make()
|
||||
@ -19,4 +20,5 @@ def make():
|
||||
icu.make()
|
||||
openssl.make()
|
||||
v8.make()
|
||||
html2.make()
|
||||
return
|
||||
|
||||
@ -15,7 +15,7 @@ def make():
|
||||
|
||||
platforms = ["win_64", "win_32", "win_64_xp", "win_32_xp", "linux_64", "linux_32", "mac_64"]
|
||||
|
||||
url = "http://d2ettrnqo7v976.cloudfront.net/cef/3770/"
|
||||
url = "http://d2ettrnqo7v976.cloudfront.net/cef/4280/"
|
||||
|
||||
for platform in platforms:
|
||||
if not config.check_option("platform", platform):
|
||||
|
||||
13
scripts/core_common/modules/html2.py
Normal file
13
scripts/core_common/modules/html2.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../..')
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def make():
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/html"
|
||||
base.cmd_in_dir(base_dir, "python", ["fetch.py"])
|
||||
return
|
||||
@ -5,12 +5,13 @@ sys.path.append('../..')
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
import icu_android
|
||||
|
||||
def make():
|
||||
print("[fetch & build]: icu")
|
||||
|
||||
if (config.option("module") == "mobile") and (-1 == config.option("platform").find("ios")):
|
||||
return
|
||||
if (-1 != config.option("platform").find("android")):
|
||||
icu_android.make()
|
||||
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/icu"
|
||||
old_cur = os.getcwd()
|
||||
|
||||
172
scripts/core_common/modules/icu_android.py
Executable file
172
scripts/core_common/modules/icu_android.py
Executable file
@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../..')
|
||||
import base
|
||||
import os
|
||||
|
||||
current_dir = base.get_script_dir() + "/../../core/Common/3dParty/icu/android"
|
||||
|
||||
toolshains_dir = current_dir + "/toolchains"
|
||||
icu_major = "58"
|
||||
icu_minor = "2"
|
||||
icu_is_shared = False
|
||||
|
||||
current_path = base.get_env("PATH")
|
||||
|
||||
platforms = {
|
||||
"arm64" : {
|
||||
"arch" : "aarch64-linux-android",
|
||||
"bin" : "aarch64-linux-android"
|
||||
},
|
||||
"arm" : {
|
||||
"arch" : "arm-linux-androideabi",
|
||||
"bin" : "arm-linux-androideabi"
|
||||
},
|
||||
"x86_64" : {
|
||||
"arch" : "x86_64-linux-android",
|
||||
"bin" : "x86_64-linux-android"
|
||||
},
|
||||
"x86" : {
|
||||
"arch" : "x86-linux-android",
|
||||
"bin" : "i686-linux-android"
|
||||
}
|
||||
}
|
||||
|
||||
def build_arch(arch, api_version):
|
||||
print("icu build: " + arch + " ----------------------------------------")
|
||||
|
||||
if base.is_dir(current_dir + "/icu/" + arch):
|
||||
base.delete_dir(current_dir + "/icu/" + arch)
|
||||
base.create_dir(current_dir + "/icu/" + arch)
|
||||
os.chdir(current_dir + "/icu/" + arch)
|
||||
|
||||
base.cmd(base.get_env("ANDROID_NDK_ROOT") + "/build/tools/make-standalone-toolchain.sh", [
|
||||
"--platform=android-" + api_version,
|
||||
"--install-dir=" + current_dir + "/toolchain/" + arch,
|
||||
"--toolchain=" + platforms[arch]["arch"],
|
||||
"--force"
|
||||
])
|
||||
|
||||
base.set_env("PATH", current_dir + "/toolchain/" + arch + "/bin:" + current_path)
|
||||
|
||||
command_args = "--prefix=" + current_dir + "/build_tmp/" + arch + " --host=!!!MASK!!! --with-cross-build=" + current_dir + "/icu/cross_build CFLAGS=-Os CXXFLAGS=--std=c++11 CC=!!!MASK!!!-clang CXX=!!!MASK!!!-clang++ AR=!!!MASK!!!-ar RANLIB=!!!MASK!!!-ranlib"
|
||||
if not icu_is_shared:
|
||||
command_args += " --enable-static --enable-shared=no --with-data-packaging=archive CFLAGS=-fPIC CXXFLAGS=-fPIC"
|
||||
command_args = command_args.replace("!!!MASK!!!", platforms[arch]["bin"])
|
||||
|
||||
base.cmd("../source/configure", command_args.split())
|
||||
base.cmd("make", ["-j4"])
|
||||
base.cmd("make", ["install"])
|
||||
|
||||
base.set_env("PATH", current_path)
|
||||
os.chdir(current_dir)
|
||||
|
||||
return
|
||||
|
||||
def make():
|
||||
if not base.is_dir(current_dir):
|
||||
base.create_dir(current_dir)
|
||||
|
||||
if base.is_dir(current_dir + "/build"):
|
||||
return
|
||||
|
||||
current_dir_old = os.getcwd()
|
||||
|
||||
print("[fetch & build]: icu_android")
|
||||
os.chdir(current_dir)
|
||||
|
||||
if not base.is_dir("icu"):
|
||||
base.cmd("svn", ["export", "https://github.com/unicode-org/icu/tags/release-" + icu_major + "-" + icu_minor + "/icu4c", "./icu", "--non-interactive", "--trust-server-cert"])
|
||||
if ("linux" == base.host_platform()):
|
||||
base.replaceInFile(current_dir + "/icu/source/i18n/digitlst.cpp", "xlocale", "locale")
|
||||
#if ("mac" == base.host_platform()):
|
||||
# base.replaceInFile(current_dir + "/icu/source/tools/pkgdata/pkgdata.cpp", "cmd, \"%s %s -o %s%s %s %s%s %s %s\",", "cmd, \"%s %s -o %s%s %s %s %s %s %s\",")
|
||||
|
||||
if not base.is_dir(current_dir + "/icu/cross_build"):
|
||||
base.create_dir(current_dir + "/icu/cross_build")
|
||||
os.chdir(current_dir + "/icu/cross_build")
|
||||
base.cmd("../source/runConfigureICU", ["Linux" if "linux" == base.host_platform() else "MacOSX",
|
||||
"--prefix=" + current_dir + "/icu/cross_build", "CFLAGS=-Os CXXFLAGS=--std=c++11"])
|
||||
base.cmd("make", ["-j4"])
|
||||
base.cmd("make", ["install"], True)
|
||||
|
||||
os.chdir(current_dir)
|
||||
|
||||
build_arch("arm64", "21")
|
||||
build_arch("arm", "16")
|
||||
build_arch("x86_64","21")
|
||||
build_arch("x86", "16")
|
||||
|
||||
os.chdir(current_dir)
|
||||
|
||||
base.create_dir(current_dir + "/build")
|
||||
base.copy_dir(current_dir + "/build_tmp/arm64/include", current_dir + "/build/include")
|
||||
|
||||
if icu_is_shared:
|
||||
base.create_dir(current_dir + "/build/arm64_v8a")
|
||||
base.copy_file(current_dir + "/build_tmp/arm64/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/arm64_v8a/libicudata.so")
|
||||
base.copy_file(current_dir + "/build_tmp/arm64/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/arm64_v8a/libicuuc.so")
|
||||
|
||||
base.create_dir(current_dir + "/build/armv7")
|
||||
base.copy_file(current_dir + "/build_tmp/arm/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/armv7/libicudata.so")
|
||||
base.copy_file(current_dir + "/build_tmp/arm/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/armv7/libicuuc.so")
|
||||
|
||||
base.create_dir(current_dir + "/build/x86_64")
|
||||
base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/x86_64/libicudata.so")
|
||||
base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/x86_64/libicuuc.so")
|
||||
|
||||
base.create_dir(current_dir + "/build/x86")
|
||||
base.copy_file(current_dir + "/build_tmp/x86/lib/libicudata.so." + icu_major + "." + icu_minor, current_dir + "/build/x86/libicudata.so")
|
||||
base.copy_file(current_dir + "/build_tmp/x86/lib/libicuuc.so." + icu_major + "." + icu_minor, current_dir + "/build/x86/libicuuc.so")
|
||||
|
||||
# patch elf information
|
||||
os.chdir(current_dir + "/build")
|
||||
base.cmd("git", ["clone", "https://github.com/NixOS/patchelf.git"])
|
||||
os.chdir("./patchelf")
|
||||
base.cmd("./bootstrap.sh")
|
||||
base.cmd("./configure", ["--prefix=" + current_dir + "/build/patchelf/usr"])
|
||||
base.cmd("make")
|
||||
base.cmd("make", ["install"])
|
||||
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../arm64_v8a/libicudata.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../arm64_v8a/libicuuc.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../arm64_v8a/libicuuc.so"])
|
||||
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../armv7/libicudata.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../armv7/libicuuc.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../armv7/libicuuc.so"])
|
||||
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../x86_64/libicudata.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../x86_64/libicuuc.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../x86_64/libicuuc.so"])
|
||||
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicudata.so", "./../x86/libicudata.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--set-soname", "libicuuc.so", "./../x86/libicuuc.so"])
|
||||
base.cmd("./usr/bin/patchelf", ["--replace-needed", "libicudata.so." + icu_major, "libicudata.so", "./../x86/libicuuc.so"])
|
||||
|
||||
base.delete_dir(current_dir + "/build/patchelf")
|
||||
|
||||
if not icu_is_shared:
|
||||
base.create_dir(current_dir + "/build/arm64_v8a")
|
||||
base.copy_file(current_dir + "/build_tmp/arm64/lib/libicudata.a", current_dir + "/build/arm64_v8a/libicudata.a")
|
||||
base.copy_file(current_dir + "/build_tmp/arm64/lib/libicuuc.a", current_dir + "/build/arm64_v8a/libicuuc.a")
|
||||
base.copy_file(current_dir + "/icu/arm64/data/out/icudt58l.dat", current_dir + "/build/arm64_v8a/icudt58l.dat")
|
||||
|
||||
base.create_dir(current_dir + "/build/armv7")
|
||||
base.copy_file(current_dir + "/build_tmp/arm/lib/libicudata.a", current_dir + "/build/armv7/libicudata.a")
|
||||
base.copy_file(current_dir + "/build_tmp/arm/lib/libicuuc.a", current_dir + "/build/armv7/libicuuc.a")
|
||||
base.copy_file(current_dir + "/icu/arm/data/out/icudt58l.dat", current_dir + "/build/armv7/icudt58l.dat")
|
||||
|
||||
base.create_dir(current_dir + "/build/x86_64")
|
||||
base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicudata.a", current_dir + "/build/x86_64/libicudata.a")
|
||||
base.copy_file(current_dir + "/build_tmp/x86_64/lib/libicuuc.a", current_dir + "/build/x86_64/libicuuc.a")
|
||||
base.copy_file(current_dir + "/icu/x86_64/data/out/icudt58l.dat", current_dir + "/build/x86_64/icudt58l.dat")
|
||||
|
||||
base.create_dir(current_dir + "/build/x86")
|
||||
base.copy_file(current_dir + "/build_tmp/x86/lib/libicudata.a", current_dir + "/build/x86/libicudata.a")
|
||||
base.copy_file(current_dir + "/build_tmp/x86/lib/libicuuc.a", current_dir + "/build/x86/libicuuc.a")
|
||||
base.copy_file(current_dir + "/icu/x86/data/out/icudt58l.dat", current_dir + "/build/x86/icudt58l.dat")
|
||||
|
||||
os.chdir(current_dir_old)
|
||||
return
|
||||
@ -29,6 +29,10 @@ def is_main_platform():
|
||||
return True
|
||||
if config.check_option("platform", "mac_64"):
|
||||
return True
|
||||
if config.check_option("platform", "ios"):
|
||||
return True
|
||||
if (-1 != config.option("platform").find("android")):
|
||||
return True
|
||||
return False
|
||||
|
||||
def is_xp_platform():
|
||||
@ -37,18 +41,10 @@ def is_xp_platform():
|
||||
return False
|
||||
|
||||
def is_use_clang():
|
||||
get_gcc_version = "gcc -dumpfullversion -dumpversion"
|
||||
popen = subprocess.Popen(get_gcc_version, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
gcc_version = 4
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
gcc_version_str = stdout.strip().decode("utf-8")
|
||||
gcc_version_major = gcc_version_str.split(".")[0]
|
||||
gcc_version = int(gcc_version_major)
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
gcc_version_str = base.run_command("gcc -dumpfullversion -dumpversion")['stdout']
|
||||
if (gcc_version_str != ""):
|
||||
gcc_version = int(gcc_version_str.split(".")[0])
|
||||
|
||||
is_clang = "false"
|
||||
if (gcc_version >= 6):
|
||||
@ -58,19 +54,22 @@ def is_use_clang():
|
||||
return is_clang
|
||||
|
||||
def make():
|
||||
if config.option("module") == "mobile":
|
||||
return
|
||||
|
||||
if not is_main_platform():
|
||||
make_xp()
|
||||
return
|
||||
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
|
||||
if ("ios" == config.option("platform")):
|
||||
return
|
||||
|
||||
print("[fetch & build]: v8")
|
||||
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)
|
||||
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
|
||||
old_cur = os.getcwd()
|
||||
os.chdir(base_dir)
|
||||
|
||||
@ -144,7 +143,8 @@ def make():
|
||||
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/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
|
||||
@ -182,9 +182,10 @@ def make():
|
||||
base.cmd("ninja", ["-C", "out.gn/win_32/release"])
|
||||
|
||||
os.chdir(old_cur)
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
|
||||
make_xp()
|
||||
|
||||
return
|
||||
|
||||
def make_xp():
|
||||
@ -192,6 +193,7 @@ def make_xp():
|
||||
return
|
||||
|
||||
print("[fetch & build]: v8_xp")
|
||||
old_env = dict(os.environ)
|
||||
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8/v8_xp"
|
||||
old_cur = os.getcwd()
|
||||
@ -213,7 +215,6 @@ def make_xp():
|
||||
if base.is_file("depot_tools/cipd.ps1"):
|
||||
base.replaceInFile("depot_tools/cipd.ps1", "windows-386", "windows-amd64")
|
||||
|
||||
old_path = os.environ["PATH"]
|
||||
os.environ["PATH"] = os.pathsep.join([base_dir + "/depot_tools",
|
||||
base_dir + "/depot_tools/win_tools-2_7_13_chromium7_bin/python/bin",
|
||||
config.option("vs-path") + "/../Common7/IDE",
|
||||
@ -276,6 +277,7 @@ def make_xp():
|
||||
base.copy_files("v8/build/Debug/lib/*", "win_32/debug/")
|
||||
base.copy_file("v8/build/Debug/icudt.dll", "win_32/debug/icudt.dll")
|
||||
|
||||
os.environ["PATH"] = old_path
|
||||
os.chdir(old_cur)
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
return
|
||||
|
||||
37
scripts/core_common/modules/v8_87.py
Normal file
37
scripts/core_common/modules/v8_87.py
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../..')
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8_87"
|
||||
if not base.is_dir(base_dir):
|
||||
base.create_dir(base_dir)
|
||||
|
||||
os.chdir(base_dir)
|
||||
if not base.is_dir("depot_tools"):
|
||||
base.cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
|
||||
|
||||
os.environ["PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]
|
||||
|
||||
if not base.is_dir("v8"):
|
||||
base.cmd("./depot_tools/fetch", ["v8"], True)
|
||||
base.cmd("./depot_tools/gclient", ["sync", "-r", "8.7.220.25"], True)
|
||||
base.cmd("gclient", ["sync", "--force"], True)
|
||||
|
||||
os.chdir("v8")
|
||||
|
||||
gn_args = ["target_cpu=\\\"x64\\\"",
|
||||
"v8_target_cpu=\\\"x64\\\"",
|
||||
"v8_static_library=true",
|
||||
"is_component_build=false",
|
||||
"v8_monolithic=true",
|
||||
"v8_use_external_startup_data=false",
|
||||
"use_custom_libcxx=false",
|
||||
"is_debug=false"]
|
||||
|
||||
base.cmd2("gn", ["gen", "out.gn/mac_64", "--args=\"" + " ".join(gn_args) + "\""])
|
||||
base.cmd("ninja", ["-C", "out.gn/mac_64"])
|
||||
@ -5,7 +5,6 @@ import base
|
||||
import deploy_desktop
|
||||
import deploy_builder
|
||||
import deploy_server
|
||||
import deploy_develop
|
||||
import deploy_core
|
||||
import deploy_mobile
|
||||
|
||||
@ -16,8 +15,6 @@ def make():
|
||||
deploy_builder.make()
|
||||
if config.check_option("module", "server"):
|
||||
deploy_server.make()
|
||||
if config.check_option("module", "develop"):
|
||||
deploy_develop.make()
|
||||
if config.check_option("module", "core"):
|
||||
deploy_core.make()
|
||||
if config.check_option("module", "mobile"):
|
||||
|
||||
@ -39,8 +39,10 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "DjVuFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlRenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "Fb2File")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "EpubFile")
|
||||
|
||||
if ("ios" == platform):
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "x2t")
|
||||
@ -79,15 +81,6 @@ def make():
|
||||
base.copy_dir(git_dir + "/DocumentBuilder/empty", root_dir + "/empty")
|
||||
base.copy_dir(git_dir + "/DocumentBuilder/samples", root_dir + "/samples")
|
||||
|
||||
# html
|
||||
base.create_dir(root_dir + "/HtmlFileInternal")
|
||||
if (False == isWindowsXP) and (0 != platform.find("mac")) and (0 != platform.find("ios")):
|
||||
base.copy_exe(core_build_dir + "/lib/" + platform_postfix, root_dir + "/HtmlFileInternal", "HtmlFileInternal")
|
||||
base.copy_files(core_dir + "/Common/3dParty/cef/" + platform + "/build/*", root_dir + "/HtmlFileInternal")
|
||||
if (0 == platform.find("win")):
|
||||
base.delete_file(root_dir + "/HtmlFileInternal/cef_sandbox.lib")
|
||||
base.delete_file(root_dir + "/HtmlFileInternal/libcef.lib")
|
||||
|
||||
# js
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", root_dir + "/sdkjs")
|
||||
base.create_dir(root_dir + "/sdkjs/vendor")
|
||||
|
||||
@ -33,8 +33,10 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "PdfWriter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "HtmlFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "Fb2File")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform, archive_dir, "EpubFile")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "x2t")
|
||||
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", archive_dir + "/sdkjs")
|
||||
@ -53,14 +55,6 @@ def make():
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "allthemesgen")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform, archive_dir, "standardtester")
|
||||
|
||||
base.create_dir(archive_dir + "/HtmlFileInternal")
|
||||
|
||||
base.copy_exe(core_build_dir + "/lib/" + platform, archive_dir + "/HtmlFileInternal", "HtmlFileInternal")
|
||||
base.copy_files(core_dir + "/Common/3dParty/cef/" + platform + "/build/*", archive_dir + "/HtmlFileInternal")
|
||||
if (0 == platform.find("win")):
|
||||
base.delete_file(archive_dir + "/HtmlFileInternal/cef_sandbox.lib")
|
||||
base.delete_file(archive_dir + "/HtmlFileInternal/libcef.lib")
|
||||
|
||||
if base.is_file(archive_dir + "/core.7z"):
|
||||
base.delete_file(archive_dir + "/core.7z")
|
||||
base.archive_folder(archive_dir, archive_dir + "/core.7z")
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
|
||||
def make():
|
||||
base_dir = base.get_script_dir() + "/../out"
|
||||
@ -48,8 +49,10 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "DjVuFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "HtmlFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "HtmlRenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "Fb2File")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "EpubFile")
|
||||
|
||||
if ("ios" == platform):
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "x2t")
|
||||
@ -83,9 +86,6 @@ def make():
|
||||
base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop")
|
||||
base.copy_dir(git_dir + "/desktop-apps/common/converter/empty", root_dir + "/converter/empty")
|
||||
|
||||
if (False == isWindowsXP) and (0 != platform.find("mac")) and (0 != platform.find("ios")):
|
||||
base.copy_exe(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlFileInternal")
|
||||
|
||||
# dictionaries
|
||||
base.create_dir(root_dir + "/dictionaries")
|
||||
base.copy_dir_content(git_dir + "/dictionaries", root_dir + "/dictionaries", "", ".git")
|
||||
@ -183,7 +183,17 @@ def make():
|
||||
base.copy_sdkjs_plugin(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins", root_dir + "/editors/sdkjs-plugins", "sendto", True)
|
||||
|
||||
base.copy_file(base_dir + "/js/" + branding + "/desktop/index.html", root_dir + "/index.html")
|
||||
base.copy_file(git_dir + "/desktop-apps/common/loginpage/addon/externalcloud.json", root_dir + "/editors/externalcloud.json")
|
||||
base.copy_dir(git_dir + "/desktop-apps/common/loginpage/providers", root_dir + "/providers")
|
||||
|
||||
isUseJSC = False
|
||||
if (0 == platform.find("mac")):
|
||||
file_size_doctrenderer = os.path.getsize(root_dir + "/converter/libdoctrenderer.dylib")
|
||||
print("file_size_doctrenderer: " + str(file_size_doctrenderer))
|
||||
if (file_size_doctrenderer < 5*1024*1024):
|
||||
isUseJSC = True
|
||||
|
||||
if isUseJSC:
|
||||
base.delete_file(root_dir + "/converter/icudtl.dat")
|
||||
|
||||
if (0 == platform.find("win")):
|
||||
base.copy_lib(git_dir + "/desktop-apps/win-linux/3dparty/WinSparkle/" + platform, root_dir, "WinSparkle")
|
||||
@ -207,7 +217,9 @@ def make():
|
||||
base.delete_exe(root_dir + "/converter/allthemesgen")
|
||||
base.delete_file(root_dir + "/converter/AllFonts.js")
|
||||
base.delete_file(root_dir + "/converter/font_selection.bin")
|
||||
base.delete_file(root_dir + "/editors/sdkjs/slide/sdk-all.cache")
|
||||
|
||||
if not isUseJSC:
|
||||
base.delete_file(root_dir + "/editors/sdkjs/slide/sdk-all.cache")
|
||||
|
||||
return
|
||||
|
||||
|
||||
@ -40,9 +40,11 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "DjVuFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "HtmlRenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "doctrenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "Fb2File")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "EpubFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "x2t")
|
||||
|
||||
# icu
|
||||
@ -58,6 +60,11 @@ def make():
|
||||
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.58.dylib", root_dir + "/libicudata.58.dylib")
|
||||
base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.58.dylib", root_dir + "/libicuuc.58.dylib")
|
||||
|
||||
if (0 == platform.find("android")):
|
||||
#base.copy_file(core_dir + "/Common/3dParty/icu/android/build/" + platform[8:] + "/libicudata.so", root_dir + "/libicudata.so")
|
||||
#base.copy_file(core_dir + "/Common/3dParty/icu/android/build/" + platform[8:] + "/libicuuc.so", root_dir + "/libicuuc.so")
|
||||
base.copy_file(core_dir + "/Common/3dParty/icu/android/build/" + platform[8:] + "/icudt58l.dat", root_dir + "/icudt58l.dat")
|
||||
|
||||
# js
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/mobile/sdkjs", root_dir + "/sdkjs")
|
||||
|
||||
@ -78,17 +85,24 @@ def make():
|
||||
# js
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/mobile/sdkjs", root_dir + "/sdkjs")
|
||||
# app
|
||||
base.generate_doctrenderer_config(root_dir + "/DoctRenderer.config", "./", "builder")
|
||||
base.copy_dir(git_dir + "/DocumentBuilder/empty", root_dir + "/empty")
|
||||
base.generate_doctrenderer_config(root_dir + "/DoctRenderer.config", "./", "builder")
|
||||
libs_dir = root_dir + "/lib"
|
||||
base.create_dir(libs_dir + "/arm64-v8a")
|
||||
base.copy_files(base_dir + "/android_arm64_v8a/" + branding + "/mobile/*.so", libs_dir + "/arm64-v8a")
|
||||
base.copy_files(base_dir + "/android_arm64_v8a/" + branding + "/mobile/*.so.*", libs_dir + "/arm64-v8a")
|
||||
base.copy_files(base_dir + "/android_arm64_v8a/" + branding + "/mobile/*.dat", libs_dir + "/arm64-v8a")
|
||||
base.create_dir(libs_dir + "/armeabi-v7a")
|
||||
base.copy_files(base_dir + "/android_armv7/" + branding + "/mobile/*.so", libs_dir + "/armeabi-v7a")
|
||||
base.copy_files(base_dir + "/android_armv7/" + branding + "/mobile/*.so.*", libs_dir + "/armeabi-v7a")
|
||||
base.copy_files(base_dir + "/android_armv7/" + branding + "/mobile/*.dat", libs_dir + "/armeabi-v7a")
|
||||
base.create_dir(libs_dir + "/x86")
|
||||
base.copy_files(base_dir + "/android_x86/" + branding + "/mobile/*.so", libs_dir + "/x86")
|
||||
base.copy_files(base_dir + "/android_x86/" + branding + "/mobile/*.so.*", libs_dir + "/x86")
|
||||
base.copy_files(base_dir + "/android_x86/" + branding + "/mobile/*.dat", libs_dir + "/x86")
|
||||
base.create_dir(libs_dir + "/x86_64")
|
||||
base.copy_files(base_dir + "/android_x86_64/" + branding + "/mobile/*.so", libs_dir + "/x86_64")
|
||||
base.copy_files(base_dir + "/android_x86_64/" + branding + "/mobile/*.so.*", libs_dir + "/x86_64")
|
||||
base.copy_files(base_dir + "/android_x86_64/" + branding + "/mobile/*.dat", libs_dir + "/x86_64")
|
||||
break
|
||||
|
||||
return
|
||||
|
||||
@ -60,7 +60,7 @@ def make():
|
||||
base.create_dir(build_server_dir + '/SpellChecker')
|
||||
base.copy_exe(bin_server_dir + "/SpellChecker", build_server_dir + '/SpellChecker', "spellchecker")
|
||||
base.create_dir(build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release')
|
||||
base.copy_file(bin_server_dir + "/SpellChecker/node_modules/nodehun/build/Release/nodehun.node", build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release/nodehun.node')
|
||||
base.copy_file(bin_server_dir + "/SpellChecker/node_modules/nodehun/build/Release/Nodehun.node", build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release/Nodehun.node')
|
||||
|
||||
|
||||
qt_dir = base.qt_setup(native_platform)
|
||||
@ -82,9 +82,11 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "DjVuFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlRenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "doctrenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "Fb2File")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "EpubFile")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "x2t")
|
||||
|
||||
base.generate_doctrenderer_config(converter_dir + "/DoctRenderer.config", "../../../", "server")
|
||||
@ -111,14 +113,6 @@ def make():
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "docbuilder")
|
||||
base.copy_dir(git_dir + "/DocumentBuilder/empty", converter_dir + "/empty")
|
||||
|
||||
# html
|
||||
base.create_dir(converter_dir + "/HtmlFileInternal")
|
||||
base.copy_exe(core_build_dir + "/lib/" + platform_postfix, converter_dir + "/HtmlFileInternal", "HtmlFileInternal")
|
||||
base.copy_files(core_dir + "/Common/3dParty/cef/" + platform + "/build/*", converter_dir + "/HtmlFileInternal")
|
||||
if (0 == platform.find("win")):
|
||||
base.delete_file(root_dir + "/HtmlFileInternal/cef_sandbox.lib")
|
||||
base.delete_file(root_dir + "/HtmlFileInternal/libcef.lib")
|
||||
|
||||
# js
|
||||
js_dir = root_dir
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs")
|
||||
@ -126,8 +120,12 @@ def make():
|
||||
|
||||
# plugins
|
||||
base.create_dir(js_dir + "/sdkjs-plugins")
|
||||
base.copy_sdkjs_plugins(js_dir + "/sdkjs-plugins")
|
||||
base.copy_sdkjs_plugins_server(js_dir + "/sdkjs-plugins")
|
||||
base.copy_sdkjs_plugins(js_dir + "/sdkjs-plugins", False, True)
|
||||
base.copy_sdkjs_plugins_server(js_dir + "/sdkjs-plugins", False, True)
|
||||
base.create_dir(js_dir + "/sdkjs-plugins/v1")
|
||||
base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js", js_dir + "/sdkjs-plugins/v1/plugins.js")
|
||||
base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js", js_dir + "/sdkjs-plugins/v1/plugins-ui.js")
|
||||
base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css", js_dir + "/sdkjs-plugins/v1/plugins.css")
|
||||
base.support_old_versions_plugins(js_dir + "/sdkjs-plugins")
|
||||
|
||||
# tools
|
||||
@ -207,6 +205,8 @@ def make():
|
||||
base.delete_file(root_dir_snap + '/server/SpellChecker/spellchecker')
|
||||
base.copy_dir(bin_server_dir + '/Common/node_modules', root_dir_snap + '/server/Common/node_modules')
|
||||
base.copy_dir(bin_server_dir + '/Common/sources', root_dir_snap + '/server/Common/sources')
|
||||
base.copy_dir(bin_example_dir + '/..', root_dir_snap + '/example')
|
||||
base.delete_file(root_dir_snap + '/example/nodejs/example')
|
||||
|
||||
return
|
||||
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
import json
|
||||
|
||||
def get_core_url(arch, branch):
|
||||
return "http://repo-doc-onlyoffice-com.s3.amazonaws.com/" + base.host_platform() + "/core/" + branch + "/latest/" + arch + "/core.7z"
|
||||
|
||||
def make():
|
||||
git_dir = base.get_script_dir() + "/../.."
|
||||
@ -20,11 +24,15 @@ def make():
|
||||
arch = "x86"
|
||||
arch2 = "_32"
|
||||
|
||||
url = "http://repo-doc-onlyoffice-com.s3.amazonaws.com/" + base.host_platform() + "/core/" + config.option("branch") + "/latest/" + arch + "/core.7z"
|
||||
url = get_core_url(arch, config.option("branch"))
|
||||
data_url = base.get_file_last_modified_url(url)
|
||||
if (data_url == "" and config.option("branch") != "develop"):
|
||||
url = get_core_url(arch, "develop")
|
||||
data_url = base.get_file_last_modified_url(url)
|
||||
|
||||
old_data_url = base.readFile("./core.7z.data")
|
||||
|
||||
if (old_data_url != data_url):
|
||||
if (data_url != "" and old_data_url != data_url):
|
||||
print("-----------------------------------------------------------")
|
||||
print("Downloading core last version... --------------------------")
|
||||
print("-----------------------------------------------------------")
|
||||
@ -32,8 +40,6 @@ def make():
|
||||
base.delete_file("./core.7z")
|
||||
if (base.is_dir("./core")):
|
||||
base.delete_dir("./core")
|
||||
if (base.is_dir("./HtmlFileInternal")):
|
||||
base.delete_dir("./HtmlFileInternal")
|
||||
base.download(url, "./core.7z")
|
||||
|
||||
print("-----------------------------------------------------------")
|
||||
@ -50,6 +56,10 @@ def make():
|
||||
platform = base.host_platform() + arch2
|
||||
|
||||
base.copy_files("./core/*", "./")
|
||||
else:
|
||||
print("-----------------------------------------------------------")
|
||||
print("Core is up to date. ---------------------------------------")
|
||||
print("-----------------------------------------------------------")
|
||||
|
||||
base.generate_doctrenderer_config("./DoctRenderer.config", "../../../sdkjs/deploy/", "server", "../../../web-apps/vendor/")
|
||||
base.support_old_versions_plugins(git_dir + "/sdkjs-plugins")
|
||||
@ -79,27 +89,47 @@ def make():
|
||||
#base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=android", "--params=280,224"])
|
||||
|
||||
# add directories to open directories
|
||||
data_local_devel = "{\n"
|
||||
data_local_devel += "\"services\": {\n"
|
||||
data_local_devel += "\"CoAuthoring\": {\n"
|
||||
data_local_devel += "\"server\": {\n"
|
||||
data_local_devel += "\"static_content\": {\n"
|
||||
is_exist_addons = False
|
||||
for addon in config.sdkjs_addons:
|
||||
data_local_devel += ("\"/" + config.sdkjs_addons[addon] + "\" : { \"path\": \"../../../" + config.sdkjs_addons[addon] + "\" },\n")
|
||||
is_exist_addons = True
|
||||
for addon in config.web_apps_addons:
|
||||
data_local_devel += ("\"/" + config.web_apps_addons[addon] + "\" : { \"path\": \"../../../" + config.web_apps_addons[addon] + "\" },\n")
|
||||
is_exist_addons = True
|
||||
if is_exist_addons:
|
||||
data_local_devel = data_local_devel[:-2]
|
||||
data_local_devel += "\n"
|
||||
data_local_devel += "}\n"
|
||||
data_local_devel += "}\n"
|
||||
data_local_devel += "}\n"
|
||||
data_local_devel += "}\n"
|
||||
data_local_devel += "}\n"
|
||||
base.writeFile(git_dir + "/server/Common/config/local-development-" + base.host_platform() + ".json", data_local_devel)
|
||||
addon_base_path = "../../../"
|
||||
server_config = {}
|
||||
static_content = {}
|
||||
sql = {}
|
||||
|
||||
server_addons = []
|
||||
if (config.option("server-addons") != ""):
|
||||
server_addons = config.option("server-addons").rsplit(", ")
|
||||
if ("server-lockstorage" in server_addons):
|
||||
server_config["editorDataStorage"] = "editorDataRedis"
|
||||
|
||||
sdkjs_addons = []
|
||||
if (config.option("sdkjs-addons") != ""):
|
||||
sdkjs_addons = config.option("sdkjs-addons").rsplit(", ")
|
||||
for addon in sdkjs_addons:
|
||||
static_content["/" + addon] = {"path": addon_base_path + addon}
|
||||
|
||||
web_apps_addons = []
|
||||
if (config.option("web-apps-addons") != ""):
|
||||
web_apps_addons = config.option("web-apps-addons").rsplit(", ")
|
||||
for addon in web_apps_addons:
|
||||
static_content["/" + addon] = {"path": addon_base_path + addon}
|
||||
|
||||
if (config.option("external-folder") != ""):
|
||||
external_folder = config.option("external-folder")
|
||||
static_content["/sdkjs"] = {"path": addon_base_path + external_folder + "/sdkjs"}
|
||||
static_content["/web-apps"] = {"path": addon_base_path + external_folder + "/web-apps"}
|
||||
|
||||
if (config.option("sql-type") != ""):
|
||||
sql["type"] = config.option("sql-type")
|
||||
if (config.option("db-port") != ""):
|
||||
sql["dbPort"] = config.option("db-port")
|
||||
if (config.option("db-user") != ""):
|
||||
sql["dbUser"] = config.option("db-user")
|
||||
if (config.option("db-pass") != ""):
|
||||
sql["dbPass"] = config.option("db-pass")
|
||||
|
||||
server_config["static_content"] = static_content
|
||||
|
||||
json_file = git_dir + "/server/Common/config/local-development-" + base.host_platform() + ".json"
|
||||
base.writeFile(json_file, json.dumps({"services": {"CoAuthoring": {"server": server_config, "sql": sql}}}, indent=2))
|
||||
|
||||
os.chdir(old_cur)
|
||||
return
|
||||
893
scripts/develop/dependence.py
Normal file
893
scripts/develop/dependence.py
Normal file
@ -0,0 +1,893 @@
|
||||
import sys
|
||||
sys.path.append('vendor')
|
||||
sys.path.append('..')
|
||||
import os
|
||||
import base
|
||||
import subprocess
|
||||
import config
|
||||
|
||||
host_platform = base.host_platform()
|
||||
|
||||
if (sys.version_info[0] >= 3):
|
||||
unicode = str
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
import libwindows
|
||||
if (sys.version_info[0] >= 3):
|
||||
import winreg
|
||||
else:
|
||||
import _winreg as winreg
|
||||
|
||||
class CDependencies:
|
||||
def __init__(self):
|
||||
self.install = []
|
||||
self.uninstall = []
|
||||
self.removepath = []
|
||||
self.sqlPath = ''
|
||||
|
||||
def append(self, oCdependencies):
|
||||
for item in oCdependencies.install:
|
||||
self.append_install(item)
|
||||
for item in oCdependencies.uninstall:
|
||||
self.append_uninstall(item)
|
||||
for item in oCdependencies.removepath:
|
||||
self.append_removepath(item)
|
||||
|
||||
if (oCdependencies.sqlPath != ''):
|
||||
self.sqlPath = oCdependencies.sqlPath
|
||||
|
||||
def append_install(self, item):
|
||||
if (item not in self.install):
|
||||
self.install.append(item)
|
||||
|
||||
def append_uninstall(self, item):
|
||||
if (item not in self.uninstall):
|
||||
self.uninstall.append(item)
|
||||
|
||||
def append_removepath(self, item):
|
||||
if (item not in self.removepath):
|
||||
self.removepath.append(item)
|
||||
|
||||
def get_install(self):
|
||||
res = []
|
||||
for item in self.install:
|
||||
res += ['--install', item]
|
||||
return res
|
||||
|
||||
def get_uninstall(self):
|
||||
res = []
|
||||
for item in self.uninstall:
|
||||
res += ['--uninstall', item]
|
||||
return res
|
||||
|
||||
def get_removepath(self):
|
||||
res = []
|
||||
for item in self.removepath:
|
||||
res += ['--remove-path', item]
|
||||
return res
|
||||
|
||||
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)
|
||||
|
||||
def check_pythonPath():
|
||||
path = base.get_env('PATH')
|
||||
if (path.find(sys.exec_prefix) == -1):
|
||||
base.set_env('PATH', sys.exec_prefix + os.pathsep + path)
|
||||
|
||||
def check_npmPath():
|
||||
if (host_platform != 'windows'):
|
||||
return None
|
||||
path = base.get_env('PATH')
|
||||
npmPath = os.environ['AppData'] + '\\npm'
|
||||
if (path.find(npmPath) == -1):
|
||||
base.set_env('PATH', npmPath + os.pathsep + path)
|
||||
|
||||
def check_gitPath():
|
||||
path = base.get_env('PATH')
|
||||
gitExecPath = base.find_file(os.path.join(os.environ['PROGRAMW6432'], 'Git\\cmd'), 'git.exe') or base.find_file(os.path.join(os.environ['ProgramFiles(x86)'], 'Git\\cmd'), 'git.exe')
|
||||
gitDir = base.get_script_dir(gitExecPath)
|
||||
if (path.find(gitDir) == -1):
|
||||
base.set_env('PATH', gitDir + os.pathsep + path)
|
||||
|
||||
def check_git():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed Git')
|
||||
|
||||
result = base.run_command('git --version')['stderr']
|
||||
|
||||
if (result != ''):
|
||||
print('Git not found')
|
||||
dependence.append_install('Git')
|
||||
return dependence
|
||||
|
||||
print('Git is installed')
|
||||
return dependence
|
||||
|
||||
def check_nodejs():
|
||||
dependence = CDependencies()
|
||||
|
||||
base.print_info('Check installed Node.js')
|
||||
nodejs_version = base.run_command('node -v')['stdout']
|
||||
if (nodejs_version == ''):
|
||||
print('Node.js not found')
|
||||
dependence.append_install('Node.js')
|
||||
return dependence
|
||||
|
||||
nodejs_cur_version = int(nodejs_version.split('.')[0][1:])
|
||||
print('Installed Node.js version: ' + str(nodejs_cur_version))
|
||||
nodejs_min_version = 8
|
||||
nodejs_max_version = 14
|
||||
if (nodejs_min_version > nodejs_cur_version or nodejs_cur_version > nodejs_max_version):
|
||||
print('Installed Node.js version must be 8.x to 14.x')
|
||||
if (host_platform == 'windows'):
|
||||
dependence.append_uninstall('Node.js')
|
||||
elif (host_platform == 'linux'):
|
||||
dependence.append_uninstall('nodejs')
|
||||
dependence.append_install('Node.js')
|
||||
return dependence
|
||||
|
||||
print('Installed Node.js is valid')
|
||||
return dependence
|
||||
|
||||
def check_java():
|
||||
dependence = CDependencies()
|
||||
|
||||
base.print_info('Check installed Java')
|
||||
java_version = base.run_command('java -version')['stderr']
|
||||
|
||||
if (java_version.find('64-Bit') != -1):
|
||||
print('Installed Java is valid')
|
||||
return dependence
|
||||
|
||||
if (java_version.find('32-Bit') != -1):
|
||||
print('Installed Java must be x64')
|
||||
else:
|
||||
print('Java not found')
|
||||
|
||||
dependence.append_install('Java')
|
||||
return dependence
|
||||
|
||||
def get_erlang_path_to_bin():
|
||||
erlangPath = ''
|
||||
if (host_platform == 'windows'):
|
||||
erlangPath = os.getenv("ERLANG_HOME")
|
||||
if (erlangPath is not None):
|
||||
erlangPath += '\\bin'
|
||||
return erlangPath
|
||||
def check_erlang():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed Erlang')
|
||||
|
||||
erlangBitness = base.run_command_in_dir(get_erlang_path_to_bin(), 'erl -eval "erlang:display(erlang:system_info(wordsize)), halt()." -noshell')['stdout']
|
||||
|
||||
if (erlangBitness == '8'):
|
||||
print("Installed Erlang is valid")
|
||||
return dependence
|
||||
|
||||
print('Need Erlang with bitness x64')
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
dependence.append_removepath(os.environ['AppData'] + '\\RabbitMQ\\db')
|
||||
dependence.append_uninstall('Erlang')
|
||||
dependence.append_uninstall('RabbitMQ')
|
||||
else:
|
||||
dependence.append_uninstall('erlang')
|
||||
dependence.append_uninstall('rabbitmq-server')
|
||||
dependence.append_install('Erlang')
|
||||
dependence.append_install('RabbitMQ')
|
||||
|
||||
return dependence
|
||||
|
||||
def check_rabbitmq():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed RabbitMQ')
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
result = base.run_command('sc query RabbitMQ')['stdout']
|
||||
if (result.find('RabbitMQ') != -1):
|
||||
print('RabbitMQ is installed')
|
||||
return dependence
|
||||
elif (host_platform == 'linux'):
|
||||
result = base.run_command('service rabbitmq-server status')['stdout']
|
||||
if (result != ''):
|
||||
print('Installed RabbitMQ is valid')
|
||||
return dependence
|
||||
|
||||
print('RabbitMQ not found')
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
dependence.append_removepath(os.environ['AppData'] + '\\RabbitMQ\\db')
|
||||
dependence.append_uninstall('Erlang')
|
||||
dependence.append_uninstall('RabbitMQ')
|
||||
else:
|
||||
dependence.append_uninstall('erlang')
|
||||
dependence.append_uninstall('rabbitmq-server')
|
||||
dependence.append_install('Erlang')
|
||||
dependence.append_install('RabbitMQ')
|
||||
|
||||
return dependence
|
||||
|
||||
def find_redis(base_path):
|
||||
return base.find_file(os.path.join(base_path, 'Redis'), 'redis-cli.exe')
|
||||
|
||||
def check_redis():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check Redis server')
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
if (len(get_programUninstalls('Redis on Windows')) == 0):
|
||||
print('Redis not found')
|
||||
dependence.append_install('RedisServer')
|
||||
return dependence
|
||||
|
||||
checkService = base.run_command('sc query Redis')['stdout']
|
||||
if (checkService.find('Redis') != -1) and (checkService.find('STOPPED') != -1):
|
||||
print('Installed Redis is not valid')
|
||||
dependence.append_uninstall('Redis on Windows')
|
||||
dependence.append_install('RedisServer')
|
||||
return dependence
|
||||
|
||||
redis_cli = find_redis(os.environ['PROGRAMW6432']) or find_redis(os.environ['ProgramFiles(x86)'])
|
||||
elif (host_platform == 'linux'):
|
||||
checkService = base.run_command('service redis-server status')['stderr']
|
||||
if (checkService == ''):
|
||||
print('Redis not found')
|
||||
dependence.append_install('Redis')
|
||||
return dependence
|
||||
redis_cli = 'redis-cli'
|
||||
|
||||
if (redis_cli == None):
|
||||
print('Redis not found in default folder')
|
||||
dependence.append_uninstall('Redis on Windows')
|
||||
dependence.append_install('RedisServer')
|
||||
return dependence
|
||||
|
||||
result = base.run_command('"' + redis_cli + '"' + ' info server')['stdout']
|
||||
if (result == ''):
|
||||
print('Redis client is invalid')
|
||||
if (host_platform == 'windows'):
|
||||
dependence.append_uninstall('Redis on Windows')
|
||||
dependence.append_install('RedisServer')
|
||||
else:
|
||||
dependence.append_uninstall('redis-server')
|
||||
dependence.append_install('Redis')
|
||||
return dependence
|
||||
|
||||
info = result.split('tcp_port:')[1]
|
||||
tcp_port = info.split('\r', 1)[0]
|
||||
config_port = install_params['Redis'].split('PORT=', 1)[1]
|
||||
config_port = config_port.split(' ', 1)[0]
|
||||
if (tcp_port != config_port):
|
||||
print('Invalid Redis port, need reinstall')
|
||||
if (host_platform == 'windows'):
|
||||
dependence.append_uninstall('Redis on Windows')
|
||||
dependence.append_install('RedisServer')
|
||||
else:
|
||||
dependence.append_uninstall('redis-server')
|
||||
dependence.append_install('Redis')
|
||||
return dependence
|
||||
|
||||
print('Installed Redis is valid')
|
||||
return dependence
|
||||
|
||||
def check_npm():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed Npm')
|
||||
|
||||
result = base.run_command('npm')['stdout']
|
||||
if (result != ''):
|
||||
print('Npm is installed')
|
||||
return dependence
|
||||
|
||||
print('Npm not found')
|
||||
dependence.append_install('Npm')
|
||||
|
||||
return dependence
|
||||
|
||||
def check_vc_components():
|
||||
base.print_info('Check Visual C++ components')
|
||||
result = True
|
||||
if (len(get_programUninstalls('Microsoft Visual C++ 2015-2019 Redistributable (x64)')) == 0):
|
||||
print('Microsoft Visual C++ 2015-2019 Redistributable (x64) not found')
|
||||
result = installProgram('VC2019x64') and result
|
||||
|
||||
print('Installed Visual C++ components is valid')
|
||||
return result
|
||||
|
||||
def check_gruntcli():
|
||||
dependence = CDependencies()
|
||||
|
||||
base.print_info('Check installed Grunt-Cli')
|
||||
result = base.run_command('npm list -g --depth=0')['stdout']
|
||||
|
||||
if (result.find('grunt-cli') == -1):
|
||||
print('Grunt-Cli not found')
|
||||
dependence.append_install('GruntCli')
|
||||
return dependence
|
||||
|
||||
print('Installed Grunt-Cli is valid')
|
||||
return dependence
|
||||
|
||||
def check_buildTools():
|
||||
dependence = CDependencies()
|
||||
|
||||
base.print_info('Check installed Build Tools')
|
||||
result = base.run_command('vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property DisplayName')['stdout']
|
||||
if (result == ''):
|
||||
print('Build Tools not found')
|
||||
dependence.append_install('BuildTools')
|
||||
else:
|
||||
print('Installed Build Tools is valid')
|
||||
|
||||
return dependence
|
||||
|
||||
def check_curl():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed Curl')
|
||||
|
||||
if (base.run_command('curl -V')['stdout'] == ''):
|
||||
dependence.append_install('Curl')
|
||||
|
||||
return dependence
|
||||
|
||||
def check_7z():
|
||||
dependence = CDependencies()
|
||||
base.print_info('Check installed 7z')
|
||||
|
||||
if (base.run_command('7z')['stdout'] == ''):
|
||||
dependence.append_install('7z')
|
||||
|
||||
return dependence
|
||||
|
||||
def get_mysql_path_to_bin(mysqlPath = ''):
|
||||
if (host_platform == 'windows'):
|
||||
if (mysqlPath == ''):
|
||||
mysqlPath = os.environ['PROGRAMW6432'] + '\\MySQL\\MySQL Server 8.0\\'
|
||||
mysqlPath += 'bin'
|
||||
return mysqlPath
|
||||
def get_mysqlLoginSrting():
|
||||
return 'mysql -u ' + install_params['MySQLServer']['user'] + ' -p' + install_params['MySQLServer']['pass']
|
||||
def get_mysqlServersInfo():
|
||||
arrInfo = []
|
||||
|
||||
try:
|
||||
aReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
||||
aKey = winreg.OpenKey(aReg, "SOFTWARE\\", 0, winreg.KEY_READ | winreg.KEY_WOW64_32KEY)
|
||||
|
||||
asubkey = winreg.OpenKey(aKey, 'MySQL AB')
|
||||
count_subkey = winreg.QueryInfoKey(asubkey)[0]
|
||||
|
||||
for i in range(count_subkey):
|
||||
MySQLsubkey_name = winreg.EnumKey(asubkey, i)
|
||||
if (MySQLsubkey_name.find('MySQL Server') != - 1):
|
||||
MySQLsubkey = winreg.OpenKey(asubkey, MySQLsubkey_name)
|
||||
dictInfo = {}
|
||||
dictInfo['Location'] = winreg.QueryValueEx(MySQLsubkey, 'Location')[0]
|
||||
dictInfo['Version'] = winreg.QueryValueEx(MySQLsubkey, 'Version')[0]
|
||||
dictInfo['DataLocation'] = winreg.QueryValueEx(MySQLsubkey, 'DataLocation')[0]
|
||||
arrInfo.append(dictInfo)
|
||||
except:
|
||||
pass
|
||||
|
||||
return arrInfo
|
||||
def check_mysqlServer():
|
||||
base.print_info('Check MySQL Server')
|
||||
dependence = CDependencies()
|
||||
mysqlLoginSrt = get_mysqlLoginSrting()
|
||||
connectionString = mysqlLoginSrt + ' -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"'
|
||||
|
||||
if (host_platform != 'windows'):
|
||||
result = os.system(mysqlLoginSrt + ' -e "exit"')
|
||||
if (result == 0):
|
||||
connectionResult = base.run_command(connectionString)['stdout']
|
||||
if (connectionResult.find('port') != -1 and connectionResult.find(install_params['MySQLServer']['port']) != -1):
|
||||
print('MySQL configuration is valid')
|
||||
dependence.sqlPath = 'mysql'
|
||||
return dependence
|
||||
print('Valid MySQL Server not found')
|
||||
dependence.append_install('MySQLServer')
|
||||
dependence.append_uninstall('mysql-server')
|
||||
return dependence
|
||||
|
||||
arrInfo = get_mysqlServersInfo()
|
||||
for info in arrInfo:
|
||||
if (base.is_dir(info['Location']) == False):
|
||||
continue
|
||||
|
||||
mysql_full_name = 'MySQL Server ' + info['Version'] + ' '
|
||||
|
||||
connectionResult = base.run_command_in_dir(get_mysql_path_to_bin(info['Location']), connectionString)['stdout']
|
||||
if (connectionResult.find('port') != -1 and connectionResult.find(install_params['MySQLServer']['port']) != -1):
|
||||
print(mysql_full_name + 'configuration is valid')
|
||||
dependence.sqlPath = info['Location']
|
||||
return dependence
|
||||
print(mysql_full_name + 'configuration is not valid')
|
||||
|
||||
print('Valid MySQL Server not found')
|
||||
dependence.append_uninstall('MySQL Server')
|
||||
dependence.append_install('MySQLServer')
|
||||
|
||||
MySQLData = os.environ['ProgramData'] + '\\MySQL\\'
|
||||
dir = os.listdir(MySQLData)
|
||||
for path in dir:
|
||||
if (path.find('MySQL Server') != -1) and (base.is_file(MySQLData + path) == False):
|
||||
dependence.append_removepath(MySQLData + path)
|
||||
|
||||
return dependence
|
||||
def check_MySQLConfig(mysqlPath = ''):
|
||||
result = True
|
||||
mysqlLoginSrt = get_mysqlLoginSrting()
|
||||
mysql_path_to_bin = get_mysql_path_to_bin(mysqlPath)
|
||||
|
||||
if (base.run_command_in_dir(mysql_path_to_bin, mysqlLoginSrt + ' -e "SHOW DATABASES;"')['stdout'].find('onlyoffice') == -1):
|
||||
print('Database onlyoffice not found')
|
||||
creatdb_path = base.get_script_dir() + "/../../server/schema/mysql/createdb.sql"
|
||||
result = execMySQLScript(mysqlPath, creatdb_path)
|
||||
if (base.run_command_in_dir(mysql_path_to_bin, mysqlLoginSrt + ' -e "SELECT plugin from mysql.user where User=' + "'" + install_params['MySQLServer']['user'] + "';" + '"')['stdout'].find('mysql_native_password') == -1):
|
||||
print('Password encryption is not valid')
|
||||
result = set_MySQLEncrypt(mysqlPath, 'mysql_native_password') and result
|
||||
|
||||
return result
|
||||
def execMySQLScript(mysqlPath, scriptPath):
|
||||
#ToDo check path to mysql
|
||||
print('Execution ' + scriptPath)
|
||||
|
||||
code = subprocess.call(get_mysqlLoginSrting() + ' < "' + scriptPath + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
if (code != 0):
|
||||
print('Execution failed!')
|
||||
return False
|
||||
print('Execution completed')
|
||||
return True
|
||||
def set_MySQLEncrypt(mysqlPath, sEncrypt):
|
||||
#ToDo check path to mysql
|
||||
print('Setting MySQL password encrypting...')
|
||||
|
||||
code = subprocess.call(get_mysqlLoginSrting() + ' -e "' + "ALTER USER '" + install_params['MySQLServer']['user'] + "'@'localhost' IDENTIFIED WITH " + sEncrypt + " BY '" + install_params['MySQLServer']['pass'] + "';" + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
if (code != 0):
|
||||
print('Setting password encryption failed!')
|
||||
return False
|
||||
|
||||
print('Setting password encryption completed')
|
||||
return True
|
||||
def uninstall_mysqlserver():
|
||||
code = os.system('yes | sudo systemctl stop mysqld')
|
||||
code = os.system('sudo apt-get remove --purge mysql* -y') and code
|
||||
code = os.system('sudo rm -Rf /var/lib/mysql/') and code
|
||||
code = os.system('sudo rm -Rf /etc/mysql/') and code
|
||||
code = os.system('sudo rm -rf /var/log/mysql') and code
|
||||
code = os.system('sudo deluser --remove-home mysql') and code
|
||||
code = os.system('sudo delgroup mysql') and code
|
||||
|
||||
return code
|
||||
|
||||
def get_postrgre_path_to_bin(postgrePath = ''):
|
||||
if (host_platform == 'windows'):
|
||||
if (postgrePath == ''):
|
||||
postgrePath = os.environ['PROGRAMW6432'] + '\\PostgreSQL\\13\\'
|
||||
postgrePath += 'bin'
|
||||
return postgrePath
|
||||
def get_postgreLoginSrting(userName):
|
||||
if (host_platform == 'windows'):
|
||||
return 'psql -U' + userName + ' '
|
||||
return 'PGPASSWORD="' + install_params['PostgreSQL']['dbPass'] + '" psql -U' + userName + ' -hlocalhost '
|
||||
def get_postgreSQLInfoByFlag(flag):
|
||||
arrInfo = []
|
||||
|
||||
try:
|
||||
aReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
||||
aKey = winreg.OpenKey(aReg, "SOFTWARE\\PostgreSQL\\Installations", 0, winreg.KEY_READ | flag)
|
||||
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
|
||||
for i in range(count_subkey):
|
||||
PostgreSQLsubkey_name = winreg.EnumKey(aKey, i)
|
||||
PostgreSQLsubkey = winreg.OpenKey(aKey, PostgreSQLsubkey_name)
|
||||
dictInfo = {}
|
||||
dictInfo['Location'] = winreg.QueryValueEx(PostgreSQLsubkey, 'Base Directory')[0]
|
||||
dictInfo['Version'] = winreg.QueryValueEx(PostgreSQLsubkey, 'CLT_Version')[0]
|
||||
dictInfo['DataLocation'] = winreg.QueryValueEx(PostgreSQLsubkey, 'Data Directory')[0]
|
||||
arrInfo.append(dictInfo)
|
||||
except:
|
||||
pass
|
||||
|
||||
return arrInfo
|
||||
def get_postgreSQLInfo():
|
||||
return get_postgreSQLInfoByFlag(winreg.KEY_WOW64_32KEY) + get_postgreSQLInfoByFlag(winreg.KEY_WOW64_64KEY)
|
||||
def check_postgreSQL():
|
||||
base.print_info('Check PostgreSQL')
|
||||
|
||||
dependence = CDependencies()
|
||||
|
||||
postgreLoginSrt = get_postgreLoginSrting(install_params['PostgreSQL']['root'])
|
||||
connectionString = postgreLoginSrt + ' -c "SELECT setting FROM pg_settings WHERE name = ' + "'port'" + ';"'
|
||||
|
||||
if (host_platform == 'linux'):
|
||||
result = os.system(postgreLoginSrt + ' -c "\q"')
|
||||
|
||||
if (result != 0):
|
||||
print('Valid PostgreSQL not found!')
|
||||
dependence.append_install('PostgreSQL')
|
||||
dependence.append_uninstall('PostgreSQL')
|
||||
else:
|
||||
print('PostreSQL is installed')
|
||||
dependence.sqlPath = 'psql'
|
||||
return dependence
|
||||
|
||||
arrInfo = get_postgreSQLInfo()
|
||||
base.set_env('PGPASSWORD', install_params['PostgreSQL']['dbPass'])
|
||||
for info in arrInfo:
|
||||
if (base.is_dir(info['Location']) == False):
|
||||
continue
|
||||
|
||||
postgre_full_name = 'PostgreSQL ' + info['Version'][:2] + ' '
|
||||
connectionResult = base.run_command_in_dir(get_postrgre_path_to_bin(info['Location']), connectionString)['stdout']
|
||||
|
||||
if (connectionResult.find(install_params['PostgreSQL']['dbPort']) != -1):
|
||||
print(postgre_full_name + 'configuration is valid')
|
||||
dependence.sqlPath = info['Location']
|
||||
return dependence
|
||||
print(postgre_full_name + 'configuration is not valid')
|
||||
|
||||
print('Valid PostgreSQL not found')
|
||||
|
||||
dependence.append_uninstall('PostgreSQL')
|
||||
dependence.append_install('PostgreSQL')
|
||||
|
||||
for info in arrInfo:
|
||||
dependence.append_removepath(info['DataLocation'])
|
||||
|
||||
return dependence
|
||||
def check_postgreConfig(postgrePath = ''):
|
||||
result = True
|
||||
if (host_platform == 'windows'):
|
||||
base.set_env('PGPASSWORD', install_params['PostgreSQL']['dbPass'])
|
||||
|
||||
rootUser = install_params['PostgreSQL']['root']
|
||||
dbUser = install_params['PostgreSQL']['dbUser']
|
||||
dbName = install_params['PostgreSQL']['dbName']
|
||||
dbPass = install_params['PostgreSQL']['dbPass']
|
||||
postgre_path_to_bin = get_postrgre_path_to_bin(postgrePath)
|
||||
postgreLoginRoot = get_postgreLoginSrting(rootUser)
|
||||
postgreLoginDbUser = get_postgreLoginSrting(dbUser)
|
||||
creatdb_path = base.get_script_dir() + "/../../server/schema/postgresql/createdb.sql"
|
||||
|
||||
if (base.run_command_in_dir(postgre_path_to_bin, postgreLoginRoot + ' -c "\du ' + dbUser + '"')['stdout'].find(dbUser) != -1):
|
||||
print('User ' + dbUser + ' is exist')
|
||||
if (os.system(postgreLoginDbUser + '-c "\q"') != 0):
|
||||
print('Invalid user password!')
|
||||
base.print_info('Changing password...')
|
||||
result = change_userPass(dbUser, dbPass, postgrePath) and result
|
||||
else:
|
||||
print('User ' + dbUser + ' not exist!')
|
||||
base.print_info('Creating ' + dbName + ' user...')
|
||||
result = create_postgreUser(dbUser, dbPass, postgrePath) and result
|
||||
|
||||
if (base.run_command_in_dir(postgre_path_to_bin, postgreLoginRoot + ' -c "SELECT datname FROM pg_database;"')['stdout'].find('onlyoffice') == -1):
|
||||
print('Database ' + dbName + ' not found')
|
||||
base.print_info('Creating ' + dbName + ' database...')
|
||||
result = create_postgreDb(dbName, postgrePath) and configureDb(dbUser, dbName, creatdb_path, postgrePath)
|
||||
else:
|
||||
if (base.run_command_in_dir(postgre_path_to_bin, postgreLoginRoot + '-c "SELECT pg_size_pretty(pg_database_size(' + "'" + dbName + "'" + '));"')['stdout'].find('7559 kB') != -1):
|
||||
print('Database ' + dbName + ' not configured')
|
||||
base.print_info('Configuring ' + dbName + ' database...')
|
||||
result = configureDb(dbName, creatdb_path, postgrePath) and result
|
||||
print('Database ' + dbName + ' is valid')
|
||||
|
||||
if (base.run_command_in_dir(postgre_path_to_bin, postgreLoginRoot + '-c "\l+ ' + dbName + '"')['stdout'].find(dbUser +'=CTc/' + rootUser) == -1):
|
||||
print('User ' + dbUser + ' has no database privileges!')
|
||||
base.print_info('Setting database privileges for user ' + dbUser + '...')
|
||||
result = set_dbPrivilegesForUser(dbUser, dbName, postgrePath) and result
|
||||
print('User ' + dbUser + ' has database privileges')
|
||||
|
||||
return result
|
||||
def create_postgreDb(dbName, postgrePath = ''):
|
||||
#ToDo check path to postgre
|
||||
postgreLoginUser = get_postgreLoginSrting(install_params['PostgreSQL']['root'])
|
||||
if (os.system(postgreLoginUser + '-c "CREATE DATABASE ' + dbName +';"') != 0):
|
||||
return False
|
||||
return True
|
||||
def set_dbPrivilegesForUser(userName, dbName, postgrePath = ''):
|
||||
#ToDo check path to postgre
|
||||
postgreLoginUser = get_postgreLoginSrting(install_params['PostgreSQL']['root'])
|
||||
if (os.system(postgreLoginUser + '-c "GRANT ALL privileges ON DATABASE ' + dbName + ' TO ' + userName + ';"') != 0):
|
||||
return False
|
||||
return True
|
||||
def create_postgreUser(userName, userPass, postgrePath = ''):
|
||||
#ToDo check path to postgre
|
||||
postgreLoginRoot = get_postgreLoginSrting(install_params['PostgreSQL']['root'])
|
||||
if (os.system(postgreLoginRoot + '-c "CREATE USER ' + userName + ' WITH password ' + "'" + userPass + "'" + ';"') != 0):
|
||||
return False
|
||||
return True
|
||||
def change_userPass(userName, userPass, postgrePath = ''):
|
||||
#ToDo check path to postgre
|
||||
postgreLoginRoot = get_postgreLoginSrting(install_params['PostgreSQL']['root'])
|
||||
if (os.system(postgreLoginRoot + '-c "ALTER USER ' + userName + " WITH PASSWORD '" + userPass + "';" + '"') != 0):
|
||||
return False
|
||||
return True
|
||||
def configureDb(userName, dbName, scriptPath, postgrePath = ''):
|
||||
#ToDo check path to postgre
|
||||
print('Execution ' + scriptPath)
|
||||
postgreLoginSrt = get_postgreLoginSrting(userName)
|
||||
|
||||
code = os.system(postgreLoginSrt + ' -d ' + dbName + ' -f "' + scriptPath + '"')
|
||||
if (code != 0):
|
||||
print('Execution failed!')
|
||||
return False
|
||||
print('Execution completed')
|
||||
return True
|
||||
def uninstall_postgresql():
|
||||
code = os.system('sudo DEBIAN_FRONTEND=noninteractive apt-get purge --auto-remove postgresql* -y')
|
||||
code = os.system('sudo rm -rf /var/lib/postgresql/') and code
|
||||
code = os.system('sudo rm -rf /var/log/postgresql/') and code
|
||||
code = os.system('sudo rm -rf /etc/postgresql/') and code
|
||||
code = os.system('sudo userdel -r postgres') and code
|
||||
code = os.system('sudo groupdel postgres') and code
|
||||
|
||||
return code
|
||||
|
||||
def get_programUninstallsByFlag(sName, flag):
|
||||
info = []
|
||||
aReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
||||
aKey = winreg.OpenKey(aReg, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, winreg.KEY_READ | flag)
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
|
||||
for i in range(count_subkey):
|
||||
try:
|
||||
asubkey_name = winreg.EnumKey(aKey, i)
|
||||
asubkey = winreg.OpenKey(aKey, asubkey_name)
|
||||
progName = winreg.QueryValueEx(asubkey, 'DisplayName')[0]
|
||||
|
||||
if (progName.find(sName) != -1):
|
||||
info.append(winreg.QueryValueEx(asubkey, 'UninstallString')[0])
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
return info
|
||||
def get_programUninstalls(sName):
|
||||
return get_programUninstallsByFlag(sName, winreg.KEY_WOW64_32KEY) + get_programUninstallsByFlag(sName, winreg.KEY_WOW64_64KEY)
|
||||
|
||||
def uninstallProgram(sName):
|
||||
base.print_info("Uninstalling all versions " + sName + "...")
|
||||
info = ''
|
||||
code = 0
|
||||
if (host_platform == 'windows'):
|
||||
unInfo = get_programUninstalls(sName)
|
||||
for info in unInfo:
|
||||
info = info.replace('"', '')
|
||||
if (base.is_file(info) == False):
|
||||
info = info.replace('/I', '/x').replace('/i', '/x') + ' /qn'
|
||||
else:
|
||||
if (sName in uninstall_params):
|
||||
info = '"' + info + '" ' + uninstall_params[sName]
|
||||
else:
|
||||
info = '"' + info + '" /S'
|
||||
elif (host_platform == 'linux'):
|
||||
if (sName in uninstall_special):
|
||||
code = uninstall_special[sName]()
|
||||
else:
|
||||
info = 'sudo apt-get remove --purge ' + sName + '* -y && ' + 'sudo apt-get autoremove -y && ' + 'sudo apt-get autoclean'
|
||||
|
||||
if (info != ''):
|
||||
print("Uninstalling " + sName + "...")
|
||||
print(info)
|
||||
|
||||
popen = subprocess.Popen(info, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
popen.communicate()
|
||||
code = popen.wait()
|
||||
|
||||
if (code != 0):
|
||||
print("Uninstalling was failed!")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def installProgram(sName):
|
||||
base.print_info("Installing " + sName + "...")
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
if (sName in install_special):
|
||||
code = install_special[sName]()
|
||||
else:
|
||||
if (sName not in downloads_list['Windows']):
|
||||
print("Url for install not found!")
|
||||
return False
|
||||
|
||||
download_url = downloads_list['Windows'][sName]
|
||||
file_name = "install."
|
||||
is_msi = download_url.endswith('msi')
|
||||
if is_msi:
|
||||
file_name += "msi"
|
||||
else:
|
||||
file_name += "exe"
|
||||
base.download(download_url, file_name)
|
||||
|
||||
base.print_info("Install " + sName + "...")
|
||||
install_command = ("msiexec.exe /i " + file_name) if is_msi else file_name
|
||||
|
||||
if (sName in install_params):
|
||||
install_command += " " + install_params.get(sName, '')
|
||||
if (is_msi == True):
|
||||
install_command += " /qn "
|
||||
elif sName not in install_params:
|
||||
install_command += " /S"
|
||||
|
||||
print(install_command)
|
||||
code = os.system(install_command)
|
||||
base.delete_file(file_name)
|
||||
elif (host_platform == 'linux'):
|
||||
if (sName in install_special):
|
||||
code = install_special[sName]()
|
||||
else:
|
||||
if (sName not in downloads_list['Linux']):
|
||||
print("Program for install not found!")
|
||||
return False
|
||||
|
||||
base.print_info("Install " + sName + "...")
|
||||
install_command = 'yes | sudo apt install ' + downloads_list['Linux'][sName]
|
||||
print(install_command)
|
||||
code = os.system(install_command)
|
||||
|
||||
if (code != 0):
|
||||
print("Installing was failed!")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def install_gruntcli():
|
||||
check_npmPath()
|
||||
|
||||
install_command = 'npm install -g grunt-cli'
|
||||
if (host_platform != 'windows'):
|
||||
install_command = 'sudo ' + install_command
|
||||
|
||||
return os.system(install_command)
|
||||
|
||||
def install_mysqlserver():
|
||||
if (host_platform == 'windows'):
|
||||
return os.system('"' + os.environ['ProgramFiles(x86)'] + '\\MySQL\\MySQL Installer for Windows\\MySQLInstallerConsole" community install server;' + install_params['MySQLServer']['version'] + ';x64:*:type=config;openfirewall=true;generallog=true;binlog=true;serverid=' + install_params['MySQLServer']['port'] + 'enable_tcpip=true;port=' + install_params['MySQLServer']['port'] + ';rootpasswd=' + install_params['MySQLServer']['pass'] + ' -silent')
|
||||
elif (host_platform == 'linux'):
|
||||
os.system('sudo kill ' + base.run_command('sudo fuser -vn tcp ' + install_params['MySQLServer']['port'])['stdout'])
|
||||
code = os.system('sudo ufw enable && sudo ufw allow 22 && sudo ufw allow 3306')
|
||||
code = os.system('sudo apt-get -y install zsh htop') and code
|
||||
code = os.system('echo "mysql-server mysql-server/root_password password ' + install_params['MySQLServer']['pass'] + '" | sudo debconf-set-selections') and code
|
||||
code = os.system('echo "mysql-server mysql-server/root_password_again password ' + install_params['MySQLServer']['pass'] + '" | sudo debconf-set-selections') and code
|
||||
return os.system('yes | sudo apt install mysql-server') and code
|
||||
return 1
|
||||
|
||||
def get_updates():
|
||||
return os.system('yes | sudo apt-get update')
|
||||
|
||||
def install_redis():
|
||||
base.print_info("Installing Redis...")
|
||||
pid = base.run_command('netstat -ano | findstr ' + install_params['Redis'].split(' ')[0].split('=')[1])['stdout'].split(' ')[-1]
|
||||
if (pid != ''):
|
||||
os.system('taskkill /F /PID ' + pid)
|
||||
os.system('sc delete Redis')
|
||||
|
||||
return installProgram('Redis')
|
||||
|
||||
def install_postgresql():
|
||||
if (host_platform == 'windows'):
|
||||
download_url = downloads_list['PostgreSQL']
|
||||
file_name = "install.exe"
|
||||
base.download(download_url, file_name)
|
||||
base.print_info("Install PostgreSQL...")
|
||||
install_command = file_name + ' --mode unattended --unattendedmodeui none --superpassword ' + install_params['PostgreSQL']['dbPass'] + ' --serverport ' + install_params['PostgreSQL']['dbPort']
|
||||
else:
|
||||
base.print_info("Install PostgreSQL...")
|
||||
install_command = 'sudo apt install postgresql -y'
|
||||
|
||||
print(install_command)
|
||||
code = os.system(install_command)
|
||||
|
||||
if (host_platform == 'windows'):
|
||||
base.delete_file(file_name)
|
||||
else:
|
||||
code = os.system('sudo -i -u postgres psql -c "ALTER USER postgres PASSWORD ' + "'" + install_params['PostgreSQL']['dbPass'] + "'" + ';"') and code
|
||||
|
||||
return code
|
||||
|
||||
downloads_list = {
|
||||
'Windows': {
|
||||
'Git': 'https://github.com/git-for-windows/git/releases/download/v2.29.0.windows.1/Git-2.29.0-64-bit.exe',
|
||||
'Node.js': 'https://nodejs.org/download/release/v14.15.1/node-v14.15.1-x64.msi',
|
||||
'Java': 'https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242990_a4634525489241b9a9e1aa73d9e118e6',
|
||||
'RabbitMQ': 'https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.9/rabbitmq-server-3.8.9.exe',
|
||||
'Erlang': 'http://erlang.org/download/otp_win64_23.1.exe',
|
||||
'VC2019x64': 'https://aka.ms/vs/16/release/vc_redist.x64.exe',
|
||||
'MySQLInstaller': 'https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-web-community-8.0.21.0.msi',
|
||||
'BuildTools': 'https://download.visualstudio.microsoft.com/download/pr/11503713/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe',
|
||||
'Redis': 'https://github.com/tporadowski/redis/releases/download/v5.0.9/Redis-x64-5.0.9.msi',
|
||||
'PostgreSQL': 'https://sbp.enterprisedb.com/getfile.jsp?fileid=12851'
|
||||
},
|
||||
'Linux': {
|
||||
'Git': 'git',
|
||||
'Node.js': 'nodejs',
|
||||
'Npm': 'npm',
|
||||
'Java': 'openjdk-11-jdk',
|
||||
'RabbitMQ': 'rabbitmq-server',
|
||||
'Redis': 'redis-server',
|
||||
'Erlang': 'erlang',
|
||||
'Curl': 'curl',
|
||||
'7z': 'p7zip-full',
|
||||
'PostgreSQL': 'postgresql'
|
||||
}
|
||||
}
|
||||
install_special = {
|
||||
'GruntCli': install_gruntcli,
|
||||
'MySQLServer': install_mysqlserver,
|
||||
'RedisServer' : install_redis,
|
||||
'PostgreSQL': install_postgresql
|
||||
}
|
||||
uninstall_special = {
|
||||
'MySQLServer': uninstall_mysqlserver,
|
||||
'PostgreSQL' : uninstall_postgresql
|
||||
}
|
||||
install_params = {
|
||||
'BuildTools': '--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --wait',
|
||||
'Git': '/VERYSILENT /NORESTART',
|
||||
'Java': '/s',
|
||||
'MySQLServer': {
|
||||
'port': '3306',
|
||||
'user': 'root',
|
||||
'pass': 'onlyoffice',
|
||||
'version': '8.0.21'
|
||||
},
|
||||
'Redis': 'PORT=6379 ADD_FIREWALL_RULE=1',
|
||||
'PostgreSQL': {
|
||||
'root': 'postgres',
|
||||
'dbPort': '5432',
|
||||
'dbName': 'onlyoffice',
|
||||
'dbUser': 'onlyoffice',
|
||||
'dbPass': 'onlyoffice'
|
||||
}
|
||||
}
|
||||
uninstall_params = {
|
||||
'PostgreSQL': '--mode unattended --unattendedmodeui none'
|
||||
}
|
||||
26
scripts/develop/install.py
Normal file
26
scripts/develop/install.py
Normal file
@ -0,0 +1,26 @@
|
||||
import sys
|
||||
sys.path.append('scripts')
|
||||
sys.path.append('scripts/develop')
|
||||
sys.path.append('scripts/develop/vendor')
|
||||
import base
|
||||
import shutil
|
||||
import optparse
|
||||
import dependence
|
||||
|
||||
arguments = sys.argv[1:]
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("--install", action="append", type="string", dest="install", default=[], help="provides install dependencies")
|
||||
parser.add_option("--uninstall", action="append", type="string", dest="uninstall", default=[], help="provides uninstall dependencies")
|
||||
parser.add_option("--remove-path", action="append", type="string", dest="remove-path", default=[], help="provides path dependencies to remove")
|
||||
|
||||
(options, args) = parser.parse_args(arguments)
|
||||
configOptions = vars(options)
|
||||
|
||||
for item in configOptions["uninstall"]:
|
||||
dependence.uninstallProgram(item)
|
||||
for item in configOptions["remove-path"]:
|
||||
if (base.is_dir(item) == True):
|
||||
shutil.rmtree(item)
|
||||
for item in configOptions["install"]:
|
||||
dependence.installProgram(item)
|
||||
42
scripts/develop/release.py
Normal file
42
scripts/develop/release.py
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
import base
|
||||
import dependence
|
||||
import config
|
||||
|
||||
branch_from = ''
|
||||
branches_to = []
|
||||
|
||||
platform = base.host_platform()
|
||||
if ("windows" == platform):
|
||||
dependence.check_pythonPath()
|
||||
dependence.check_gitPath()
|
||||
|
||||
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(base.get_plugins('autocomplete, easybib, glavred, wordpress'))
|
||||
# Add other repositories
|
||||
repositories['core-ext'] = [True, False]
|
||||
|
||||
base.update_repositories(repositories)
|
||||
|
||||
repositories['onlyoffice'] = [True, False]
|
||||
|
||||
for repo in repositories:
|
||||
base.create_pull_request(branches_to, repo, True)
|
||||
|
||||
sys.exit(0)
|
||||
89
scripts/develop/run_server.py
Normal file
89
scripts/develop/run_server.py
Normal file
@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
import os
|
||||
import base
|
||||
import dependence
|
||||
import traceback
|
||||
|
||||
def install_module(path):
|
||||
base.print_info('Install: ' + path)
|
||||
base.cmd_in_dir(path, 'npm', ['install'])
|
||||
|
||||
def run_module(directory, args=[]):
|
||||
base.run_nodejs_in_dir(directory, args)
|
||||
|
||||
def find_rabbitmqctl(base_path):
|
||||
return base.find_file(os.path.join(base_path, 'RabbitMQ Server'), 'rabbitmqctl.bat')
|
||||
|
||||
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['PROGRAMW6432']) 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')
|
||||
|
||||
def start_mac_services():
|
||||
base.print_info('Restart MySQL Server')
|
||||
base.run_process(['mysql.server', 'restart'])
|
||||
base.print_info('Start RabbitMQ Server')
|
||||
base.run_process(['rabbitmq-server'])
|
||||
base.print_info('Start Redis')
|
||||
base.run_process(['redis-server'])
|
||||
|
||||
def run_integration_example():
|
||||
base.cmd_in_dir('../../../document-server-integration/web/documentserver-example/nodejs', 'python', ['run-develop.py'])
|
||||
|
||||
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()
|
||||
|
||||
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')
|
||||
install_module('../../../server/SpellChecker')
|
||||
|
||||
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...")
|
||||
|
||||
if __name__ == "__main__":
|
||||
make(sys.argv[1:])
|
||||
|
||||
114
scripts/develop/vendor/libwindows.py
vendored
Normal file
114
scripts/develop/vendor/libwindows.py
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
'''
|
||||
This file is based on the code from https://github.com/JustAMan/pyWinClobber/blob/master/win32elevate.py
|
||||
|
||||
Copyright (c) 2013 by JustAMan at GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'''
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
import ctypes
|
||||
from ctypes.wintypes import HANDLE, BOOL, DWORD, HWND, HINSTANCE, HKEY
|
||||
from ctypes import c_ulong, c_char_p, c_int, c_void_p
|
||||
PHANDLE = ctypes.POINTER(HANDLE)
|
||||
PDWORD = ctypes.POINTER(DWORD)
|
||||
|
||||
CloseHandle = ctypes.windll.kernel32.CloseHandle
|
||||
CloseHandle.argtypes = (HANDLE, )
|
||||
CloseHandle.restype = BOOL
|
||||
|
||||
TOKEN_READ = 0x20008
|
||||
|
||||
class ShellExecuteInfo(ctypes.Structure):
|
||||
_fields_ = [('cbSize', DWORD),
|
||||
('fMask', c_ulong),
|
||||
('hwnd', HWND),
|
||||
('lpVerb', c_char_p),
|
||||
('lpFile', c_char_p),
|
||||
('lpParameters', c_char_p),
|
||||
('lpDirectory', c_char_p),
|
||||
('nShow', c_int),
|
||||
('hInstApp', HINSTANCE),
|
||||
('lpIDList', c_void_p),
|
||||
('lpClass', c_char_p),
|
||||
('hKeyClass', HKEY),
|
||||
('dwHotKey', DWORD),
|
||||
('hIcon', HANDLE),
|
||||
('hProcess', HANDLE)]
|
||||
def __init__(self, **kw):
|
||||
ctypes.Structure.__init__(self)
|
||||
self.cbSize = ctypes.sizeof(self)
|
||||
for field_name, field_value in kw.items():
|
||||
setattr(self, field_name, field_value)
|
||||
|
||||
PShellExecuteInfo = ctypes.POINTER(ShellExecuteInfo)
|
||||
|
||||
ShellExecuteEx = ctypes.windll.Shell32.ShellExecuteExA
|
||||
ShellExecuteEx.argtypes = (PShellExecuteInfo, )
|
||||
ShellExecuteEx.restype = BOOL
|
||||
|
||||
WaitForSingleObject = ctypes.windll.kernel32.WaitForSingleObject
|
||||
WaitForSingleObject.argtypes = (HANDLE, DWORD)
|
||||
WaitForSingleObject.restype = DWORD
|
||||
|
||||
# SW_HIDE = 0
|
||||
SW_SHOW = 5
|
||||
SEE_MASK_NOCLOSEPROCESS = 0x00000040
|
||||
SEE_MASK_NO_CONSOLE = 0x00008000
|
||||
INFINITE = -1
|
||||
|
||||
ELEVATE_MARKER = 'win32elevate_marker_parameter'
|
||||
|
||||
|
||||
def wait_and_close_handle(process_handle):
|
||||
'''
|
||||
Waits till spawned process finishes and closes the handle for it
|
||||
'''
|
||||
WaitForSingleObject(process_handle, INFINITE)
|
||||
CloseHandle(process_handle)
|
||||
|
||||
def sudo(executable, params=None):
|
||||
'''
|
||||
This will re-run current Python script requesting to elevate administrative rights.
|
||||
'''
|
||||
if not params:
|
||||
params = []
|
||||
|
||||
execute_info = ShellExecuteInfo(
|
||||
fMask=SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NO_CONSOLE,
|
||||
hwnd=None,
|
||||
lpVerb=b'runas',
|
||||
lpFile=executable.encode('utf-8'),
|
||||
lpParameters=subprocess.list2cmdline(params).encode('utf-8'),
|
||||
lpDirectory=None,
|
||||
nShow=SW_SHOW
|
||||
)
|
||||
|
||||
if not all(stream.isatty() for stream in (sys.stdin, sys.stdout, sys.stderr)):
|
||||
# TODO: Some streams were redirected, we need to manually work them
|
||||
raise NotImplementedError("Redirection is not supported")
|
||||
|
||||
if not ShellExecuteEx(ctypes.byref(execute_info)):
|
||||
raise ctypes.WinError()
|
||||
|
||||
wait_and_close_handle(execute_info.hProcess)
|
||||
|
||||
|
||||
__all__ = ('sudo')
|
||||
@ -12,15 +12,7 @@ def get_branch_name(directory):
|
||||
# detect build_tools branch
|
||||
#command = "git branch --show-current"
|
||||
command = "git symbolic-ref --short -q HEAD"
|
||||
popen = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
current_branch = "master"
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
current_branch = stdout.strip().decode("utf-8")
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
current_branch = base.run_command(command)['stdout']
|
||||
os.chdir(cur_dir)
|
||||
return current_branch
|
||||
|
||||
@ -53,7 +45,8 @@ def install_deps():
|
||||
"libxcb*",
|
||||
"libxi-dev",
|
||||
"libxrender-dev",
|
||||
"libxss1"]
|
||||
"libxss1",
|
||||
"libncurses5"]
|
||||
|
||||
base.cmd("sudo", ["apt-get", "install", "-y"] + packages)
|
||||
|
||||
|
||||
21
tools/linux/sync-rpc.patch
Normal file
21
tools/linux/sync-rpc.patch
Normal file
@ -0,0 +1,21 @@
|
||||
--- index.js
|
||||
+++ index.js
|
||||
@@ -101,18 +101,11 @@
|
||||
|
||||
function nodeNC(port, input) {
|
||||
const src = nodeNetCatSrc(port, input);
|
||||
- if (src.length < 1000) {
|
||||
- return spawnSync(process.execPath, ['-e', src], {
|
||||
- windowsHide: true,
|
||||
- maxBuffer: Infinity,
|
||||
- });
|
||||
- } else {
|
||||
return spawnSync(process.execPath, [], {
|
||||
input: src,
|
||||
windowsHide: true,
|
||||
maxBuffer: Infinity,
|
||||
});
|
||||
- }
|
||||
}
|
||||
|
||||
function test(fn, port) {
|
||||
BIN
tools/win/vswhere/vswhere.exe
Normal file
BIN
tools/win/vswhere/vswhere.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user