mirror of
https://github.com/ONLYOFFICE/build_tools.git
synced 2026-04-07 14:06:31 +08:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c407117dd | |||
| 6667c03ff6 | |||
| 91b75fcae5 | |||
| 048a54716f | |||
| 694d562a80 | |||
| a12f5dba9f | |||
| 7841606a41 | |||
| cf67d1cb77 | |||
| 255ecd64b2 | |||
| 96913b568f | |||
| 9c046cf10f | |||
| 68367474d0 | |||
| ab77f6d936 | |||
| 8dadf0dada | |||
| f074914f1b | |||
| 110981066e | |||
| 6195485cc7 | |||
| f13471428c | |||
| 55f1a05d17 | |||
| 173b81c288 | |||
| 62a8e2f72a | |||
| 0307890bf3 | |||
| 998daaa8d0 | |||
| 0b4faf9c80 | |||
| bafeadd809 | |||
| ecab59b715 | |||
| 0edb21a44b | |||
| 652fa57245 | |||
| 108f7bd8f7 | |||
| fce06d28a2 | |||
| 62169f91db | |||
| 2d2f1ec7d1 | |||
| 3a60d08eb3 | |||
| 04f8f175b9 | |||
| c687a4ae5b | |||
| c19c692ace | |||
| 8e71fa736b | |||
| e76fc53e85 | |||
| dc548da9eb | |||
| c618c0a6c3 | |||
| 6e4c75144a | |||
| abe9b200c9 | |||
| 8b542376c5 | |||
| b59df7faec | |||
| c9c516daf2 | |||
| 75109ea476 | |||
| 6b62d86151 | |||
| 56c6ff289e | |||
| 30d331b16e | |||
| f8216e4f6a | |||
| 2e9a66c70c | |||
| 7455472856 | |||
| 6b46c5d2b2 | |||
| 370fa31c11 | |||
| 29f5c6e111 | |||
| 0e4134b5f8 | |||
| 48cc6e7f5a | |||
| 7530a20cd8 | |||
| f3145e0d06 | |||
| 72a9c18b94 | |||
| 14522ee010 | |||
| d3d53b983a | |||
| 2a3b6d0ebb | |||
| 2bc9e29e4b |
46
build.pro
46
build.pro
@ -37,16 +37,14 @@ addSubProject(network, $$CORE_ROOT_DIR/Common/Network/network.pro,\
|
||||
kernel unicodeconverter)
|
||||
addSubProject(graphics, $$CORE_ROOT_DIR/DesktopEditor/graphics/pro/graphics.pro,\
|
||||
kernel unicodeconverter)
|
||||
addSubProject(pdfwriter, $$CORE_ROOT_DIR/PdfWriter/PdfWriter.pro,\
|
||||
addSubProject(pdffile, $$CORE_ROOT_DIR/PdfFile/PdfFile.pro,\
|
||||
kernel unicodeconverter graphics)
|
||||
addSubProject(djvufile, $$CORE_ROOT_DIR/DjVuFile/DjVuFile.pro,\
|
||||
kernel unicodeconverter graphics pdfwriter)
|
||||
kernel unicodeconverter graphics pdffile)
|
||||
addSubProject(xpsfile, $$CORE_ROOT_DIR/XpsFile/XpsFile.pro,\
|
||||
kernel unicodeconverter graphics pdfwriter)
|
||||
kernel unicodeconverter graphics pdffile)
|
||||
addSubProject(htmlrenderer, $$CORE_ROOT_DIR/HtmlRenderer/htmlrenderer.pro,\
|
||||
kernel unicodeconverter graphics pdfwriter)
|
||||
addSubProject(pdfreader, $$CORE_ROOT_DIR/PdfReader/PdfReader.pro,\
|
||||
kernel unicodeconverter graphics pdfwriter htmlrenderer)
|
||||
kernel unicodeconverter graphics)
|
||||
addSubProject(docxrenderer, $$CORE_ROOT_DIR/DocxRenderer/DocxRenderer.pro,\
|
||||
kernel unicodeconverter graphics)
|
||||
addSubProject(htmlfile2, $$CORE_ROOT_DIR/HtmlFile2/HtmlFile2.pro,\
|
||||
@ -58,21 +56,26 @@ addSubProject(fb2file, $$CORE_ROOT_DIR/Fb2File/Fb2File.pro,\
|
||||
addSubProject(epubfile, $$CORE_ROOT_DIR/EpubFile/CEpubFile.pro,\
|
||||
kernel unicodeconverter graphics htmlfile2)
|
||||
!no_x2t {
|
||||
addSubProject(docxformat, $$CORE_ROOT_DIR/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro)
|
||||
addSubProject(pptxformat, $$CORE_ROOT_DIR/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro)
|
||||
addSubProject(docxfile, $$CORE_ROOT_DIR/ASCOfficeDocxFile2/Linux/ASCOfficeDocxFile2Lib.pro)
|
||||
addSubProject(txtxmlformat, $$CORE_ROOT_DIR/ASCOfficeTxtFile/TxtXmlFormatLib/Linux/TxtXmlFormatLib.pro)
|
||||
addSubProject(rtfformat, $$CORE_ROOT_DIR/ASCOfficeRtfFile/RtfFormatLib/Linux/RtfFormatLib.pro)
|
||||
addSubProject(pptformat, $$CORE_ROOT_DIR/ASCOfficePPTFile/PPTFormatLib/Linux/PPTFormatLib.pro)
|
||||
addSubProject(docformat, $$CORE_ROOT_DIR/ASCOfficeDocFile/DocFormatLib/Linux/DocFormatLib.pro)
|
||||
addSubProject(odffilereader,$$CORE_ROOT_DIR/ASCOfficeOdfFile/linux/OdfFileReaderLib.pro)
|
||||
addSubProject(odffilewriter,$$CORE_ROOT_DIR/ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro)
|
||||
addSubProject(xlsformat, $$CORE_ROOT_DIR/ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro)
|
||||
addSubProject(xlsbformat, $$CORE_ROOT_DIR/Common/DocxFormat/DocxFormatLib/XlsbFormatLib.pro)
|
||||
addSubProject(vbaformat, $$CORE_ROOT_DIR/ASCOfficeXlsFile2/source/linux/VbaFormatLib.pro)
|
||||
addSubProject(docxformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro)
|
||||
addSubProject(pptxformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro)
|
||||
addSubProject(xlsbformat, $$CORE_ROOT_DIR/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro)
|
||||
|
||||
addSubProject(docformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/DocFormatLib/Linux/DocFormatLib.pro)
|
||||
addSubProject(pptformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro)
|
||||
addSubProject(xlsformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro)
|
||||
addSubProject(vbaformat, $$CORE_ROOT_DIR/MsBinaryFile/Projects/VbaFormatLib/Linux/VbaFormatLib.pro)
|
||||
|
||||
addSubProject(txtxmlformat, $$CORE_ROOT_DIR/TxtFile/Projects/Linux/TxtXmlFormatLib.pro)
|
||||
addSubProject(rtfformat, $$CORE_ROOT_DIR/RtfFile/Projects/Linux/RtfFormatLib.pro)
|
||||
addSubProject(odffile, $$CORE_ROOT_DIR/OdfFile/Projects/Linux/OdfFormatLib.pro)
|
||||
|
||||
addSubProject(cfcpp, $$CORE_ROOT_DIR/Common/cfcpp/cfcpp.pro)
|
||||
addSubProject(bindocument, $$CORE_ROOT_DIR/OOXML/Projects/Linux/BinDocument/BinDocument.pro)
|
||||
|
||||
addSubProject(x2t, $$CORE_ROOT_DIR/X2tConverter/build/Qt/X2tConverter.pro,\
|
||||
docxformat pptxformat docxfile txtxmlformat rtfformat pptformat docformat odffilereader odffilewriter xlsformat xlsbformat fb2file epubfile docxrenderer)
|
||||
docxformat pptxformat xlsbformat docformat pptformat xlsformat vbaformat txtxmlformat rtfformat odffile cfcpp bindocument fb2file epubfile docxrenderer)
|
||||
}
|
||||
|
||||
!no_use_common_binary {
|
||||
addSubProject(allfontsgen, $$CORE_ROOT_DIR/DesktopEditor/AllFontsGen/AllFontsGen.pro,\
|
||||
kernel unicodeconverter graphics)
|
||||
@ -83,6 +86,7 @@ addSubProject(epubfile, $$CORE_ROOT_DIR/EpubFile/CEpubFile.pro,\
|
||||
}
|
||||
!no_tests {
|
||||
addSubProject(standardtester, $$CORE_ROOT_DIR/Test/Applications/StandardTester/standardtester.pro)
|
||||
addSubProject(x2ttester, $$CORE_ROOT_DIR/Test/Applications/x2tTester/x2ttester.pro)
|
||||
}
|
||||
|
||||
core_and_multimedia {
|
||||
@ -95,7 +99,7 @@ desktop {
|
||||
addSubProject(ooxmlsignature, $$CORE_ROOT_DIR/DesktopEditor/xmlsec/src/ooxmlsignature.pro,\
|
||||
kernel unicodeconverter graphics)
|
||||
addSubProject(documentscore, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore.pro,\
|
||||
kernel unicodeconverter graphics hunspell ooxmlsignature htmlrenderer pdfwriter pdfreader djvufile xpsfile)
|
||||
kernel unicodeconverter graphics hunspell ooxmlsignature htmlrenderer pdffile djvufile xpsfile)
|
||||
addSubProject(documentscore_helper, $$ROOT_DIR/desktop-sdk/ChromiumBasedEditors/lib/ascdocumentscore_helper.pro,\
|
||||
documentscore)
|
||||
!core_mac {
|
||||
@ -116,4 +120,4 @@ mobile {
|
||||
!desktop {
|
||||
addSubProject(hunspell, $$CORE_ROOT_DIR/Common/3dParty/hunspell/qt/hunspell.pro)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
FROM onlyoffice/documentserver:latest
|
||||
RUN apt-get update -y && \
|
||||
apt-get install git -y \
|
||||
python -y \
|
||||
python3 -y \
|
||||
openjdk-11-jdk -y \
|
||||
npm -y && \
|
||||
npm install -g grunt-cli -y && \
|
||||
git clone --depth 1 https://github.com/ONLYOFFICE/build_tools.git var/www/onlyoffice/documentserver/build_tools && \
|
||||
sed -i '/documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}/d' /app/ds/run-document-server.sh && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
ENTRYPOINT python /var/www/onlyoffice/documentserver/build_tools/develop/run_build_js.py /var/www/onlyoffice/documentserver && /bin/sh -c /app/ds/run-document-server.sh
|
||||
ENTRYPOINT python3 /var/www/onlyoffice/documentserver/build_tools/develop/run_build_js.py /var/www/onlyoffice/documentserver && /bin/sh -c /app/ds/run-document-server.sh
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
sys.path.append(sys.argv[1] + '/build_tools/scripts')
|
||||
@ -6,7 +6,7 @@ import build_js
|
||||
import config
|
||||
import base
|
||||
|
||||
base.cmd_in_dir(sys.argv[1] + '/build_tools/', 'python', ['configure.py'])
|
||||
base.cmd_in_dir(sys.argv[1] + '/build_tools/', 'python3', ['configure.py'])
|
||||
config.parse()
|
||||
|
||||
build_js.build_js_develop(sys.argv[1])
|
||||
|
||||
9
make.py
9
make.py
@ -77,16 +77,7 @@ if config.check_option("module", "desktop"):
|
||||
config.extend_option("config", "updmodule")
|
||||
config.extend_option("qmake_addon", "LINK=https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/appcast.xml")
|
||||
|
||||
if not base.is_file(base_dir + "/tools/WinSparkle-0.7.0.zip"):
|
||||
base.cmd("curl.exe", ["https://d2ettrnqo7v976.cloudfront.net/winsparkle/WinSparkle-0.7.0.zip", "--output", base_dir + "/tools/WinSparkle-0.7.0.zip"])
|
||||
|
||||
if not base.is_dir(base_dir + "/tools/WinSparkle-0.7.0"):
|
||||
base.cmd("7z.exe", ["x", base_dir + "/tools/WinSparkle-0.7.0.zip", "-otools"])
|
||||
|
||||
base.create_dir(base_dir + "/../desktop-apps/win-linux/3dparty/WinSparkle")
|
||||
#base.copy_dir(base_dir + "/tools/WinSparkle-0.7.0/include", base_dir + "/../desktop-apps/win-linux/3dparty/WinSparkle/include")
|
||||
base.copy_dir(base_dir + "/tools/WinSparkle-0.7.0/Release", base_dir + "/../desktop-apps/win-linux/3dparty/WinSparkle/win_32")
|
||||
base.copy_dir(base_dir + "/tools/WinSparkle-0.7.0/x64/Release", base_dir + "/../desktop-apps/win-linux/3dparty/WinSparkle/win_64")
|
||||
|
||||
if ("windows" == base.host_platform()):
|
||||
base.set_env("VIDEO_PLAYER_VLC_DIR", base_dir + "/../desktop-sdk/ChromiumBasedEditors/videoplayerlib/vlc")
|
||||
|
||||
@ -2,17 +2,89 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append('scripts')
|
||||
sys.path.append("scripts")
|
||||
import argparse
|
||||
import package_common as common
|
||||
import package_utils as utils
|
||||
|
||||
# config
|
||||
utils.parse()
|
||||
# parse
|
||||
parser = argparse.ArgumentParser(description="Build packages.")
|
||||
parser.add_argument("-P", "--platform", dest="platform", type=str,
|
||||
action="store", help="Defines platform", required=True)
|
||||
parser.add_argument("-T", "--targets", dest="targets", type=str, nargs="+",
|
||||
action="store", help="Defines targets", required=True)
|
||||
parser.add_argument("-R", "--branding", dest="branding", type=str,
|
||||
action="store", help="Provides branding path")
|
||||
parser.add_argument("-V", "--version", dest="version", type=str,
|
||||
action="store", help="Defines version")
|
||||
parser.add_argument("-B", "--build", dest="build", type=str,
|
||||
action="store", help="Defines build")
|
||||
args = parser.parse_args()
|
||||
|
||||
# vars
|
||||
common.workspace_dir = utils.get_abspath(utils.get_script_dir(__file__) + "/..")
|
||||
common.os_family = utils.host_platform()
|
||||
common.platform = args.platform
|
||||
common.targets = args.targets
|
||||
common.clean = "clean" in args.targets
|
||||
common.sign = "sign" in args.targets
|
||||
common.deploy = "deploy" in args.targets
|
||||
common.version = args.version if (args.version is not None) else utils.get_env("PRODUCT_VERSION", "1.0.0")
|
||||
common.build = args.build if (args.build is not None) else utils.get_env("BUILD_NUMBER", "1")
|
||||
common.release_branch = utils.get_env("RELEASE_BRANCH", "experimental")
|
||||
common.branding = args.branding
|
||||
common.timestamp = utils.get_timestamp()
|
||||
common.summary = []
|
||||
common.deploy_data = []
|
||||
utils.log("workspace_dir: " + common.workspace_dir)
|
||||
utils.log("os_family: " + common.os_family)
|
||||
utils.log("platform: " + str(common.platform))
|
||||
utils.log("targets: " + str(common.targets))
|
||||
utils.log("clean: " + str(common.clean))
|
||||
utils.log("sign: " + str(common.sign))
|
||||
utils.log("deploy: " + str(common.deploy))
|
||||
utils.log("version: " + common.version)
|
||||
utils.log("build: " + common.build)
|
||||
utils.log("branding: " + str(common.branding))
|
||||
utils.log("timestamp: " + common.timestamp)
|
||||
|
||||
# branding
|
||||
if utils.branding is not None:
|
||||
branding_path = utils.get_path('..', utils.branding)
|
||||
sys.path.insert(-1, utils.get_path(branding_path, 'build_tools/scripts'))
|
||||
if common.branding is not None:
|
||||
sys.path.insert(-1, \
|
||||
utils.get_path("../" + common.branding + "/build_tools/scripts"))
|
||||
|
||||
import package_core
|
||||
import package_desktop
|
||||
import package_server
|
||||
import package_builder
|
||||
import package_mobile
|
||||
|
||||
# build
|
||||
import package
|
||||
package.make(utils.product)
|
||||
utils.set_cwd(common.workspace_dir, verbose=True)
|
||||
utils.delete_file("deploy.json")
|
||||
if "core" in common.targets:
|
||||
package_core.make()
|
||||
if "desktop" in common.targets:
|
||||
package_desktop.make()
|
||||
if "builder" in common.targets:
|
||||
package_builder.make()
|
||||
if "server-community" in common.targets:
|
||||
package_server.make("community")
|
||||
if "server-enterprise" in common.targets:
|
||||
package_server.make("enterprise")
|
||||
if "server-developer" in common.targets:
|
||||
package_server.make("developer")
|
||||
if "mobile" in common.targets:
|
||||
package_mobile.make()
|
||||
|
||||
# summary
|
||||
utils.log_h1("Build summary")
|
||||
exitcode = 0
|
||||
for i in common.summary:
|
||||
if list(i.values())[0]:
|
||||
utils.log("[ OK ] " + list(i.keys())[0])
|
||||
else:
|
||||
utils.log("[FAILED] " + list(i.keys())[0])
|
||||
exitcode = 1
|
||||
|
||||
exit(exitcode)
|
||||
|
||||
@ -780,7 +780,7 @@ def generate_plist(path):
|
||||
content += "\t<key>CFBundleVersion</key>\n"
|
||||
content += "\t<string>" + bundle_version[0] + "." + bundle_version[1] + "." + bundle_version[2] + "</string>\n"
|
||||
content += "\t<key>MinimumOSVersion</key>\n"
|
||||
content += "\t<string>10.0</string>\n"
|
||||
content += "\t<string>13.0</string>\n"
|
||||
content += "</dict>\n"
|
||||
content += "</plist>"
|
||||
|
||||
@ -881,7 +881,7 @@ def extract_unicode(src, dst):
|
||||
|
||||
def archive_folder(src, dst):
|
||||
app = "7za" if ("mac" == host_platform()) else "7z"
|
||||
return cmd_exe(app, ["a", "-r", dst, src])
|
||||
return cmd_exe(app, ["a", dst, src])
|
||||
|
||||
# windows vcvarsall
|
||||
def _call_vcvarsall_and_return_env(arch):
|
||||
@ -1015,14 +1015,13 @@ def mac_correct_rpath_x2t(dir):
|
||||
mac_correct_rpath_library("EpubFile", ["UnicodeConverter", "kernel", "HtmlFile2", "graphics"])
|
||||
mac_correct_rpath_library("Fb2File", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("HtmlRenderer", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("PdfWriter", ["UnicodeConverter", "kernel", "graphics", "kernel_network"])
|
||||
mac_correct_rpath_library("DjVuFile", ["UnicodeConverter", "kernel", "graphics", "PdfWriter"])
|
||||
mac_correct_rpath_library("PdfReader", ["UnicodeConverter", "kernel", "graphics", "PdfWriter", "HtmlRenderer"])
|
||||
mac_correct_rpath_library("XpsFile", ["UnicodeConverter", "kernel", "graphics", "PdfWriter"])
|
||||
mac_correct_rpath_library("PdfFile", ["UnicodeConverter", "kernel", "graphics", "kernel_network"])
|
||||
mac_correct_rpath_library("DjVuFile", ["UnicodeConverter", "kernel", "graphics", "PdfFile"])
|
||||
mac_correct_rpath_library("XpsFile", ["UnicodeConverter", "kernel", "graphics", "PdfFile"])
|
||||
mac_correct_rpath_library("DocxRenderer", ["UnicodeConverter", "kernel", "graphics"])
|
||||
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", "kernel_network", "graphics", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"])
|
||||
mac_correct_rpath_binary("./x2t", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"])
|
||||
if is_file("./allfontsgen"):
|
||||
cmd("chmod", ["-v", "+x", "./allfontsgen"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./allfontsgen"], True)
|
||||
@ -1039,7 +1038,7 @@ def mac_correct_rpath_docbuilder(dir):
|
||||
os.chdir(dir)
|
||||
cmd("chmod", ["-v", "+x", "./docbuilder"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./docbuilder"], True)
|
||||
mac_correct_rpath_binary("./docbuilder", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"])
|
||||
mac_correct_rpath_binary("./docbuilder", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"])
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
|
||||
@ -1049,9 +1048,9 @@ def mac_correct_rpath_desktop(dir):
|
||||
os.chdir(dir)
|
||||
mac_correct_rpath_library("hunspell", [])
|
||||
mac_correct_rpath_library("ooxmlsignature", ["kernel"])
|
||||
mac_correct_rpath_library("ascdocumentscore", ["UnicodeConverter", "kernel", "graphics", "kernel_network", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "hunspell", "ooxmlsignature"])
|
||||
mac_correct_rpath_library("ascdocumentscore", ["UnicodeConverter", "kernel", "graphics", "kernel_network", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "hunspell", "ooxmlsignature"])
|
||||
cmd("install_name_tool", ["-change", "@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework", "@rpath/Chromium Embedded Framework.framework/Chromium Embedded Framework", "libascdocumentscore.dylib"])
|
||||
mac_correct_rpath_binary("./editors_helper.app/Contents/MacOS/editors_helper", ["ascdocumentscore", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfWriter", "HtmlRenderer", "PdfReader", "XpsFile", "DjVuFile", "hunspell", "ooxmlsignature"])
|
||||
mac_correct_rpath_binary("./editors_helper.app/Contents/MacOS/editors_helper", ["ascdocumentscore", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "hunspell", "ooxmlsignature"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path/../../../../Frameworks", "./editors_helper.app/Contents/MacOS/editors_helper"], True)
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path/../../../../Resources/converter", "./editors_helper.app/Contents/MacOS/editors_helper"], True)
|
||||
cmd("chmod", ["-v", "+x", "./editors_helper.app/Contents/MacOS/editors_helper"])
|
||||
@ -1331,4 +1330,34 @@ def generate_check_linux_system(build_tools_dir, out_dir):
|
||||
create_dir(out_dir + "/.system")
|
||||
copy_file(build_tools_dir + "/tools/linux/check_system/check.sh", out_dir + "/.system/check.sh")
|
||||
copy_file(build_tools_dir + "/tools/linux/check_system/libstdc++.so.6", out_dir + "/.system/libstdc++.so.6")
|
||||
return
|
||||
return
|
||||
|
||||
def convert_ios_framework_to_xcframework(folder, lib):
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(folder)
|
||||
|
||||
create_dir(lib + "_xc_tmp")
|
||||
create_dir(lib + "_xc_tmp/iphoneos")
|
||||
create_dir(lib + "_xc_tmp/iphonesimulator")
|
||||
copy_dir(lib + ".framework", lib + "_xc_tmp/iphoneos/" + lib + ".framework")
|
||||
copy_dir(lib + ".framework", lib + "_xc_tmp/iphonesimulator/" + lib + ".framework")
|
||||
|
||||
cmd("xcrun", ["lipo", "-remove", "x86_64", "./" + lib + "_xc_tmp/iphoneos/" + lib + ".framework/" + lib,
|
||||
"-o", "./" + lib + "_xc_tmp/iphoneos/" + lib + ".framework/" + lib])
|
||||
cmd("xcrun", ["lipo", "-remove", "arm64", "./" + lib + "_xc_tmp/iphonesimulator/" + lib + ".framework/" + lib,
|
||||
"-o", "./" + lib + "_xc_tmp/iphonesimulator/" + lib + ".framework/" + lib])
|
||||
|
||||
cmd("xcodebuild", ["-create-xcframework",
|
||||
"-framework", "./" + lib + "_xc_tmp/iphoneos/" + lib + ".framework/",
|
||||
"-framework", "./" + lib + "_xc_tmp/iphonesimulator/" + lib + ".framework/",
|
||||
"-output", lib + ".xcframework"])
|
||||
|
||||
delete_dir(lib + "_xc_tmp")
|
||||
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
|
||||
def convert_ios_framework_to_xcframework_folder(folder, libs):
|
||||
for lib in libs:
|
||||
convert_ios_framework_to_xcframework(folder, lib)
|
||||
return
|
||||
|
||||
@ -100,14 +100,14 @@ def make():
|
||||
make_pro_file("makefiles", "build.pro")
|
||||
if config.check_option("module", "builder") and base.is_windows() and "onlyoffice" == config.branding():
|
||||
# check replace
|
||||
new_replace_path = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/docbuilder.h")
|
||||
new_replace_path = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.com/src/docbuilder.h")
|
||||
if ("2019" == config.option("vs-version")):
|
||||
base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com", "docbuilder.com_2019.sln")
|
||||
base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com_2019.sln")
|
||||
if (True):
|
||||
new_path_net = base.correctPathForBuilder(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.net/src/docbuilder.net.cpp")
|
||||
base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.net/src", "docbuilder.net.sln")
|
||||
base.restorePathForBuilder(new_path_net)
|
||||
else:
|
||||
base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com", "docbuilder.com.sln")
|
||||
base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com.sln")
|
||||
base.restorePathForBuilder(new_replace_path)
|
||||
return
|
||||
|
||||
@ -69,6 +69,9 @@ def parse():
|
||||
if check_option("platform", "android"):
|
||||
options["platform"] += " android_arm64_v8a android_armv7 android_x86 android_x86_64"
|
||||
|
||||
#if check_option("platform", "ios"):
|
||||
# extend_option("config", "core_ios_32")
|
||||
|
||||
# check vs-version
|
||||
if ("" == option("vs-version")):
|
||||
options["vs-version"] = "2015"
|
||||
|
||||
@ -19,6 +19,7 @@ import html2
|
||||
import hunspell
|
||||
import glew
|
||||
import harfbuzz
|
||||
import hyphen
|
||||
|
||||
def check_android_ndk_macos_arm(dir):
|
||||
if base.is_dir(dir + "/darwin-x86_64") and not base.is_dir(dir + "/darwin-arm64"):
|
||||
@ -42,6 +43,8 @@ def make():
|
||||
hunspell.make(False)
|
||||
harfbuzz.make()
|
||||
glew.make()
|
||||
hyphen.make()
|
||||
|
||||
if config.check_option("module", "mobile"):
|
||||
curl.make()
|
||||
websocket.make()
|
||||
|
||||
21
scripts/core_common/modules/hyphen.py
Normal file
21
scripts/core_common/modules/hyphen.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../..')
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
|
||||
def make():
|
||||
print("[fetch]: hyphen")
|
||||
new_dir = base.get_script_dir() + "/../../core/Common/3dParty/hyphen"
|
||||
old_dir = os.getcwd()
|
||||
os.chdir(new_dir)
|
||||
|
||||
if not base.is_dir("hyphen"):
|
||||
base.cmd("git", ["clone", "https://github.com/hunspell/hyphen"])
|
||||
|
||||
|
||||
os.chdir(old_dir)
|
||||
return
|
||||
|
||||
@ -126,11 +126,14 @@ def make():
|
||||
def param_apple(platform, arch):
|
||||
return ["-G","Xcode", "-DDEPLOYMENT_TARGET=10", "-DENABLE_BITCODE=1", "-DPLATFORM=" + platform, "-DARCHS=" + arch, "-DCMAKE_TOOLCHAIN_FILE=" + CMAKE_TOOLCHAIN_FILE]
|
||||
|
||||
def param_apple_ios(platform, arch, params=[]):
|
||||
return params + ["-G","Xcode", "-DDEPLOYMENT_TARGET=11", "-DENABLE_BITCODE=1", "-DPLATFORM=" + platform, "-DARCHS=" + arch, "-DCMAKE_TOOLCHAIN_FILE=" + CMAKE_TOOLCHAIN_FILE]
|
||||
|
||||
if(platform == "ios"):
|
||||
build_arch("ios", "armv7", param_apple("OS", "armv7"))
|
||||
build_arch("ios", "arm64", param_apple("OS64", "arm64"))
|
||||
build_arch("ios", "i386", param_apple("SIMULATOR", "i386"))
|
||||
build_arch("ios", "x86_64", param_apple("SIMULATOR64", "x86_64"))
|
||||
#build_arch("ios", "armv7", param_apple("OS", "armv7"))
|
||||
build_arch("ios", "arm64", param_apple_ios("OS64", "arm64"))
|
||||
#build_arch("ios", "i386", param_apple_ios("SIMULATOR", "i386"))
|
||||
build_arch("ios", "x86_64", param_apple_ios("SIMULATOR64", "x86_64", ["-DCMAKE_CXX_FLAGS=-std=c++11"]))
|
||||
else:
|
||||
build_arch("mac", "mac_arm64", param_apple("MAC_ARM64", "arm64"))
|
||||
build_arch("mac", "mac_64", param_apple("MAC", "x86_64"))
|
||||
@ -144,7 +147,7 @@ def make():
|
||||
#copy include
|
||||
prefix_dir = current_dir + "/IXWebSocket/build/ios/"
|
||||
postfix_dir = ""
|
||||
if base.is_dir(prefix_dir + "armv7/usr"):
|
||||
if base.is_dir(prefix_dir + "arm64/usr"):
|
||||
postfix_dir = "/usr"
|
||||
|
||||
if base.is_dir(prefix_dir + "armv7" + postfix_dir + "/include"):
|
||||
@ -157,10 +160,16 @@ def make():
|
||||
base.cmd("cp", [ "-r", prefix_dir + "x86_64" + postfix_dir + "/include", current_dir + "/IXWebSocket/build/ios/ixwebsocket-universal"])
|
||||
|
||||
# Create fat lib
|
||||
base.cmd("lipo", ["IXWebSocket/build/ios/armv7" + postfix_dir + "/lib/libixwebsocket.a", "IXWebSocket/build/ios/arm64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"IXWebSocket/build/ios/i386" + postfix_dir + "/lib/libixwebsocket.a", "IXWebSocket/build/ios/x86_64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"-create", "-output",
|
||||
"IXWebSocket/build/ios/ixwebsocket-universal/lib/libixwebsocket.a"])
|
||||
if (True):
|
||||
base.cmd("lipo", ["IXWebSocket/build/ios/arm64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"IXWebSocket/build/ios/x86_64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"-create", "-output",
|
||||
"IXWebSocket/build/ios/ixwebsocket-universal/lib/libixwebsocket.a"])
|
||||
else:
|
||||
base.cmd("lipo", ["IXWebSocket/build/ios/armv7" + postfix_dir + "/lib/libixwebsocket.a", "IXWebSocket/build/ios/arm64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"IXWebSocket/build/ios/i386" + postfix_dir + "/lib/libixwebsocket.a", "IXWebSocket/build/ios/x86_64" + postfix_dir + "/lib/libixwebsocket.a",
|
||||
"-create", "-output",
|
||||
"IXWebSocket/build/ios/ixwebsocket-universal/lib/libixwebsocket.a"])
|
||||
|
||||
|
||||
elif (-1 != config.option("platform").find("linux")):
|
||||
|
||||
@ -36,8 +36,7 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "kernel_network")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "graphics")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfWriter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfFile")
|
||||
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, "HtmlFile2")
|
||||
@ -95,10 +94,11 @@ def make():
|
||||
base.replaceInFile(root_dir + "/include/docbuilder.h", "Q_DECL_EXPORT", "BUILDING_DOCBUILDER")
|
||||
|
||||
if ("win_64" == platform):
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.com/x64/Release/docbuilder.com.dll", root_dir + "/docbuilder.com.dll")
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.com/deploy/win_64/docbuilder.com.dll", root_dir + "/docbuilder.com.dll")
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.net/deploy/win_64/docbuilder.net.dll", root_dir + "/docbuilder.net.dll")
|
||||
|
||||
elif ("win_32" == platform):
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.com/Win32/Release/docbuilder.com.dll", root_dir + "/docbuilder.com.dll")
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.com/deploy/win_32/docbuilder.com.dll", root_dir + "/docbuilder.com.dll")
|
||||
base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.net/deploy/win_32/docbuilder.net.dll", root_dir + "/docbuilder.net.dll")
|
||||
|
||||
# correct ios frameworks
|
||||
|
||||
@ -33,8 +33,7 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "HtmlRenderer")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "DjVuFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "XpsFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "PdfWriter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "PdfFile")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "HtmlFile2")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, archive_dir, "Fb2File")
|
||||
@ -56,10 +55,12 @@ def make():
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "allfontsgen")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "allthemesgen")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "standardtester")
|
||||
base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "x2ttester")
|
||||
|
||||
if base.is_file(archive_dir + "/core.7z"):
|
||||
base.delete_file(archive_dir + "/core.7z")
|
||||
base.archive_folder(archive_dir, archive_dir + "/core.7z")
|
||||
|
||||
if base.is_file(archive_dir + ".7z"):
|
||||
base.delete_file(archive_dir + ".7z")
|
||||
base.archive_folder(archive_dir + "/*", archive_dir + ".7z")
|
||||
|
||||
return
|
||||
|
||||
|
||||
@ -47,8 +47,7 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "kernel_network")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "graphics")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir + "/converter", "PdfWriter")
|
||||
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", "PdfFile")
|
||||
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", "HtmlFile2")
|
||||
@ -234,7 +233,6 @@ def make():
|
||||
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")
|
||||
base.delete_file(root_dir + "/cef_sandbox.lib")
|
||||
base.delete_file(root_dir + "/libcef.lib")
|
||||
|
||||
|
||||
@ -42,8 +42,7 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "kernel_network")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "graphics")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfWriter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "PdfFile")
|
||||
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, "HtmlFile2")
|
||||
@ -59,10 +58,15 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "x2t")
|
||||
|
||||
if ("ios" == platform) and config.check_option("config", "bundle_dylibs") and config.check_option("config", "simulator"):
|
||||
exclude_arch(root_dir, ["kernel", "kernel_network", "UnicodeConverter", "graphics", "PdfWriter",
|
||||
"PdfReader", "DjVuFile", "XpsFile", "HtmlFile2", "HtmlRenderer", "doctrenderer",
|
||||
exclude_arch(root_dir, ["kernel", "kernel_network", "UnicodeConverter", "graphics", "PdfFile",
|
||||
"DjVuFile", "XpsFile", "HtmlFile2", "HtmlRenderer", "doctrenderer",
|
||||
"Fb2File", "EpubFile", "x2t"])
|
||||
|
||||
if ("ios" == platform):
|
||||
if (config.check_option("config", "bundle_dylibs")):
|
||||
base.convert_ios_framework_to_xcframework_folder(root_dir,
|
||||
["kernel", "kernel_network", "UnicodeConverter", "graphics", "PdfFile", "DjVuFile", "XpsFile",
|
||||
"HtmlFile2", "HtmlRenderer", "doctrenderer", "Fb2File", "EpubFile", "DocxRenderer", "x2t"])
|
||||
|
||||
# icu
|
||||
if (0 == platform.find("win")):
|
||||
|
||||
@ -75,8 +75,7 @@ def make():
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "kernel_network")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "UnicodeConverter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "graphics")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfWriter")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfReader")
|
||||
base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfFile")
|
||||
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, "HtmlFile2")
|
||||
|
||||
@ -137,7 +137,10 @@ def make():
|
||||
|
||||
#site url
|
||||
example_config = {}
|
||||
example_config["port"] = 80
|
||||
if (base.host_platform() == "linux"):
|
||||
example_config["port"] = 3000
|
||||
else:
|
||||
example_config["port"] = 80
|
||||
example_config["siteUrl"] = "http://" + config.option("siteUrl") + ":8000/"
|
||||
example_config["apiUrl"] = "web-apps/apps/api/documents/api.js"
|
||||
example_config["preloaderUrl"] = "web-apps/apps/api/documents/cache-scripts.html"
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import package_desktop
|
||||
import package_server
|
||||
import package_builder
|
||||
|
||||
def make(product):
|
||||
if product == 'desktop': package_desktop.make()
|
||||
elif product == 'server': package_server.make()
|
||||
elif product == 'builder': package_builder.make()
|
||||
else: exit(1)
|
||||
return
|
||||
@ -1,44 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from package_utils import *
|
||||
import package_utils as utils
|
||||
|
||||
onlyoffice = True
|
||||
company_name = 'ONLYOFFICE'
|
||||
company_name = "ONLYOFFICE"
|
||||
company_name_l = company_name.lower()
|
||||
publisher_name = 'Ascensio System SIA'
|
||||
cert_name = 'Ascensio System SIA'
|
||||
publisher_name = "Ascensio System SIA"
|
||||
cert_name = "Ascensio System SIA"
|
||||
|
||||
if product == 'desktop':
|
||||
if utils.is_windows():
|
||||
desktop_product_name = "Desktop Editors"
|
||||
desktop_product_name_s = desktop_product_name.replace(" ","")
|
||||
desktop_package_name = company_name + "_" + desktop_product_name_s
|
||||
desktop_vcredist_list = ["2022"]
|
||||
desktop_update_changes_list = {
|
||||
"en": "changes",
|
||||
"ru": "changes_ru"
|
||||
}
|
||||
|
||||
if system == 'windows':
|
||||
build_dir = get_path("desktop-apps/win-linux/package/windows")
|
||||
# branding_dir = get_path(branding, build_dir)
|
||||
product_name = 'Desktop Editors'
|
||||
product_name_s = product_name.replace(' ','')
|
||||
package_name = company_name + '_' + product_name_s
|
||||
vcredist_list = ['2022', '2013']
|
||||
update_changes_list = {
|
||||
'en': "changes",
|
||||
'ru': "changes_ru"
|
||||
}
|
||||
if utils.is_macos():
|
||||
desktop_package_name = "ONLYOFFICE"
|
||||
desktop_build_dir = "desktop-apps/macos"
|
||||
desktop_branding_dir = "desktop-apps/macos"
|
||||
desktop_updates_dir = "build/update"
|
||||
desktop_changes_dir = "ONLYOFFICE/update/updates/ONLYOFFICE/changes"
|
||||
desktop_update_changes_list = {
|
||||
"en": "ReleaseNotes",
|
||||
"ru": "ReleaseNotesRU"
|
||||
}
|
||||
sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
|
||||
|
||||
elif system == 'darwin':
|
||||
build_dir = "desktop-apps/macos"
|
||||
branding_build_dir = "desktop-apps/macos"
|
||||
package_name = company_name
|
||||
updates_dir = "build/update"
|
||||
changes_dir = "ONLYOFFICE/update/updates/ONLYOFFICE/changes"
|
||||
update_changes_list = {
|
||||
'en': "ReleaseNotes",
|
||||
'ru': "ReleaseNotesRU"
|
||||
}
|
||||
sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
|
||||
|
||||
if product == 'builder':
|
||||
|
||||
if system == 'windows':
|
||||
build_dir = "document-builder-package"
|
||||
product_name = 'Document Builder'
|
||||
product_name_s = product_name.replace(' ','')
|
||||
package_name = company_name + '_' + product_name_s
|
||||
builder_product_name = "Document Builder"
|
||||
|
||||
@ -1,105 +1,154 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from package_utils import *
|
||||
from package_branding import *
|
||||
import package_utils as utils
|
||||
import package_common as common
|
||||
import package_branding as branding
|
||||
|
||||
def make():
|
||||
if system == 'windows':
|
||||
utils.log_h1("BUILDER")
|
||||
if utils.is_windows():
|
||||
make_windows()
|
||||
elif system == 'linux':
|
||||
if 'packages' in targets:
|
||||
set_cwd(build_dir)
|
||||
log("Clean")
|
||||
cmd("make", ["clean"])
|
||||
log("Build packages")
|
||||
cmd("make", ["packages"])
|
||||
elif utils.is_linux():
|
||||
make_linux()
|
||||
else:
|
||||
exit(1)
|
||||
utils.log("Unsupported host OS")
|
||||
return
|
||||
|
||||
#
|
||||
# Windows
|
||||
#
|
||||
def aws_s3_upload(local, key, ptype=None):
|
||||
if common.os_family == "windows":
|
||||
rc = utils.cmd(
|
||||
"aws", "s3", "cp", "--acl", "public-read", "--no-progress",
|
||||
local, "s3://" + common.s3_bucket + "/" + key,
|
||||
verbose=True
|
||||
)
|
||||
else:
|
||||
rc = utils.sh("aws s3 cp --acl public-read --no-progress " \
|
||||
+ local + " s3://" + common.s3_bucket + "/" + key, verbose=True)
|
||||
if rc == 0 and ptype is not None:
|
||||
utils.add_deploy_data("builder", ptype, local, key)
|
||||
return rc
|
||||
|
||||
def make_windows():
|
||||
global package_version, sign, machine, arch, source_dir, base_dir, \
|
||||
innosetup_file, portable_zip_file, isxdl_file
|
||||
base_dir = "base"
|
||||
isxdl_file = "exe/scripts/isxdl/isxdl.dll"
|
||||
global inno_file, zip_file, suffix, key_prefix
|
||||
utils.set_cwd("document-builder-package")
|
||||
|
||||
set_cwd(get_abspath(git_dir, build_dir))
|
||||
prefix = common.platforms[common.platform]["prefix"]
|
||||
company = branding.company_name.lower()
|
||||
product = branding.builder_product_name.replace(" ","").lower()
|
||||
source_dir = "..\\build_tools\\out\\%s\\%s\\%s" % (prefix, company, product)
|
||||
package_name = company + "_" + product
|
||||
package_version = common.version + "." + common.build
|
||||
suffixes = {
|
||||
"windows_x64": "x64",
|
||||
"windows_x86": "x86",
|
||||
"windows_x64_xp": "x64_xp",
|
||||
"windows_x86_xp": "x86_xp"
|
||||
}
|
||||
suffix = suffixes[common.platform]
|
||||
zip_file = "%s_%s_%s.zip" % (package_name, package_version, suffix)
|
||||
inno_file = "%s_%s_%s.exe" % (package_name, package_version, suffix)
|
||||
key_prefix = "%s/%s/windows/builder/%s/%s" % (branding.company_name_l, \
|
||||
common.release_branch, common.version, common.build)
|
||||
|
||||
if 'clean' in targets:
|
||||
log("\n=== Clean\n")
|
||||
delete_dir(base_dir)
|
||||
delete_files(isxdl_file)
|
||||
delete_files("exe/*.exe")
|
||||
delete_files("zip/*.zip")
|
||||
if common.clean:
|
||||
utils.log_h2("builder clean")
|
||||
utils.delete_dir("build")
|
||||
|
||||
package_version = version + '.' + build
|
||||
sign = 'sign' in targets
|
||||
utils.log_h1("copy arifacts")
|
||||
utils.create_dir("build\\app")
|
||||
utils.copy_dir_content(source_dir, "build\\app\\")
|
||||
|
||||
for target in targets:
|
||||
if not (target.startswith('innosetup') or target.startswith('portable')):
|
||||
continue
|
||||
# if "builder-zip" in common.targets:
|
||||
make_zip()
|
||||
# if "builder-inno" in common.targets:
|
||||
make_inno()
|
||||
|
||||
machine = get_platform(target)['machine']
|
||||
arch = get_platform(target)['arch']
|
||||
suffix = arch
|
||||
source_prefix = "win_" + machine
|
||||
source_dir = get_path("%s/%s/%s/%s" % (out_dir, source_prefix, company_name_l, product_name_s))
|
||||
|
||||
log("\n=== Copy arifacts\n")
|
||||
create_dir(base_dir)
|
||||
copy_dir_content(source_dir, base_dir + '\\')
|
||||
|
||||
if target.startswith('innosetup'):
|
||||
download_isxdl()
|
||||
innosetup_file = "exe/%s_%s_%s.exe" % (package_name, package_version, suffix)
|
||||
make_innosetup()
|
||||
|
||||
if target.startswith('portable'):
|
||||
portable_zip_file = "zip/%s_%s_%s.zip" % (package_name, package_version, suffix)
|
||||
make_win_portable()
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
def download_isxdl():
|
||||
log("\n=== Download isxdl\n")
|
||||
log("--- " + isxdl_file)
|
||||
if is_file(isxdl_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
create_dir(get_dirname(isxdl_file))
|
||||
download_file(isxdl_link, isxdl_file)
|
||||
def make_zip():
|
||||
utils.log_h2("builder zip build")
|
||||
utils.log_h2(zip_file)
|
||||
rc = utils.cmd("7z", "a", "-y", zip_file, ".\\app\\*",
|
||||
chdir="build", creates="build\\" + zip_file, verbose=True)
|
||||
utils.set_summary("builder zip build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("builder zip deploy")
|
||||
zip_key = key_prefix + "/" + zip_file
|
||||
rc = aws_s3_upload("build\\" + zip_file, zip_key, "Portable")
|
||||
utils.set_summary("builder zip deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_innosetup():
|
||||
log("\n=== Build innosetup project\n")
|
||||
iscc_args = [
|
||||
"/Qp",
|
||||
"/DVERSION=" + package_version,
|
||||
"/DARCH=" + arch
|
||||
def make_inno():
|
||||
utils.log_h2("builder inno build")
|
||||
utils.log_h2(inno_file)
|
||||
args = [
|
||||
"-Arch " + suffix,
|
||||
"-Version " + common.version,
|
||||
"-Build " + common.build
|
||||
]
|
||||
if not onlyoffice:
|
||||
iscc_args.append("/DBRANDING_DIR=" + get_abspath(git_dir, branding, build_dir, "exe"))
|
||||
if sign:
|
||||
iscc_args.append("/DSIGN")
|
||||
iscc_args.append("/Sbyparam=signtool.exe sign /v /n $q" + cert_name + "$q /t " + tsa_server + " $f")
|
||||
log("--- " + innosetup_file)
|
||||
if is_file(innosetup_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
set_cwd("exe")
|
||||
cmd("iscc", iscc_args + ["builder.iss"])
|
||||
set_cwd("..")
|
||||
if not branding.onlyoffice:
|
||||
args.append("-Branding '..\\..\\%s\\document-builder-package\\exe'" % common.branding)
|
||||
if common.sign:
|
||||
args.append("-Sign")
|
||||
args.append("-CertName '%s'" % branding.cert_name)
|
||||
rc = utils.ps1(".\\make_inno.ps1", args,
|
||||
creates="build\\" + inno_file, verbose=True)
|
||||
utils.set_summary("builder inno build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("builder inno deploy")
|
||||
inno_key = key_prefix + "/" + inno_file
|
||||
rc = aws_s3_upload("build\\" + inno_file, inno_key, "Installer")
|
||||
utils.set_summary("builder inno deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_win_portable():
|
||||
log("\n=== Build portable\n")
|
||||
log("--- " + portable_zip_file)
|
||||
if is_file(portable_zip_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
cmd("7z", ["a", "-y", portable_zip_file, get_path(base_dir, "*")])
|
||||
def make_linux():
|
||||
utils.set_cwd("document-builder-package")
|
||||
|
||||
utils.log_h2("builder clean")
|
||||
rc = utils.sh("make clean", verbose=True)
|
||||
utils.set_summary("builder clean", rc == 0)
|
||||
|
||||
utils.log_h2("builder build")
|
||||
args = []
|
||||
if common.platform == "linux_aarch64":
|
||||
args += ["-e", "UNAME_M=aarch64"]
|
||||
if not branding.onlyoffice:
|
||||
args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-builder-package"]
|
||||
rc = utils.sh("make packages " + " ".join(args), verbose=True)
|
||||
utils.set_summary("builder build", rc == 0)
|
||||
|
||||
key_prefix = branding.company_name_l + "/" + common.release_branch
|
||||
if common.platform == "linux_x86_64":
|
||||
rpm_arch = "x86_64"
|
||||
elif common.platform == "linux_aarch64":
|
||||
rpm_arch = "aarch64"
|
||||
if rc == 0:
|
||||
# utils.log_h2("builder tar deploy")
|
||||
# tar_file = utils.glob_file("tar/*.tar.gz")
|
||||
# tar_key = key_prefix + "/linux/" + utils.get_basename(tar_file)
|
||||
# rc = aws_s3_upload(tar_file, tar_key, "Portable")
|
||||
# utils.set_summary("builder tar deploy", rc == 0)
|
||||
|
||||
utils.log_h2("builder deb deploy")
|
||||
deb_file = utils.glob_file("deb/*.deb")
|
||||
deb_key = key_prefix + "/ubuntu/" + utils.get_basename(deb_file)
|
||||
rc = aws_s3_upload(deb_file, deb_key, "Ubuntu")
|
||||
utils.set_summary("builder deb deploy", rc == 0)
|
||||
|
||||
utils.log_h2("builder rpm deploy")
|
||||
rpm_file = utils.glob_file("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
rpm_key = key_prefix + "/centos/" + utils.get_basename(rpm_file)
|
||||
rc = aws_s3_upload(rpm_file, rpm_key, "CentOS")
|
||||
utils.set_summary("builder rpm deploy", rc == 0)
|
||||
|
||||
else:
|
||||
utils.set_summary("builder tar deploy", False)
|
||||
utils.set_summary("builder deb deploy", False)
|
||||
utils.set_summary("builder rpm deploy", False)
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
51
scripts/package_common.py
Normal file
51
scripts/package_common.py
Normal file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
platforms = {
|
||||
"windows_x64": { "title": "Windows x64", "prefix": "win_64" },
|
||||
"windows_x64_xp": { "title": "Windows x64 XP", "prefix": "win_64_xp" },
|
||||
"windows_x86": { "title": "Windows x86", "prefix": "win_32" },
|
||||
"windows_x86_xp": { "title": "Windows x86 XP", "prefix": "win_32_xp" },
|
||||
"darwin_x86_64": { "title": "macOS x86_64", "prefix": "mac_64" },
|
||||
"darwin_x86_64_v8": { "title": "macOS x86_64 V8", "prefix": "mac_64" },
|
||||
"darwin_arm64": { "title": "macOS arm64", "prefix": "mac_arm64" },
|
||||
"linux_x86_64": { "title": "Linux x86_64", "prefix": "linux_64" },
|
||||
"linux_aarch64": { "title": "Linux aarch64", "prefix": "linux_arm64" },
|
||||
"android": { "title": "Android" }
|
||||
}
|
||||
|
||||
out_dir = "build_tools/out"
|
||||
s3_bucket = "repo-doc-onlyoffice-com"
|
||||
s3_region = "eu-west-1"
|
||||
tsa_server = "http://timestamp.digicert.com"
|
||||
vcredist_links = {
|
||||
"2022": {
|
||||
"x64": {
|
||||
"url": "https://aka.ms/vs/17/release/vc_redist.x64.exe",
|
||||
"md5": "703bd677778f2a1ba1eb4338bac3b868"
|
||||
},
|
||||
"x86": {
|
||||
"url": "https://aka.ms/vs/17/release/vc_redist.x86.exe",
|
||||
"md5": "732d0ac9cd31b8136f1c8e72efec1636"
|
||||
}
|
||||
},
|
||||
"2015": {
|
||||
"x64": {
|
||||
"url": "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe",
|
||||
"md5": "27b141aacc2777a82bb3fa9f6e5e5c1c"
|
||||
},
|
||||
"x86": {
|
||||
"url": "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe",
|
||||
"md5": "1a15e6606bac9647e7ad3caa543377cf"
|
||||
}
|
||||
},
|
||||
"2013": {
|
||||
"x64": {
|
||||
"url": "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe",
|
||||
"md5": "96b61b8e069832e6b809f24ea74567ba"
|
||||
},
|
||||
"x86": {
|
||||
"url": "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe",
|
||||
"md5": "0fc525b6b7b96a87523daa7a0013c69d"
|
||||
}
|
||||
}
|
||||
}
|
||||
59
scripts/package_core.py
Normal file
59
scripts/package_core.py
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import package_utils as utils
|
||||
import package_common as common
|
||||
import package_branding as branding
|
||||
|
||||
def make():
|
||||
utils.log_h1("CORE")
|
||||
if not (utils.is_windows() or utils.is_macos() or utils.is_linux()):
|
||||
utils.log("Unsupported host OS")
|
||||
return
|
||||
if common.deploy:
|
||||
make_core()
|
||||
return
|
||||
|
||||
def make_core():
|
||||
prefix = common.platforms[common.platform]["prefix"]
|
||||
company = branding.company_name.lower()
|
||||
repos = {
|
||||
"windows_x64": { "repo": "windows", "arch": "x64", "version": common.version + "." + common.build },
|
||||
"windows_x86": { "repo": "windows", "arch": "x86", "version": common.version + "." + common.build },
|
||||
"darwin_x86_64": { "repo": "mac", "arch": "x64", "version": common.version + "-" + common.build },
|
||||
"darwin_arm64": { "repo": "mac", "arch": "arm", "version": common.version + "-" + common.build },
|
||||
"linux_x86_64": { "repo": "linux", "arch": "x64", "version": common.version + "-" + common.build },
|
||||
}
|
||||
repo = repos[common.platform]
|
||||
branch = utils.get_env("BRANCH_NAME")
|
||||
core_7z = utils.get_path("build_tools/out/%s/%s/core.7z" % (prefix, company))
|
||||
dest_version = "%s/core/%s/%s/%s/" % (repo["repo"], branch, repo["version"], repo["arch"])
|
||||
dest_latest = "%s/core/%s/%s/%s/" % (repo["repo"], branch, "latest", repo["arch"])
|
||||
|
||||
if branch is None:
|
||||
utils.log_err("BRANCH_NAME variable is undefined")
|
||||
utils.set_summary("core deploy", False)
|
||||
return
|
||||
if not utils.is_file(core_7z):
|
||||
utils.log_err("core.7z does not exist")
|
||||
utils.set_summary("core deploy", False)
|
||||
return
|
||||
|
||||
utils.log_h2("core deploy")
|
||||
args = ["aws", "s3", "cp", "--acl", "public-read", "--no-progress",
|
||||
core_7z, "s3://" + common.s3_bucket + "/" + dest_version + "core.7z"]
|
||||
if common.os_family == "windows":
|
||||
rc = utils.cmd(*args, verbose=True)
|
||||
else:
|
||||
rc = utils.sh(" ".join(args), verbose=True)
|
||||
if rc == 0:
|
||||
utils.add_deploy_data("core", "Archive", core_7z, dest_version + "core.7z")
|
||||
args = ["aws", "s3", "sync", "--delete",
|
||||
"--acl", "public-read", "--no-progress",
|
||||
"s3://" + common.s3_bucket + "/" + dest_version,
|
||||
"s3://" + common.s3_bucket + "/" + dest_latest]
|
||||
if common.os_family == "windows":
|
||||
rc = utils.cmd(*args, verbose=True)
|
||||
else:
|
||||
rc = utils.sh(" ".join(args), verbose=True)
|
||||
utils.set_summary("core deploy", rc == 0)
|
||||
return
|
||||
@ -2,239 +2,317 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from package_utils import *
|
||||
from package_branding import *
|
||||
import package_utils as utils
|
||||
import package_common as common
|
||||
import package_branding as branding
|
||||
|
||||
def make():
|
||||
if system == 'windows':
|
||||
utils.log_h1("DESKTOP")
|
||||
if utils.is_windows():
|
||||
make_windows()
|
||||
elif system == 'darwin':
|
||||
elif utils.is_macos():
|
||||
make_macos()
|
||||
elif system == 'linux':
|
||||
if 'packages' in targets:
|
||||
set_cwd(build_dir)
|
||||
log("Clean")
|
||||
cmd("make", ["clean"])
|
||||
log("Build packages")
|
||||
cmd("make", ["packages"])
|
||||
elif utils.is_linux():
|
||||
make_linux()
|
||||
else:
|
||||
exit(1)
|
||||
utils.log("Unsupported host OS")
|
||||
return
|
||||
|
||||
def aws_s3_upload(local, key, ptype=None):
|
||||
if common.os_family == "windows":
|
||||
rc = utils.cmd(
|
||||
"aws", "s3", "cp", "--acl", "public-read", "--no-progress",
|
||||
local, "s3://" + common.s3_bucket + "/" + key,
|
||||
verbose=True
|
||||
)
|
||||
else:
|
||||
rc = utils.sh("aws s3 cp --acl public-read --no-progress " \
|
||||
+ local + " s3://" + common.s3_bucket + "/" + key, verbose=True)
|
||||
if rc == 0 and ptype is not None:
|
||||
utils.add_deploy_data("desktop", ptype, local, key)
|
||||
return rc
|
||||
|
||||
#
|
||||
# Windows
|
||||
#
|
||||
|
||||
def make_windows():
|
||||
global package_version, sign, machine, arch, xp, iscc_args, source_dir, \
|
||||
innosetup_file, innosetup_update_file, advinst_file, portable_zip_file
|
||||
global package_version, iscc_args, source_dir, arch_list, inno_arch_list, \
|
||||
inno_file, inno_update_file, msi_file, zip_file, key_prefix
|
||||
utils.set_cwd("desktop-apps\\win-linux\\package\\windows")
|
||||
|
||||
set_cwd(get_abspath(git_dir, build_dir))
|
||||
prefix = common.platforms[common.platform]["prefix"]
|
||||
company = branding.company_name.lower()
|
||||
product = branding.desktop_product_name.replace(" ","").lower()
|
||||
package_name = branding.desktop_package_name
|
||||
package_version = common.version + "." + common.build
|
||||
source_dir = "..\\..\\..\\..\\build_tools\\out\\%s\\%s\\%s" % (prefix, company, product)
|
||||
arch_list = {
|
||||
"windows_x64": "x64",
|
||||
"windows_x64_xp": "x64",
|
||||
"windows_x86": "x86",
|
||||
"windows_x86_xp": "x86"
|
||||
}
|
||||
inno_arch_list = {
|
||||
"windows_x64": "64",
|
||||
"windows_x86": "32",
|
||||
"windows_x64_xp": "64",
|
||||
"windows_x86_xp": "32"
|
||||
}
|
||||
suffix = arch_list[common.platform]
|
||||
if common.platform.endswith("_xp"): suffix += "_xp"
|
||||
zip_file = "%s_%s_%s.zip" % (package_name, package_version, suffix)
|
||||
inno_file = "%s_%s_%s.exe" % (package_name, package_version, suffix)
|
||||
inno_update_file = "update\\editors_update_%s.exe" % suffix
|
||||
msi_file = "%s_%s_%s.msi" % (package_name, package_version, suffix)
|
||||
key_prefix = "%s/%s/windows/desktop/%s/%s" % (branding.company_name_l, \
|
||||
common.release_branch, common.version, common.build)
|
||||
|
||||
if 'clean' in targets:
|
||||
log("\n=== Clean\n")
|
||||
delete_dir(get_path("data/vcredist"))
|
||||
delete_dir("DesktopEditors-cache")
|
||||
delete_files("*.exe")
|
||||
delete_files("*.msi")
|
||||
delete_files("*.aic")
|
||||
delete_files("*.tmp")
|
||||
delete_files("*.zip")
|
||||
delete_files(get_path("update/*.exe"))
|
||||
delete_files(get_path("update/*.xml"))
|
||||
delete_files(get_path("update/*.html"))
|
||||
if common.clean:
|
||||
utils.log_h2("desktop clean")
|
||||
# utils.delete_dir("data\\vcredist")
|
||||
utils.delete_dir("DesktopEditors-cache")
|
||||
utils.delete_files("*.exe")
|
||||
utils.delete_files("*.msi")
|
||||
utils.delete_files("*.aic")
|
||||
utils.delete_files("*.tmp")
|
||||
utils.delete_files("*.zip")
|
||||
utils.delete_files("update\\*.exe")
|
||||
utils.delete_files("update\\*.xml")
|
||||
utils.delete_files("update\\*.html")
|
||||
|
||||
package_version = version + '.' + build
|
||||
sign = 'sign' in targets
|
||||
make_zip()
|
||||
|
||||
for target in targets:
|
||||
if not (target.startswith('innosetup') or target.startswith('advinst') or
|
||||
target.startswith('portable')):
|
||||
continue
|
||||
vcdl = True
|
||||
vcdl &= download_vcredist("2013")
|
||||
vcdl &= download_vcredist("2022")
|
||||
|
||||
machine = get_platform(target)['machine']
|
||||
arch = get_platform(target)['arch']
|
||||
xp = get_platform(target)['xp']
|
||||
suffix = arch + ("_xp" if xp else "")
|
||||
source_prefix = "win_" + machine + ("_xp" if xp else "")
|
||||
source_dir = get_path("%s/%s/%s/%s" % (out_dir, source_prefix, company_name_l, product_name_s))
|
||||
if not vcdl:
|
||||
utils.set_summary("desktop inno build", False)
|
||||
utils.set_summary("desktop inno update build", False)
|
||||
utils.set_summary("desktop advinst build", False)
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
if target.startswith('innosetup'):
|
||||
for year in vcredist_list:
|
||||
download_vcredist(year)
|
||||
make_inno()
|
||||
make_inno_update()
|
||||
|
||||
innosetup_file = "%s_%s_%s.exe" % (package_name, package_version, suffix)
|
||||
make_innosetup()
|
||||
if common.platform == "windows_x64":
|
||||
make_winsparkle_files()
|
||||
|
||||
if 'winsparkle-update' in targets:
|
||||
innosetup_update_file = get_path("update/editors_update_%s.exe" % suffix)
|
||||
make_innosetup_update()
|
||||
if common.platform in ["windows_x64", "windows_x86"]:
|
||||
make_msi()
|
||||
|
||||
if 'winsparkle-files' in targets:
|
||||
make_winsparkle_files()
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
if target.startswith('advinst'):
|
||||
advinst_file = "%s_%s_%s.msi" % (package_name, package_version, suffix)
|
||||
make_advinst()
|
||||
|
||||
if target.startswith('portable'):
|
||||
portable_zip_file = "%s_%s_%s.zip" % (package_name, package_version, suffix)
|
||||
make_win_portable()
|
||||
def make_zip():
|
||||
utils.log_h2("desktop zip build")
|
||||
rc = utils.cmd(
|
||||
"7z", "a", "-y", zip_file, source_dir + "\\*",
|
||||
creates=zip_file,
|
||||
verbose=True
|
||||
)
|
||||
utils.set_summary("desktop zip build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop zip deploy")
|
||||
zip_key = key_prefix + "/" + utils.get_basename(zip_file)
|
||||
rc = aws_s3_upload(zip_file, zip_key, "Portable")
|
||||
utils.set_summary("desktop zip deploy", rc == 0)
|
||||
return
|
||||
|
||||
def download_vcredist(year):
|
||||
log("\n=== Download vcredist " + year + "\n")
|
||||
vcredist = get_path("data/vcredist/vcredist_%s_%s.exe" % (year, arch))
|
||||
log("--- " + vcredist)
|
||||
if is_file(vcredist):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
create_dir(get_dirname(vcredist))
|
||||
download_file(vcredist_links[year][machine], vcredist)
|
||||
return
|
||||
utils.log_h2("vcredist " + year + " download")
|
||||
|
||||
def make_innosetup():
|
||||
log("\n=== Build innosetup project\n")
|
||||
arch = arch_list[common.platform]
|
||||
link = common.vcredist_links[year][arch]["url"]
|
||||
md5 = common.vcredist_links[year][arch]["md5"]
|
||||
vcredist_file = "data\\vcredist\\vcredist_%s_%s.exe" % (year, arch)
|
||||
|
||||
utils.log_h2(vcredist_file)
|
||||
utils.create_dir(utils.get_dirname(vcredist_file))
|
||||
rc = utils.download_file(link, vcredist_file, md5, verbose=True)
|
||||
utils.set_summary("vcredist " + year + " download", rc == 0)
|
||||
return rc == 0
|
||||
|
||||
def make_inno():
|
||||
global iscc_args
|
||||
utils.log_h2("desktop inno build")
|
||||
utils.log_h2(inno_file)
|
||||
|
||||
iscc_args = [
|
||||
"/Qp",
|
||||
# "/Qp",
|
||||
"/DsAppVersion=" + package_version,
|
||||
"/DDEPLOY_PATH=" + source_dir,
|
||||
"/D_ARCH=" + machine
|
||||
"/D_ARCH=" + inno_arch_list[common.platform]
|
||||
]
|
||||
if onlyoffice:
|
||||
if branding.onlyoffice:
|
||||
iscc_args.append("/D_ONLYOFFICE=1")
|
||||
else:
|
||||
iscc_args.append("/DsBrandingFolder=" + get_abspath(git_dir, branding_dir))
|
||||
if xp:
|
||||
iscc_args.append("/DsBrandingFolder=" + \
|
||||
utils.get_abspath(common.workspace_dir + "\\" + common.branding + "\\desktop-apps"))
|
||||
if common.platform in ["windows_x64_xp", "windows_x86_xp"]:
|
||||
iscc_args.append("/D_WIN_XP=1")
|
||||
if sign:
|
||||
if common.sign:
|
||||
iscc_args.append("/DENABLE_SIGNING=1")
|
||||
iscc_args.append("/Sbyparam=signtool.exe sign /v /n $q" + cert_name + "$q /t " + tsa_server + " $f")
|
||||
log("--- " + innosetup_file)
|
||||
if is_file(innosetup_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
cmd("iscc", iscc_args + ["common.iss"])
|
||||
iscc_args.append("/Sbyparam=signtool.exe sign /v /n $q" + \
|
||||
branding.cert_name + "$q /t " + common.tsa_server + " $f")
|
||||
args = ["iscc"] + iscc_args + ["common.iss"]
|
||||
rc = utils.cmd(*args, creates=inno_file, verbose=True)
|
||||
utils.set_summary("desktop inno build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop inno deploy")
|
||||
inno_key = key_prefix + "/" + utils.get_basename(inno_file)
|
||||
rc = aws_s3_upload(inno_file, inno_key, "Installer")
|
||||
utils.set_summary("desktop inno deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_innosetup_update():
|
||||
log("\n=== Build innosetup update project\n")
|
||||
log("--- " + innosetup_update_file)
|
||||
if is_file(innosetup_update_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
cmd("iscc", iscc_args + ["/DTARGET_NAME=" + innosetup_file, "update_common.iss"])
|
||||
def make_inno_update():
|
||||
utils.log_h2("desktop inno update build")
|
||||
utils.log_h2(inno_update_file)
|
||||
|
||||
args = ["iscc"] + iscc_args + ["/DTARGET_NAME=" + inno_file, "update_common.iss"]
|
||||
rc = utils.cmd(*args, creates=inno_update_file, verbose=True)
|
||||
utils.set_summary("desktop inno update build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop inno update deploy")
|
||||
inno_update_key = key_prefix + "/" + utils.get_basename(inno_update_file)
|
||||
rc = aws_s3_upload(inno_update_file, inno_update_key, "WinSparkle")
|
||||
utils.set_summary("desktop inno update deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_winsparkle_files():
|
||||
log("\n=== Build winsparkle files\n")
|
||||
utils.log_h2("desktop winsparkle files build")
|
||||
|
||||
awk_branding = "update/branding.awk"
|
||||
if not onlyoffice:
|
||||
build_branding_dir = get_abspath(git_dir, branding_dir, "win-linux/package/windows")
|
||||
if branding.onlyoffice:
|
||||
awk_branding = "update/branding.awk"
|
||||
else:
|
||||
build_branding_dir = get_path(".")
|
||||
awk_branding = "../../../../" + common.branding + \
|
||||
"/desktop-apps/win-linux/package/windows/update/branding.awk"
|
||||
awk_args = [
|
||||
"-v", "Version=" + version,
|
||||
"-v", "Build=" + build,
|
||||
"-v", "Branch=" + get_env("RELEASE_BRANCH"),
|
||||
"-v", "Timestamp=" + timestamp,
|
||||
"-i", get_path(build_branding_dir, awk_branding)
|
||||
"-v", "Version=" + common.version,
|
||||
"-v", "Build=" + common.build,
|
||||
"-v", "Branch=" + common.release_branch,
|
||||
"-v", "Timestamp=" + common.timestamp,
|
||||
"-i", awk_branding
|
||||
]
|
||||
|
||||
appcast = get_path("update/appcast.xml")
|
||||
log("--- " + appcast)
|
||||
if is_file(appcast):
|
||||
log("! file exist, skip")
|
||||
else:
|
||||
command = "env LANG=en_US.UTF-8 awk " + \
|
||||
' '.join(awk_args) + " -f update/appcast.xml.awk"
|
||||
appcast_result = proc_open(command)
|
||||
if appcast_result['stderr'] != "":
|
||||
log("! error: " + appcast_result['stderr'])
|
||||
write_file(appcast, appcast_result['stdout'])
|
||||
appcast = "update/appcast.xml"
|
||||
utils.log_h2(appcast)
|
||||
args = ["env", "LANG=en_US.UTF-8", "awk"] + \
|
||||
awk_args + ["-f", "update/appcast.xml.awk"]
|
||||
appcast_result = utils.cmd_output(*args, verbose=True)
|
||||
utils.write_file(appcast, appcast_result)
|
||||
|
||||
appcast_prod = get_path("update/appcast-prod.xml")
|
||||
log("--- " + appcast_prod)
|
||||
if is_file(appcast_prod):
|
||||
log("! file exist, skip")
|
||||
else:
|
||||
command = "env LANG=en_US.UTF-8 awk -v Prod=1 " + \
|
||||
' '.join(awk_args) + " -f update/appcast.xml.awk"
|
||||
appcast_result = proc_open(command)
|
||||
if appcast_result['stderr'] != "":
|
||||
log("! error: " + appcast_result['stderr'])
|
||||
write_file(appcast_prod, appcast_result['stdout'])
|
||||
appcast_prod = "update/appcast-prod.xml"
|
||||
utils.log_h2(appcast_prod)
|
||||
args = ["env", "LANG=en_US.UTF-8", "awk", "-v", "Prod=1"] + \
|
||||
awk_args + ["-f", "update/appcast.xml.awk"]
|
||||
appcast_result = utils.cmd_output(*args, verbose=True)
|
||||
utils.write_file(appcast_prod, appcast_result)
|
||||
|
||||
changes_dir = get_path(build_branding_dir, "update/changes", version)
|
||||
for lang, base in update_changes_list.items():
|
||||
changes = get_path("update/" + base + ".html")
|
||||
if lang == 'en': encoding = 'en_US.UTF-8'
|
||||
elif lang == 'ru': encoding = 'ru_RU.UTF-8'
|
||||
log("--- " + changes)
|
||||
if is_file(changes):
|
||||
log("! file exist, skip")
|
||||
if branding.onlyoffice:
|
||||
changes_dir = "update/changes/" + common.version
|
||||
else:
|
||||
changes_dir = "../../../../" + common.branding + \
|
||||
"/desktop-apps/win-linux/package/windows/update/changes/" + common.version
|
||||
for lang, base in branding.desktop_update_changes_list.items():
|
||||
changes = "update/%s.html" % base
|
||||
if lang == "en": encoding = "en_US.UTF-8"
|
||||
elif lang == "ru": encoding = "ru_RU.UTF-8"
|
||||
utils.log_h2(changes)
|
||||
changes_file = "%s/%s.html" % (changes_dir, lang)
|
||||
args = ["env", "LANG=" + encoding, "awk"] + awk_args + \
|
||||
["-f", "update/changes.html.awk", changes_file]
|
||||
|
||||
if utils.is_exist(changes_file):
|
||||
changes_result = utils.cmd_output(*args, verbose=True)
|
||||
print(changes_result)
|
||||
utils.write_file(changes, changes_result)
|
||||
else:
|
||||
command = "env LANG=" + encoding + " awk " + ' '.join(awk_args) + \
|
||||
" -f update\\changes.html.awk " + changes_dir + "\\" + lang + ".html"
|
||||
changes_result = proc_open(command)
|
||||
if changes_result['stderr'] != "":
|
||||
log("! error: " + changes_result['stderr'])
|
||||
write_file(changes, changes_result['stdout'])
|
||||
utils.log("! file not exist: " + changes_file)
|
||||
|
||||
utils.log_h2("desktop winsparkle files deploy")
|
||||
rc = 0
|
||||
|
||||
appcast_key = key_prefix + "/" + utils.get_basename(appcast)
|
||||
rc_appcast = aws_s3_upload(appcast, appcast_key, "WinSparkle")
|
||||
rc += rc_appcast
|
||||
|
||||
appcast_prod_key = key_prefix + "/" + utils.get_basename(appcast_prod)
|
||||
rc_appcast_prod = aws_s3_upload(appcast_prod, appcast_prod_key, "WinSparkle")
|
||||
rc += rc_appcast_prod
|
||||
|
||||
for lang, base in branding.desktop_update_changes_list.items():
|
||||
changes_file = "update/%s.html" % base
|
||||
changes_key = key_prefix + "/" + utils.get_basename(changes_file)
|
||||
if utils.is_exist(changes_file):
|
||||
rc_changes = aws_s3_upload(changes_file, changes_key, "WinSparkle")
|
||||
rc += rc_changes
|
||||
|
||||
utils.set_summary("desktop winsparkle files deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_advinst():
|
||||
log("\n=== Build advanced installer project\n")
|
||||
log("--- " + advinst_file)
|
||||
if is_file(advinst_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
if not onlyoffice:
|
||||
branding_path = get_abspath(git_dir, branding_dir)
|
||||
copy_dir_content(
|
||||
branding_path + "\\win-linux\\package\\windows\\data", "data", ".bmp")
|
||||
copy_dir_content(
|
||||
branding_path + "\\win-linux\\package\\windows\\data", "data", ".png")
|
||||
copy_dir_content(
|
||||
branding_path + "\\win-linux\\extras\\projicons\\res",
|
||||
def make_msi():
|
||||
utils.log_h2("desktop msi build")
|
||||
utils.log_h2(msi_file)
|
||||
|
||||
arch = arch_list[common.platform]
|
||||
|
||||
if not branding.onlyoffice:
|
||||
branding_path = common.workspace_dir + "\\" + common.branding
|
||||
utils.copy_dir_content(
|
||||
branding_path + "\\desktop-apps\\win-linux\\package\\windows\\data", "data", ".bmp")
|
||||
utils.copy_dir_content(
|
||||
branding_path + "\\desktop-apps\\win-linux\\package\\windows\\data", "data", ".png")
|
||||
utils.copy_dir_content(
|
||||
branding_path + "\\desktop-apps\\win-linux\\extras\\projicons\\res",
|
||||
"..\\..\\extras\\projicons\\res", ".ico")
|
||||
copy_file(
|
||||
branding_path + "\\win-linux\\package\\windows\\dictionary.ail",
|
||||
utils.copy_file(
|
||||
branding_path + "\\desktop-apps\\win-linux\\package\\windows\\dictionary.ail",
|
||||
"dictionary.ail")
|
||||
copy_file(
|
||||
branding_path + "\\common\\package\\license\\eula_" + branding + ".rtf",
|
||||
utils.copy_file(
|
||||
branding_path + "\\desktop-apps\\common\\package\\license\\eula_" + common.branding + ".rtf",
|
||||
"..\\..\\..\\common\\package\\license\\agpl-3.0.rtf")
|
||||
copy_file(
|
||||
branding_path + "\\..\\multimedia\\videoplayer\\icons\\" + branding + ".ico",
|
||||
utils.copy_file(
|
||||
branding_path + "\\multimedia\\videoplayer\\icons\\" + common.branding + ".ico",
|
||||
"..\\..\\extras\\projicons\\res\\media.ico")
|
||||
copy_file(
|
||||
branding_path + "\\..\\multimedia\\imageviewer\\icons\\ico\\" + branding + ".ico",
|
||||
utils.copy_file(
|
||||
branding_path + "\\multimedia\\imageviewer\\icons\\ico\\" + common.branding + ".ico",
|
||||
"..\\..\\extras\\projicons\\res\\gallery.ico")
|
||||
|
||||
aic_content = [";aic"]
|
||||
if not sign:
|
||||
if not common.sign:
|
||||
aic_content += [
|
||||
"ResetSig"
|
||||
]
|
||||
if machine == '32':
|
||||
if arch == "x86":
|
||||
aic_content += [
|
||||
"SetPackageType x86",
|
||||
"SetAppdir -buildname DefaultBuild -path [ProgramFilesFolder][MANUFACTURER_INSTALL_FOLDER]\\[PRODUCT_INSTALL_FOLDER]",
|
||||
'DelPrerequisite "Microsoft Visual C++ 2015-2022 Redistributable (x64)"',
|
||||
'DelPrerequisite "Microsoft Visual C++ 2013 Redistributable (x64)"'
|
||||
]
|
||||
if machine == '64':
|
||||
if arch == "x64":
|
||||
aic_content += [
|
||||
'DelPrerequisite "Microsoft Visual C++ 2015-2022 Redistributable (x86)"',
|
||||
'DelPrerequisite "Microsoft Visual C++ 2013 Redistributable (x86)"'
|
||||
]
|
||||
if onlyoffice:
|
||||
if branding.onlyoffice:
|
||||
aic_content += [
|
||||
"DelFolder CUSTOM_PATH"
|
||||
]
|
||||
else:
|
||||
utils.replace_in_file('DesktopEditors.aip','(<ROW Property="UpgradeCode" Value=")(.*)("/>)', r'\1%s\3' % (branding.desktop_upgrade_code))
|
||||
aic_content += [
|
||||
"AddUpgradeCode {47EEF706-B0E4-4C43-944B-E5F914B92B79} \
|
||||
-min_ver 7.1.1 -include_min_ver \
|
||||
-max_ver 7.2.2 -include_max_ver \
|
||||
-include_lang 1049 \
|
||||
-property_name UPGRADE_2 -enable_migrate",
|
||||
"DelLanguage 1029 -buildname DefaultBuild",
|
||||
"DelLanguage 1031 -buildname DefaultBuild",
|
||||
"DelLanguage 1041 -buildname DefaultBuild",
|
||||
@ -244,30 +322,30 @@ def make_advinst():
|
||||
"DelLanguage 1036 -buildname DefaultBuild",
|
||||
"DelLanguage 3082 -buildname DefaultBuild",
|
||||
"DelLanguage 1033 -buildname DefaultBuild",
|
||||
"SetCurrentFeature ExtendedFeature",
|
||||
"NewSync CUSTOM_PATH " + source_dir + "\\..\\MediaViewer",
|
||||
"UpdateFile CUSTOM_PATH\\ImageViewer.exe " + source_dir + "\\..\\MediaViewer\\ImageViewer.exe",
|
||||
"UpdateFile CUSTOM_PATH\\VideoPlayer.exe " + source_dir + "\\..\\MediaViewer\\VideoPlayer.exe"
|
||||
]
|
||||
aic_content += [
|
||||
"AddOsLc -buildname DefaultBuild -arch " + arch,
|
||||
"SetCurrentFeature MainFeature",
|
||||
"NewSync APPDIR " + source_dir,
|
||||
"UpdateFile APPDIR\\DesktopEditors.exe " + source_dir + "\\DesktopEditors.exe",
|
||||
"SetVersion " + package_version,
|
||||
"SetPackageName " + advinst_file + " -buildname DefaultBuild",
|
||||
"SetPackageName " + msi_file + " -buildname DefaultBuild",
|
||||
"Rebuild -buildslist DefaultBuild"
|
||||
]
|
||||
write_file("DesktopEditors.aic", "\r\n".join(aic_content), 'utf-8-sig')
|
||||
cmd("AdvancedInstaller.com",
|
||||
["/execute", "DesktopEditors.aip", "DesktopEditors.aic"])
|
||||
return
|
||||
utils.write_file("DesktopEditors.aic", "\r\n".join(aic_content), "utf-8-sig")
|
||||
rc = utils.cmd("AdvancedInstaller.com", "/execute", \
|
||||
"DesktopEditors.aip", "DesktopEditors.aic", verbose=True)
|
||||
utils.set_summary("desktop msi build", rc == 0)
|
||||
|
||||
def make_win_portable():
|
||||
log("\n=== Build portable\n")
|
||||
log("--- " + portable_zip_file)
|
||||
if is_file(portable_zip_file):
|
||||
log("! file exist, skip")
|
||||
return
|
||||
cmd("7z", ["a", "-y", portable_zip_file, get_path(source_dir, "*")])
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop msi deploy")
|
||||
msi_key = key_prefix + "/" + utils.get_basename(msi_file)
|
||||
rc = aws_s3_upload(msi_file, msi_key, "Installer")
|
||||
utils.set_summary("desktop msi deploy", rc == 0)
|
||||
return
|
||||
|
||||
#
|
||||
@ -275,105 +353,263 @@ def make_win_portable():
|
||||
#
|
||||
|
||||
def make_macos():
|
||||
global suffix, lane, scheme
|
||||
global package_name, build_dir, branding_dir, updates_dir, changes_dir, \
|
||||
update_changes_list, suffix, lane, scheme, key_prefix
|
||||
package_name = branding.desktop_package_name
|
||||
build_dir = branding.desktop_build_dir
|
||||
branding_dir = branding.desktop_branding_dir
|
||||
updates_dir = branding.desktop_updates_dir
|
||||
changes_dir = branding.desktop_changes_dir
|
||||
update_changes_list = branding.desktop_update_changes_list
|
||||
suffixes = {
|
||||
"darwin_x86_64": "x86_64",
|
||||
"darwin_x86_64_v8": "v8",
|
||||
"darwin_arm64": "arm"
|
||||
}
|
||||
suffix = suffixes[common.platform]
|
||||
lane = "release_" + suffix
|
||||
scheme = package_name + "-" + suffix
|
||||
key_prefix = "%s/%s/macos/%s/%s/%s" % (branding.company_name_l, \
|
||||
common.release_branch, suffix, common.version, common.build)
|
||||
|
||||
set_cwd(git_dir + "/" + branding_build_dir)
|
||||
utils.set_cwd(build_dir)
|
||||
|
||||
if 'clean' in targets:
|
||||
log("\n=== Clean\n")
|
||||
delete_dir(get_env("HOME") + "/Library/Developer/Xcode/Archives")
|
||||
delete_dir(get_env("HOME") + "/Library/Caches/Sparkle_generate_appcast")
|
||||
if common.clean:
|
||||
utils.log("\n=== Clean\n")
|
||||
utils.delete_dir(utils.get_env("HOME") + "/Library/Developer/Xcode/Archives")
|
||||
utils.delete_dir(utils.get_env("HOME") + "/Library/Caches/Sparkle_generate_appcast")
|
||||
|
||||
for target in targets:
|
||||
if not target.startswith('diskimage'):
|
||||
continue
|
||||
plist_path = "%s/%s/ONLYOFFICE/Resources/%s-%s/Info.plist" \
|
||||
% (common.workspace_dir, branding.desktop_branding_dir, branding.desktop_package_name, suffix)
|
||||
current_version = utils.sh_output(
|
||||
'/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ' + plist_path,
|
||||
verbose=True).rstrip()
|
||||
current_build = utils.sh_output(
|
||||
'/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ' + plist_path,
|
||||
verbose=True).rstrip()
|
||||
|
||||
if target.startswith('diskimage'):
|
||||
if (target == 'diskimage-x86_64'): suffix = 'x86_64'
|
||||
elif (target == 'diskimage-x86_64-v8'): suffix = 'v8'
|
||||
elif (target == 'diskimage-arm64'): suffix = 'arm'
|
||||
else: exit(1)
|
||||
lane = "release_" + suffix
|
||||
scheme = package_name + '-' + suffix
|
||||
appcast_url = branding.sparkle_base_url + "/" + suffix + "/" + branding.desktop_package_name.lower() + ".xml"
|
||||
release_version = utils.sh_output(
|
||||
'curl -s ' + appcast_url + ' 2> /dev/null' \
|
||||
+ ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:shortVersionString\']" -' \
|
||||
+ ' | cut -f2 -d\\\"',
|
||||
verbose=True).rstrip()
|
||||
release_build = utils.sh_output(
|
||||
'curl -s ' + appcast_url + ' 2> /dev/null' \
|
||||
+ ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:version\']" -' \
|
||||
+ ' | cut -f2 -d\\\"',
|
||||
verbose=True).rstrip()
|
||||
|
||||
make_diskimage(target)
|
||||
utils.log("CURRENT=" + current_version + "(" + current_build + ")" \
|
||||
+ "\nRELEASE=" + release_version + "(" + release_build + ")")
|
||||
|
||||
if ('sparkle-updates' in targets):
|
||||
make_sparkle_updates()
|
||||
make_dmg()
|
||||
if int(current_build) > int(release_build):
|
||||
make_sparkle_updates()
|
||||
else:
|
||||
utils.log(release_build + " <= " + current_build)
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
def make_diskimage(target):
|
||||
log("\n=== Build package " + scheme + "\n")
|
||||
log("--- build/" + package_name + ".app")
|
||||
cmd("bundler", ["exec", "fastlane", lane, "skip_git_bump:true"])
|
||||
def make_dmg():
|
||||
utils.log_h2("desktop dmg build")
|
||||
utils.log_h2(scheme)
|
||||
utils.log_h2("build/" + package_name + ".app")
|
||||
rc = utils.sh(
|
||||
"bundler exec fastlane " + lane + " skip_git_bump:true",
|
||||
verbose=True
|
||||
)
|
||||
utils.set_summary("desktop dmg build", rc == 0)
|
||||
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop dmg deploy")
|
||||
dmg_file = utils.glob_file("build/*.dmg")
|
||||
dmg_key = key_prefix + "/" + utils.get_basename(dmg_file)
|
||||
rc = aws_s3_upload(dmg_file, dmg_key, "Disk Image")
|
||||
utils.set_summary("desktop msi deploy", rc == 0)
|
||||
return
|
||||
|
||||
def make_sparkle_updates():
|
||||
log("\n=== Build sparkle updates\n")
|
||||
utils.log_h2("desktop sparkle files build")
|
||||
|
||||
app_version = proc_open("/usr/libexec/PlistBuddy \
|
||||
-c 'print :CFBundleShortVersionString' \
|
||||
build/" + package_name + ".app/Contents/Info.plist")['stdout']
|
||||
app_version = utils.sh_output("/usr/libexec/PlistBuddy \
|
||||
-c 'Print :CFBundleShortVersionString' \
|
||||
build/" + package_name + ".app/Contents/Info.plist", verbose=True)
|
||||
zip_filename = scheme + '-' + app_version
|
||||
macos_zip = "build/" + zip_filename + ".zip"
|
||||
updates_storage_dir = "%s/%s/_updates" % (get_env('ARCHIVES_DIR'), scheme)
|
||||
create_dir(updates_dir)
|
||||
copy_dir_content(updates_storage_dir, updates_dir, ".zip")
|
||||
# copy_dir_content(updates_storage_dir, updates_dir, ".html")
|
||||
copy_file(macos_zip, updates_dir)
|
||||
updates_storage_dir = "%s/%s/_updates" % (utils.get_env('ARCHIVES_DIR'), scheme)
|
||||
utils.create_dir(updates_dir)
|
||||
utils.copy_dir_content(updates_storage_dir, updates_dir, ".zip")
|
||||
# utils.copy_dir_content(updates_storage_dir, updates_dir, ".html")
|
||||
utils.copy_file(macos_zip, updates_dir)
|
||||
|
||||
if "en" in update_changes_list:
|
||||
notes_src = "%s/%s/%s.html" % (changes_dir, app_version, update_changes_list["en"])
|
||||
if is_file(notes_src):
|
||||
if utils.is_file(notes_src):
|
||||
notes_dst = "%s/%s.html" % (updates_dir, zip_filename)
|
||||
copy_file(notes_src, notes_dst)
|
||||
cur_date = sh_output("env LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"", verbose=True)
|
||||
replace_in_file(notes_dst,
|
||||
r"(<span class=\"releasedate\">).+(</span>)",
|
||||
"\\1 - " + cur_date + "\\2")
|
||||
utils.copy_file(notes_src, notes_dst)
|
||||
cur_date = utils.sh_output("env LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"", verbose=True)
|
||||
utils.replace_in_file(notes_dst,
|
||||
r"(<span class=\"releasedate\">).+(</span>)",
|
||||
"\\1 - " + cur_date + "\\2")
|
||||
else:
|
||||
write_file(notes_dst, '<html></html>\n')
|
||||
utils.write_file(notes_dst, '<html></html>\n')
|
||||
|
||||
if "ru" in update_changes_list:
|
||||
notes_src = "%s/%s/%s.html" % (changes_dir, app_version, update_changes_list["ru"])
|
||||
if is_file(notes_src):
|
||||
if utils.is_file(notes_src):
|
||||
if update_changes_list["ru"] != "ReleaseNotes":
|
||||
notes_dst = "%s/%s.ru.html" % (updates_dir, zip_filename)
|
||||
else:
|
||||
notes_dst = "%s/%s.html" % (updates_dir, zip_filename)
|
||||
copy_file(notes_src, notes_dst)
|
||||
cur_date = sh_output("env LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"", verbose=True)
|
||||
replace_in_file(notes_dst,
|
||||
r"(<span class=\"releasedate\">).+(</span>)",
|
||||
"\\1 - " + cur_date + "\\2")
|
||||
utils.copy_file(notes_src, notes_dst)
|
||||
cur_date = utils.sh_output("env LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"", verbose=True)
|
||||
utils.replace_in_file(notes_dst,
|
||||
r"(<span class=\"releasedate\">).+(</span>)",
|
||||
"\\1 - " + cur_date + "\\2")
|
||||
else:
|
||||
write_file(notes_dst, '<html></html>\n')
|
||||
utils.write_file(notes_dst, '<html></html>\n')
|
||||
|
||||
sparkle_download_url = "%s/%s/updates/" % (sparkle_base_url, suffix)
|
||||
sparkle_release_notes_url = "%s/%s/updates/changes/%s/" % (sparkle_base_url, suffix, app_version)
|
||||
cmd(git_dir + "/" + build_dir + "/Vendor/Sparkle/bin/generate_appcast", [
|
||||
updates_dir,
|
||||
"--download-url-prefix " + sparkle_download_url,
|
||||
"--release-notes-url-prefix " + sparkle_release_notes_url
|
||||
])
|
||||
sparkle_download_url = "%s/%s/updates/" % (branding.sparkle_base_url, suffix)
|
||||
sparkle_release_notes_url = "%s/%s/updates/changes/%s/" % (branding.sparkle_base_url, suffix, app_version)
|
||||
utils.sh(common.workspace_dir \
|
||||
+ "/desktop-apps/macos/Vendor/Sparkle/bin/generate_appcast " \
|
||||
+ updates_dir \
|
||||
+ " --download-url-prefix " + sparkle_download_url \
|
||||
+ " --release-notes-url-prefix " + sparkle_release_notes_url)
|
||||
|
||||
log("\n=== Edit Sparkle appcast links\n")
|
||||
appcast_url = sparkle_base_url + "/" + suffix
|
||||
utils.log_h3("edit sparkle appcast links")
|
||||
appcast_url = branding.sparkle_base_url + "/" + suffix
|
||||
appcast = "%s/%s.xml" % (updates_dir, package_name.lower())
|
||||
|
||||
for lang, base in update_changes_list.items():
|
||||
if base == "ReleaseNotes":
|
||||
replace_in_file(appcast,
|
||||
r'(<sparkle:releaseNotesLink>.+/).+(\.html</sparkle:releaseNotesLink>)',
|
||||
"\\1" + base + "\\2")
|
||||
utils.replace_in_file(appcast,
|
||||
r'(<sparkle:releaseNotesLink>.+/).+(\.html</sparkle:releaseNotesLink>)',
|
||||
"\\1" + base + "\\2")
|
||||
else:
|
||||
replace_in_file(appcast,
|
||||
r'(<sparkle:releaseNotesLink xml:lang="' + lang + r'">).+(\.html</sparkle:releaseNotesLink>)',
|
||||
"\\1" + base + "\\2")
|
||||
utils.replace_in_file(appcast,
|
||||
r'(<sparkle:releaseNotesLink xml:lang="' + lang + r'">).+(\.html</sparkle:releaseNotesLink>)',
|
||||
"\\1" + base + "\\2")
|
||||
|
||||
log("\n=== Delete unnecessary files\n")
|
||||
utils.log_h3("delete unnecessary files")
|
||||
for file in os.listdir(updates_dir):
|
||||
if (-1 == file.find(app_version)) and (file.endswith(".zip") or
|
||||
file.endswith(".html")):
|
||||
delete_file(updates_dir + '/' + file)
|
||||
utils.delete_file(updates_dir + '/' + file)
|
||||
|
||||
utils.log_h3("generate checksums")
|
||||
utils.sh(
|
||||
"md5 *.zip *.delta > md5sums.txt && " \
|
||||
+ "shasum -a 256 *.zip *.delta > sha256sums.txt",
|
||||
chdir="build/update",
|
||||
verbose=True
|
||||
)
|
||||
|
||||
utils.log_h2("desktop sparkle files deploy")
|
||||
rc = 0
|
||||
|
||||
zip_key = key_prefix + "/" + utils.get_basename(macos_zip)
|
||||
rc_zip = aws_s3_upload(macos_zip, zip_key, "Sparkle")
|
||||
rc += rc_zip
|
||||
|
||||
for path in utils.glob_files("build/update/*.delta") \
|
||||
+ utils.glob_files("build/update/*.xml") \
|
||||
+ utils.glob_files("build/update/*.html"):
|
||||
sparkle_key = key_prefix + "/" + utils.get_basename(path)
|
||||
rc_sparkle = aws_s3_upload(path, sparkle_key, "Sparkle")
|
||||
rc += rc_sparkle
|
||||
|
||||
utils.set_summary("desktop sparkle files deploy", rc == 0)
|
||||
|
||||
utils.log_h2("desktop checksums deploy")
|
||||
rc = 0
|
||||
|
||||
for path in utils.glob_files("build/update/*.txt"):
|
||||
checksums_key = key_prefix + "/" + utils.get_basename(path)
|
||||
rc_checksums = aws_s3_upload(path, checksums_key, "Checksums")
|
||||
rc += rc_checksums
|
||||
|
||||
utils.set_summary("desktop checksums deploy", rc == 0)
|
||||
return
|
||||
|
||||
#
|
||||
# Linux
|
||||
#
|
||||
|
||||
def make_linux():
|
||||
utils.set_cwd("desktop-apps/win-linux/package/linux")
|
||||
|
||||
rc = utils.sh("make clean", verbose=True)
|
||||
utils.set_summary("desktop clean", rc == 0)
|
||||
|
||||
args = []
|
||||
if common.platform == "linux_aarch64":
|
||||
args += ["-e", "UNAME_M=aarch64"]
|
||||
if not branding.onlyoffice:
|
||||
args += ["-e", "BRANDING_DIR=../../../../" + common.branding + "/desktop-apps/win-linux/package/linux"]
|
||||
rc = utils.sh("make packages " + " ".join(args), verbose=True)
|
||||
utils.set_summary("desktop build", rc == 0)
|
||||
|
||||
key_prefix = branding.company_name_l + "/" + common.release_branch
|
||||
if common.platform == "linux_x86_64":
|
||||
rpm_arch = "x86_64"
|
||||
elif common.platform == "linux_aarch64":
|
||||
rpm_arch = "aarch64"
|
||||
if rc == 0:
|
||||
utils.log_h2("desktop tar deploy")
|
||||
tar_file = utils.glob_file("tar/*.tar.gz")
|
||||
tar_key = key_prefix + "/linux/" + utils.get_basename(tar_file)
|
||||
rc = aws_s3_upload(tar_file, tar_key, "Portable")
|
||||
utils.set_summary("desktop tar deploy", rc == 0)
|
||||
|
||||
utils.log_h2("desktop deb deploy")
|
||||
deb_file = utils.glob_file("deb/*.deb")
|
||||
deb_key = key_prefix + "/ubuntu/" + utils.get_basename(deb_file)
|
||||
rc = aws_s3_upload(deb_file, deb_key, "Ubuntu")
|
||||
utils.set_summary("desktop deb deploy", rc == 0)
|
||||
|
||||
utils.log_h2("desktop rpm deploy")
|
||||
rpm_file = utils.glob_file("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
rpm_key = key_prefix + "/centos/" + utils.get_basename(rpm_file)
|
||||
rc = aws_s3_upload(rpm_file, rpm_key, "CentOS")
|
||||
utils.set_summary("desktop rpm deploy", rc == 0)
|
||||
|
||||
utils.log_h2("desktop apt-rpm deploy")
|
||||
apt_rpm_file = utils.glob_file("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
apt_rpm_key = key_prefix + "/altlinux/" + utils.get_basename(apt_rpm_file)
|
||||
rc = aws_s3_upload(apt_rpm_file, apt_rpm_key, "AltLinux")
|
||||
utils.set_summary("desktop apt-rpm deploy", rc == 0)
|
||||
|
||||
utils.log_h2("desktop urpmi deploy")
|
||||
urpmi_file = utils.glob_file("urpmi/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
urpmi_key = key_prefix + "/rosa/" + utils.get_basename(urpmi_file)
|
||||
rc = aws_s3_upload(urpmi_file, urpmi_key, "Rosa")
|
||||
utils.set_summary("desktop urpmi deploy", rc == 0)
|
||||
|
||||
# utils.log_h2("desktop suse-rpm deploy")
|
||||
# suse_rpm_file = utils.glob_file("suse-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
# suse_rpm_key = key_prefix + "/suse/" + utils.get_basename(suse_rpm_file)
|
||||
# rc = aws_s3_upload(suse_rpm_file, suse_rpm_key, "SUSE Linux")
|
||||
# utils.set_summary("desktop suse-rpm deploy", rc == 0)
|
||||
|
||||
if not branding.onlyoffice:
|
||||
utils.log_h2("desktop deb-astra deploy")
|
||||
deb_astra_file = utils.glob_file("deb-astra/*.deb")
|
||||
deb_astra_key = key_prefix + "/" + utils.get_basename(deb_astra_file)
|
||||
rc = aws_s3_upload(deb_astra_file, deb_astra_key, "AstraLinux Signed")
|
||||
utils.set_summary("desktop deb-astra deploy", rc == 0)
|
||||
|
||||
else:
|
||||
utils.set_summary("desktop tar deploy", False)
|
||||
utils.set_summary("desktop deb deploy", False)
|
||||
utils.set_summary("desktop rpm deploy", False)
|
||||
utils.set_summary("desktop apt-rpm deploy", False)
|
||||
utils.set_summary("desktop urpmi deploy", False)
|
||||
utils.set_summary("desktop suse-rpm deploy", False)
|
||||
if not branding.onlyoffice:
|
||||
utils.set_summary("desktop deb-astra deploy", False)
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
42
scripts/package_mobile.py
Normal file
42
scripts/package_mobile.py
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import package_utils as utils
|
||||
import package_common as common
|
||||
import package_branding as branding
|
||||
|
||||
def make():
|
||||
utils.log_h1("MOBILE")
|
||||
if not utils.is_linux():
|
||||
utils.log("Unsupported host OS")
|
||||
return
|
||||
make_mobile()
|
||||
return
|
||||
|
||||
def aws_s3_upload(local, key, ptype=None):
|
||||
rc = utils.sh("aws s3 cp --acl public-read --no-progress " \
|
||||
+ local + " s3://" + common.s3_bucket + "/" + key, verbose=True)
|
||||
if rc == 0 and ptype is not None:
|
||||
utils.add_deploy_data("mobile", ptype, local, key)
|
||||
return rc
|
||||
|
||||
def make_mobile():
|
||||
utils.set_cwd("build_tools/out")
|
||||
|
||||
if common.clean:
|
||||
utils.log_h2("mobile clean")
|
||||
utils.sh("rm -rfv *.zip", verbose=True)
|
||||
|
||||
zip_file = "android-libs-" + common.version + "-" + common.build + ".zip"
|
||||
zip_key = branding.company_name_l + "/" + common.release_branch + "/android/" + zip_file
|
||||
|
||||
utils.log_h2("mobile build")
|
||||
rc = utils.sh("zip -r " + zip_file + " ./android* ./js", verbose=True)
|
||||
utils.set_summary("mobile build", rc == 0)
|
||||
|
||||
utils.log_h2("mobile deploy")
|
||||
if rc == 0:
|
||||
rc = aws_s3_upload(zip_file, zip_key, "Android")
|
||||
utils.set_summary("mobile deploy", rc == 0)
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
@ -1,25 +1,122 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
|
||||
import base
|
||||
import os
|
||||
import package_utils as utils
|
||||
import package_common as common
|
||||
import package_branding as branding
|
||||
|
||||
def make(platform, targets):
|
||||
base_dir = base.get_script_dir() + "/../out"
|
||||
git_dir = base.get_script_dir() + "/../.."
|
||||
package_dir = os.path.abspath(git_dir + "/document-server-package")
|
||||
def make(edition):
|
||||
utils.log_h1("SERVER (" + edition.upper() + ")")
|
||||
if utils.is_windows():
|
||||
make_windows(edition)
|
||||
elif utils.is_linux():
|
||||
make_linux(edition)
|
||||
else:
|
||||
utils.log("Unsupported host OS")
|
||||
return
|
||||
|
||||
if ("windows" == platform) or ("linux" == platform):
|
||||
def aws_s3_upload(local, key, edition, ptype=None):
|
||||
if common.os_family == "windows":
|
||||
rc = utils.cmd(
|
||||
"aws", "s3", "cp", "--acl", "public-read", "--no-progress",
|
||||
local, "s3://" + common.s3_bucket + "/" + key,
|
||||
verbose=True
|
||||
)
|
||||
else:
|
||||
rc = utils.sh("aws s3 cp --acl public-read --no-progress " \
|
||||
+ local + " s3://" + common.s3_bucket + "/" + key, verbose=True)
|
||||
if rc == 0 and ptype is not None:
|
||||
utils.add_deploy_data("server_" + edition, ptype, local, key)
|
||||
return rc
|
||||
|
||||
if ("packages" in targets):
|
||||
def make_windows(edition):
|
||||
if edition == "enterprise":
|
||||
product_name = "DocumentServer-EE"
|
||||
elif edition == "developer":
|
||||
product_name = "DocumentServer-DE"
|
||||
else:
|
||||
product_name = "DocumentServer"
|
||||
utils.set_cwd("document-server-package")
|
||||
|
||||
print("Make clean")
|
||||
base.cmd_in_dir(package_dir, "make", ["clean"])
|
||||
utils.log_h2("server " + edition + " clean")
|
||||
rc = utils.cmd("make", "clean", verbose=True)
|
||||
utils.set_summary("server " + edition + " clean", rc == 0)
|
||||
|
||||
print("Make packages")
|
||||
base.cmd_in_dir(package_dir, "make", ["packages"])
|
||||
utils.log_h2("server " + edition + " build")
|
||||
args = ["-e", "PRODUCT_NAME=" + product_name]
|
||||
if not branding.onlyoffice:
|
||||
args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-server-package"]
|
||||
rc = utils.cmd("make", "packages", *args, verbose=True)
|
||||
utils.set_summary("server " + edition + " build", rc == 0)
|
||||
|
||||
key_prefix = "%s/%s/windows/server/%s/%s" % (branding.company_name_l, \
|
||||
common.release_branch, common.version, common.build)
|
||||
if rc == 0:
|
||||
utils.log_h2("server " + edition + " inno deploy")
|
||||
inno_file = utils.glob_file("exe/*.exe")
|
||||
inno_key = key_prefix + "/" + utils.get_basename(inno_file)
|
||||
rc = aws_s3_upload(inno_file, inno_key, edition, "Installer")
|
||||
utils.set_summary("server " + edition + " inno deploy", rc == 0)
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
|
||||
def make_linux(edition):
|
||||
if edition == "enterprise":
|
||||
product_name = "documentserver-ee"
|
||||
elif edition == "developer":
|
||||
product_name = "documentserver-de"
|
||||
else:
|
||||
product_name = "documentserver"
|
||||
utils.set_cwd("document-server-package")
|
||||
|
||||
utils.log_h2("server " + edition + " clean")
|
||||
rc = utils.sh("make clean", verbose=True)
|
||||
utils.set_summary("server " + edition + " clean", rc == 0)
|
||||
|
||||
utils.log_h2("server " + edition + " build")
|
||||
args = ["-e", "PRODUCT_NAME=" + product_name]
|
||||
if common.platform == "linux_aarch64":
|
||||
args += ["-e", "UNAME_M=aarch64"]
|
||||
if not branding.onlyoffice:
|
||||
args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-server-package"]
|
||||
rc = utils.sh("make packages " + " ".join(args), verbose=True)
|
||||
utils.set_summary("server " + edition + " build", rc == 0)
|
||||
|
||||
key_prefix = branding.company_name_l + "/" + common.release_branch
|
||||
if common.platform == "linux_x86_64":
|
||||
rpm_arch = "x86_64"
|
||||
elif common.platform == "linux_aarch64":
|
||||
rpm_arch = "aarch64"
|
||||
if rc == 0:
|
||||
utils.log_h2("server " + edition + " tar deploy")
|
||||
tar_file = utils.glob_file("*.tar.gz")
|
||||
tar_key = key_prefix + "/linux/" + utils.get_basename(tar_file)
|
||||
rc = aws_s3_upload(tar_file, tar_key, edition, "Portable")
|
||||
utils.set_summary("server " + edition + " tar deploy", rc == 0)
|
||||
|
||||
utils.log_h2("server " + edition + " deb deploy")
|
||||
deb_file = utils.glob_file("deb/*.deb")
|
||||
deb_key = key_prefix + "/ubuntu/" + utils.get_basename(deb_file)
|
||||
rc = aws_s3_upload(deb_file, deb_key, edition, "Ubuntu")
|
||||
utils.set_summary("server " + edition + " deb deploy", rc == 0)
|
||||
|
||||
utils.log_h2("server " + edition + " rpm deploy")
|
||||
rpm_file = utils.glob_file("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
rpm_key = key_prefix + "/centos/" + utils.get_basename(rpm_file)
|
||||
rc = aws_s3_upload(rpm_file, rpm_key, edition, "CentOS")
|
||||
utils.set_summary("server " + edition + " rpm deploy", rc == 0)
|
||||
|
||||
utils.log_h2("server " + edition + " apt-rpm deploy")
|
||||
alt_rpm_file = utils.glob_file("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm")
|
||||
alt_rpm_key = key_prefix + "/altlinux/" + utils.get_basename(alt_rpm_file)
|
||||
rc = aws_s3_upload(alt_rpm_file, alt_rpm_key, edition, "AltLinux")
|
||||
utils.set_summary("server " + edition + " apt-rpm deploy", rc == 0)
|
||||
|
||||
else:
|
||||
utils.set_summary("server " + edition + " tar deploy", False)
|
||||
utils.set_summary("server " + edition + " deb deploy", False)
|
||||
utils.set_summary("server " + edition + " rpm deploy", False)
|
||||
utils.set_summary("server " + edition + " alt-rpm deploy", False)
|
||||
|
||||
exit(1)
|
||||
|
||||
return
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import codecs
|
||||
import glob
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
@ -11,71 +12,81 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import base
|
||||
|
||||
def parse():
|
||||
parser = argparse.ArgumentParser(description="Build packages.")
|
||||
parser.add_argument('-P', '--product', dest='product', type=str,
|
||||
action='store', help="Defines product")
|
||||
parser.add_argument('-S', '--system', dest='system', type=str,
|
||||
action='store', help="Defines system")
|
||||
parser.add_argument('-R', '--branding', dest='branding', type=str,
|
||||
action='store', help="Provides branding path")
|
||||
parser.add_argument('-V', '--version', dest='version', type=str,
|
||||
action='store', help="Defines version")
|
||||
parser.add_argument('-B', '--build', dest='build', type=str,
|
||||
action='store', help="Defines build")
|
||||
parser.add_argument('-T', '--targets', dest='targets', type=str, nargs='+',
|
||||
action='store', help="Defines targets")
|
||||
args = parser.parse_args()
|
||||
|
||||
global product, system, targets, version, build, branding, sign, clean
|
||||
product = args.product
|
||||
system = args.system if (args.system is not None) else host_platform()
|
||||
targets = args.targets
|
||||
version = args.version if (args.version is not None) else get_env('PRODUCT_VERSION', '0.0.0')
|
||||
build = args.build if (args.build is not None) else get_env('BUILD_NUMBER', '0')
|
||||
branding = args.branding
|
||||
return
|
||||
import package_common as common
|
||||
|
||||
def host_platform():
|
||||
return platform.system().lower()
|
||||
|
||||
def log(string, end='\n', bold=False):
|
||||
if bold:
|
||||
out = '\033[1m' + string + '\033[0m' + end
|
||||
else:
|
||||
out = string + end
|
||||
sys.stdout.write(out)
|
||||
def is_windows():
|
||||
return host_platform() == "windows"
|
||||
|
||||
def is_macos():
|
||||
return host_platform() == "darwin"
|
||||
|
||||
def is_linux():
|
||||
return host_platform() == "linux"
|
||||
|
||||
def log(string, end='\n'):
|
||||
sys.stdout.write(string + end)
|
||||
sys.stdout.flush()
|
||||
return
|
||||
|
||||
def get_env(name, default=''):
|
||||
return os.getenv(name, default)
|
||||
|
||||
def set_env(name, value):
|
||||
os.environ[name] = value
|
||||
def log_h1(string):
|
||||
line = "#" * (len(string) + 8)
|
||||
log("\n" + line + "\n### " + string + " ###\n" + line + "\n")
|
||||
return
|
||||
|
||||
def set_cwd(dir):
|
||||
log("- change working dir: " + dir)
|
||||
os.chdir(dir)
|
||||
def log_h2(string):
|
||||
log("\n### " + string + "\n")
|
||||
return
|
||||
|
||||
def get_path(*paths):
|
||||
arr = []
|
||||
for path in paths:
|
||||
if host_platform() == 'windows':
|
||||
arr += path.split('/')
|
||||
else:
|
||||
arr += [path]
|
||||
return os.path.join(*arr)
|
||||
def log_h3(string):
|
||||
log("# " + string)
|
||||
return
|
||||
|
||||
def get_abspath(*paths):
|
||||
arr = []
|
||||
for path in paths:
|
||||
arr += path.split('/')
|
||||
return os.path.abspath(os.path.join(*arr))
|
||||
def log_err(string):
|
||||
log("!!! " + string)
|
||||
return
|
||||
|
||||
def get_timestamp():
|
||||
return "%.f" % time.time()
|
||||
|
||||
def get_env(key, default=None):
|
||||
return os.getenv(key, default)
|
||||
|
||||
def set_env(key, value):
|
||||
os.environ[key] = value
|
||||
return
|
||||
|
||||
def get_cwd():
|
||||
return os.getcwd()
|
||||
|
||||
def set_cwd(path, verbose=True):
|
||||
if verbose:
|
||||
log_h3("change working dir:")
|
||||
log_h3(" path: " + path)
|
||||
os.chdir(path)
|
||||
return
|
||||
|
||||
def get_path(path):
|
||||
if is_windows():
|
||||
return path.replace("/", "\\")
|
||||
return path
|
||||
|
||||
def get_abspath(path):
|
||||
return os.path.abspath(get_path(path))
|
||||
|
||||
def get_basename(path):
|
||||
return os.path.basename(path)
|
||||
|
||||
def get_dirname(path):
|
||||
return os.path.dirname(path)
|
||||
|
||||
def get_file_size(path):
|
||||
return os.path.getsize(path)
|
||||
|
||||
def get_script_dir(path):
|
||||
return get_dirname(os.path.realpath(path))
|
||||
|
||||
def is_file(path):
|
||||
return os.path.isfile(path)
|
||||
@ -88,200 +99,268 @@ def is_exist(path):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_dirname(path):
|
||||
return os.path.dirname(path)
|
||||
def glob_path(path):
|
||||
return glob.glob(path)
|
||||
|
||||
def create_dir(path):
|
||||
log("- create dir: " + path)
|
||||
def glob_file(path):
|
||||
if glob.glob(path) and is_file(glob.glob(path)[0]):
|
||||
return glob.glob(path)[0]
|
||||
return
|
||||
|
||||
def get_md5(path):
|
||||
if os.path.exists(path):
|
||||
md5_hash = hashlib.md5()
|
||||
md5_hash.update(open(path, "rb").read())
|
||||
return md5_hash.hexdigest()
|
||||
return
|
||||
|
||||
def create_dir(path, verbose=True):
|
||||
if verbose:
|
||||
log_h3("create_dir:")
|
||||
log_h3(" path:" + path)
|
||||
if not is_exist(path):
|
||||
os.makedirs(path)
|
||||
else:
|
||||
log("! dir exist")
|
||||
log_err("dir exist")
|
||||
return
|
||||
|
||||
def write_file(path, data, encoding='utf-8'):
|
||||
def write_file(path, data, encoding='utf-8', verbose=True):
|
||||
if is_file(path):
|
||||
delete_file(path)
|
||||
log("- write file: " + path)
|
||||
if verbose:
|
||||
log_h3("write_file:")
|
||||
log_h3(" path: " + path)
|
||||
log_h3(" encoding: " + encoding)
|
||||
log_h3(" data: |\n" + data)
|
||||
with codecs.open(path, 'w', encoding) as file:
|
||||
file.write(data)
|
||||
return
|
||||
|
||||
def write_template(src, dst, encoding='utf-8', **kwargs):
|
||||
template = Template(open(src).read())
|
||||
if is_file(dst):
|
||||
os.remove(dst)
|
||||
log("- write template: " + dst + " < " + src)
|
||||
with codecs.open(dst, 'w', encoding) as file:
|
||||
file.write(template.render(**kwargs))
|
||||
return
|
||||
|
||||
def replace_in_file(path, pattern, textReplace, encoding='utf-8'):
|
||||
log("- replace in file: " + path + \
|
||||
"\n pattern: " + pattern + \
|
||||
"\n replace: " + textReplace)
|
||||
filedata = ""
|
||||
def replace_in_file(path, pattern, text_replace, encoding='utf-8', verbose=True):
|
||||
if verbose:
|
||||
log_h3("replace_in_file:")
|
||||
log_h3(" path: " + path)
|
||||
log_h3(" pattern: " + pattern)
|
||||
log_h3(" replace: " + text_replace)
|
||||
log_h3(" encoding: " + encoding)
|
||||
file_data = ""
|
||||
with codecs.open(get_path(path), "r", encoding) as file:
|
||||
filedata = file.read()
|
||||
filedata = re.sub(pattern, textReplace, filedata)
|
||||
file_data = file.read()
|
||||
file_data = re.sub(pattern, text_replace, file_data)
|
||||
delete_file(path)
|
||||
with codecs.open(get_path(path), "w", encoding) as file:
|
||||
file.write(filedata)
|
||||
file.write(file_data)
|
||||
return
|
||||
|
||||
def copy_file(src, dst):
|
||||
log("- copy file: " + dst + " < " + src)
|
||||
def copy_file(src, dst, verbose=True):
|
||||
if verbose:
|
||||
log_h3("copy_file:")
|
||||
log_h3(" src: " + src)
|
||||
log_h3(" dst: " + dst)
|
||||
if is_file(dst):
|
||||
delete_file(dst)
|
||||
if not is_file(src):
|
||||
log("! file not exist: " + src)
|
||||
log_err("file not exist: " + src)
|
||||
return
|
||||
return shutil.copy2(get_path(src), get_path(dst))
|
||||
|
||||
def copy_files(src, dst, override=True):
|
||||
log("- copy files: " + dst + " < " + src)
|
||||
def copy_files(src, dst, override=True, verbose=True):
|
||||
if verbose:
|
||||
log_h3("copy_files:")
|
||||
log_h3(" src: " + src)
|
||||
log_h3(" dst: " + dst)
|
||||
log_h3(" override: " + str(override))
|
||||
for file in glob.glob(src):
|
||||
file_name = os.path.basename(file)
|
||||
if is_file(file):
|
||||
if override and is_file(dst + "/" + file_name):
|
||||
delete_file(dst + "/" + file_name)
|
||||
if not is_file(dst + "/" + file_name):
|
||||
copy_file(file, dst)
|
||||
if verbose:
|
||||
log(file + " : " + get_path(dst))
|
||||
shutil.copy2(file, get_path(dst))
|
||||
elif is_dir(file):
|
||||
if not is_dir(dst + "/" + file_name):
|
||||
create_dir(dst + "/" + file_name)
|
||||
copy_files(file + "/*", dst + "/" + file_name, override)
|
||||
return
|
||||
|
||||
def copy_dir(src, dst):
|
||||
def copy_dir(src, dst, override=True, verbose=True):
|
||||
if verbose:
|
||||
log_h3("copy_dir:")
|
||||
log_h3(" src: " + src)
|
||||
log_h3(" dst: " + dst)
|
||||
log_h3(" override: " + str(override))
|
||||
if is_dir(dst):
|
||||
delete_dir(dst)
|
||||
try:
|
||||
shutil.copytree(get_path(src), get_path(dst))
|
||||
except OSError as e:
|
||||
log('! Directory not copied. Error: %s' % e)
|
||||
log_err('directory not copied. Error: %s' % e)
|
||||
return
|
||||
|
||||
def copy_dir_content(src, dst, filterInclude = "", filterExclude = ""):
|
||||
log("- copy dir content: " + src + " " + dst + " " + filterInclude + " " + filterExclude)
|
||||
def copy_dir_content(src, dst, filter_include = "", filter_exclude = "", verbose=True):
|
||||
if verbose:
|
||||
log_h3("copy_dir_content:")
|
||||
log_h3(" src: " + src)
|
||||
log_h3(" dst: " + dst)
|
||||
log_h3(" include: " + filter_include)
|
||||
log_h3(" exclude: " + filter_exclude)
|
||||
src_folder = src
|
||||
if ("/" != src[-1:]):
|
||||
src_folder += "/"
|
||||
src_folder += "*"
|
||||
for file in glob.glob(src_folder):
|
||||
basename = os.path.basename(file)
|
||||
if ("" != filterInclude) and (-1 == basename.find(filterInclude)):
|
||||
if ("" != filter_include) and (-1 == basename.find(filter_include)):
|
||||
continue
|
||||
if ("" != filterExclude) and (-1 != basename.find(filterExclude)):
|
||||
if ("" != filter_exclude) and (-1 != basename.find(filter_exclude)):
|
||||
continue
|
||||
if is_file(file):
|
||||
copy_file(file, dst)
|
||||
copy_file(file, dst, verbose=False)
|
||||
elif is_dir(file):
|
||||
copy_dir(file, dst + "/" + basename)
|
||||
return
|
||||
|
||||
def delete_file(path):
|
||||
log("- delete file: " + path)
|
||||
def delete_file(path, verbose=True):
|
||||
if verbose:
|
||||
log_h3("delete_file:")
|
||||
log_h3(" path: " + path)
|
||||
if not is_file(path):
|
||||
log("! file not exist")
|
||||
log_err("file not exist")
|
||||
return
|
||||
return os.remove(path)
|
||||
|
||||
def delete_dir(path):
|
||||
log("- delete dir: " + path)
|
||||
def delete_dir(path, verbose=True):
|
||||
if verbose:
|
||||
log_h3("delete_dir:")
|
||||
log_h3(" path: " + path)
|
||||
if not is_dir(path):
|
||||
log("! dir not exist")
|
||||
log_err("dir not exist")
|
||||
return
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
return
|
||||
|
||||
def delete_files(src):
|
||||
def delete_files(src, verbose=True):
|
||||
if verbose:
|
||||
log_h3("delete_files:")
|
||||
log_h3(" pattern: " + src)
|
||||
for path in glob.glob(src):
|
||||
if verbose:
|
||||
log(path)
|
||||
if is_file(path):
|
||||
delete_file(path)
|
||||
os.remove(path)
|
||||
elif is_dir(path):
|
||||
delete_dir(path)
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
return
|
||||
|
||||
def download_file(url, path):
|
||||
log("- download file: " + path + " < " + url)
|
||||
def set_summary(target, status):
|
||||
common.summary.append({target: status})
|
||||
return
|
||||
|
||||
def add_deploy_data(product, ptype, src, dst):
|
||||
common.deploy_data.append({
|
||||
"platform": common.platforms[common.platform]["title"],
|
||||
"product": product,
|
||||
"type": ptype,
|
||||
# "local": get_path(src),
|
||||
"size": get_file_size(get_path(src)),
|
||||
"remote": dst
|
||||
})
|
||||
file = open(get_path(common.workspace_dir + "/deploy.json"), 'w')
|
||||
file.write(json.dumps(common.deploy_data, sort_keys=True, indent=4))
|
||||
file.close()
|
||||
return
|
||||
|
||||
def cmd(*args, **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log_h3("cmd:")
|
||||
log_h3(" command: " + " ".join(args))
|
||||
if kwargs.get("chdir"):
|
||||
log_h3(" chdir: " + kwargs["chdir"])
|
||||
if kwargs.get("creates"):
|
||||
log_h3(" creates: " + kwargs["creates"])
|
||||
if kwargs.get("creates") and is_exist(kwargs["creates"]):
|
||||
log_err("creates exist")
|
||||
return 0
|
||||
if kwargs.get("chdir") and is_dir(kwargs["chdir"]):
|
||||
oldcwd = get_cwd()
|
||||
set_cwd(kwargs["chdir"])
|
||||
ret = subprocess.call(
|
||||
[i for i in args], stderr=subprocess.STDOUT, shell=True
|
||||
)
|
||||
if kwargs.get("chdir") and oldcwd:
|
||||
set_cwd(oldcwd)
|
||||
return ret
|
||||
|
||||
def cmd_output(*args, **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log_h3("cmd_output:")
|
||||
log_h3(" command: " + " ".join(args))
|
||||
return subprocess.check_output(
|
||||
[i for i in args], stderr=subprocess.STDOUT, shell=True
|
||||
).decode("utf-8")
|
||||
|
||||
def powershell(*args, **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log_h3("powershell:")
|
||||
log_h3(" command: " + " ".join(args))
|
||||
if kwargs.get("chdir"):
|
||||
log_h3(" chdir: " + kwargs["chdir"])
|
||||
if kwargs.get("creates"):
|
||||
log_h3(" creates: " + kwargs["creates"])
|
||||
if kwargs.get("creates") and is_exist(kwargs["creates"]):
|
||||
return 0
|
||||
args = ["powershell", "-Command"] + [i for i in args]
|
||||
ret = subprocess.call(
|
||||
args, stderr=subprocess.STDOUT, shell=True
|
||||
)
|
||||
return ret
|
||||
|
||||
def ps1(file, args=[], **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log_h2("powershell cmdlet: " + file + " " + " ".join(args))
|
||||
if kwargs.get("creates") and is_exist(kwargs["creates"]):
|
||||
return 0
|
||||
ret = subprocess.call(
|
||||
["powershell", file] + args, stderr=subprocess.STDOUT, shell=True
|
||||
)
|
||||
return ret
|
||||
|
||||
def download_file(url, path, md5, verbose=False):
|
||||
if verbose:
|
||||
log_h3("download_file:")
|
||||
log_h3(" url: " + path)
|
||||
log_h3(" path: " + url)
|
||||
log_h3(" md5: " + md5)
|
||||
if is_file(path):
|
||||
os.remove(path)
|
||||
powershell(["Invoke-WebRequest", url, "-OutFile", path])
|
||||
return
|
||||
|
||||
def proc_open(command):
|
||||
log("- open process: " + command)
|
||||
popen = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, shell=True)
|
||||
ret = {'stdout' : '', 'stderr' : ''}
|
||||
try:
|
||||
stdout, stderr = popen.communicate()
|
||||
popen.wait()
|
||||
ret['stdout'] = stdout.strip().decode('utf-8', errors='ignore')
|
||||
ret['stderr'] = stderr.strip().decode('utf-8', errors='ignore')
|
||||
finally:
|
||||
popen.stdout.close()
|
||||
popen.stderr.close()
|
||||
if get_md5(path) == md5:
|
||||
log_err("file already exist (match checksum)")
|
||||
return 0
|
||||
else:
|
||||
log_err("wrong checksum (%s), delete" % md5)
|
||||
os.remove(path)
|
||||
ret = powershell("(New-Object System.Net.WebClient).DownloadFile('%s','%s')" % (url, path), verbose=True)
|
||||
md5_new = get_md5(path)
|
||||
if md5 != md5_new:
|
||||
log_err("checksum didn't match (%s != %s)" % (md5, md5_new))
|
||||
return 1
|
||||
return ret
|
||||
|
||||
def cmd(prog, args=[], is_no_errors=False):
|
||||
log("- cmd: " + prog + " " + ' '.join(args))
|
||||
ret = 0
|
||||
if host_platform() == 'windows':
|
||||
sub_args = args[:]
|
||||
sub_args.insert(0, get_path(prog))
|
||||
ret = subprocess.call(sub_args, stderr=subprocess.STDOUT, shell=True)
|
||||
else:
|
||||
command = prog
|
||||
for arg in args:
|
||||
command += (" \"%s\"" % arg)
|
||||
ret = subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
|
||||
if ret != 0 and True != is_no_errors:
|
||||
sys.exit("! error (" + prog + "): " + str(ret))
|
||||
return ret
|
||||
|
||||
def powershell(cmd):
|
||||
log("- pwsh: " + ' '.join(cmd))
|
||||
ret = subprocess.call(['powershell', '-Command'] + cmd,
|
||||
stderr=subprocess.STDOUT, shell=True)
|
||||
if ret != 0:
|
||||
sys.exit("! error: " + str(ret))
|
||||
return ret
|
||||
def sh(command, **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log_h3("sh:")
|
||||
log_h3(" command: " + command)
|
||||
if kwargs.get("chdir"):
|
||||
log_h3(" chdir: " + kwargs["chdir"])
|
||||
if kwargs.get("creates"):
|
||||
log_h3(" creates: " + kwargs["creates"])
|
||||
return subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
|
||||
|
||||
def sh_output(command, **kwargs):
|
||||
if kwargs.get("verbose"):
|
||||
log("- sh output: " + command)
|
||||
ret = subprocess.check_output(
|
||||
log_h3("sh_output:")
|
||||
log_h3(" command: " + command)
|
||||
return subprocess.check_output(
|
||||
command, stderr=subprocess.STDOUT, shell=True
|
||||
)
|
||||
return ret.decode("utf-8").strip()
|
||||
|
||||
def get_platform(target):
|
||||
xp = (-1 != target.find('-xp'))
|
||||
if (-1 != target.find('-x64')):
|
||||
return {'machine': "64", 'arch': "x64", 'xp': xp}
|
||||
elif (-1 != target.find('-x86')):
|
||||
return {'machine': "32", 'arch': "x86", 'xp': xp}
|
||||
return
|
||||
|
||||
global git_dir, out_dir, tsa_server, vcredist_links
|
||||
git_dir = get_abspath(get_dirname(__file__), '../..')
|
||||
out_dir = get_abspath(get_dirname(__file__), '../out')
|
||||
timestamp = "%.f" % time.time()
|
||||
tsa_server = "http://timestamp.digicert.com"
|
||||
vcredist_links = {
|
||||
'2022': {
|
||||
'64': "https://aka.ms/vs/17/release/vc_redist.x64.exe",
|
||||
'32': "https://aka.ms/vs/17/release/vc_redist.x86.exe"
|
||||
},
|
||||
'2015': {
|
||||
'64': "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe",
|
||||
'32': "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe"
|
||||
},
|
||||
'2013': {
|
||||
'64': "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe",
|
||||
'32': "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe"
|
||||
}
|
||||
}
|
||||
isxdl_link = "https://raw.githubusercontent.com/jrsoftware/ispack/is-5_6_1/isxdlfiles/isxdl.dll"
|
||||
).decode("utf-8")
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import re
|
||||
def readFile(path):
|
||||
with open(path, "r") as file:
|
||||
with open(path, "r", errors='replace') as file:
|
||||
filedata = file.read()
|
||||
return filedata
|
||||
|
||||
@ -46,12 +46,12 @@ class EditorApi(object):
|
||||
if -1 != retParam.find("[]"):
|
||||
isArray = True
|
||||
retParam = retParam.replace("[]", "")
|
||||
retType = retParam.replace("|", " ").split(" ")[0]
|
||||
retType = retParam.replace("|", " ").replace(".", " ").split(" ")[0]
|
||||
retTypeLower = retType.lower()
|
||||
retValue = ""
|
||||
if -1 != retType.find("\""):
|
||||
retValue = "\"\""
|
||||
elif "bool" == retTypeLower:
|
||||
elif "boolean" == retTypeLower or "bool" == retTypeLower:
|
||||
retValue = "true"
|
||||
elif "string" == retTypeLower:
|
||||
retValue = "\"\""
|
||||
@ -61,6 +61,12 @@ class EditorApi(object):
|
||||
retValue = "undefined"
|
||||
elif "null" == retTypeLower:
|
||||
retValue = "null"
|
||||
elif "array" == retTypeLower:
|
||||
retValue = "[]"
|
||||
elif "base64img" == retTypeLower:
|
||||
retValue = "base64img"
|
||||
elif "error" == retTypeLower:
|
||||
retValue = "undefined"
|
||||
else:
|
||||
retValue = "new " + retType + "()"
|
||||
if isArray:
|
||||
@ -72,24 +78,34 @@ class EditorApi(object):
|
||||
rec = rec.replace("\t", "")
|
||||
rec = rec.replace('\n ', '\n')
|
||||
indexEndDecoration = rec.find("*/")
|
||||
|
||||
indexOfStartPropName = rec.find('Object.defineProperty(')
|
||||
if indexOfStartPropName != -1:
|
||||
propName = re.search(r'"([^\"]*)"', rec[indexOfStartPropName:])[0]
|
||||
else:
|
||||
propName = None
|
||||
|
||||
decoration = "/**" + rec[0:indexEndDecoration + 2]
|
||||
decoration = decoration.replace("Api\n", "ApiInterface\n")
|
||||
decoration = decoration.replace("Api ", "ApiInterface ")
|
||||
decoration = decoration.replace("{Api}", "{ApiInterface}")
|
||||
decoration = decoration.replace("@return ", "@returns ")
|
||||
decoration = decoration.replace("@returns {?", "@returns {")
|
||||
decoration = decoration.replace("?}", "}")
|
||||
if -1 != decoration.find("@name ApiInterface"):
|
||||
self.append_record(decoration, "var ApiInterface = function() {};\nvar Api = new ApiInterface();\n", True)
|
||||
return
|
||||
code = rec[indexEndDecoration + 2:]
|
||||
code = code.strip("\t\n\r ")
|
||||
code = code.replace("=\n", "= ").strip("\t\n\r ")
|
||||
lines = code.split("\n")
|
||||
codeCorrect = ""
|
||||
sFuncName = ""
|
||||
sMethodName = re.search(r'.prototype.(.*)=', code)
|
||||
|
||||
is_found_function = False
|
||||
addon_for_func = "{}"
|
||||
if -1 != decoration.find("@return"):
|
||||
addon_for_func = "{ return null; }"
|
||||
|
||||
for line in lines:
|
||||
line = line.strip("\t\n\r ")
|
||||
line = line.replace("{", "")
|
||||
@ -107,6 +123,20 @@ class EditorApi(object):
|
||||
codeCorrect += (line + "\n")
|
||||
codeCorrect = codeCorrect.replace("Api.prototype", "ApiInterface.prototype")
|
||||
self.append_record(decoration, codeCorrect)
|
||||
className = codeCorrect[0:codeCorrect.find('.')]
|
||||
|
||||
# если свойство определено сразу под методом (без декорации)
|
||||
if propName is not None and sMethodName is not None:
|
||||
prop_define = f'{className}.prototype.{propName[1:-1]} = {className}.prototype.{sMethodName.group(1)}();\n'
|
||||
self.append_record(decoration, prop_define)
|
||||
#иначе
|
||||
elif propName is not None:
|
||||
className = re.search(r'.defineProperty\((.*).prototype', code).group(1).strip()
|
||||
returnValue = 'undefined' if decoration.find('@return') == -1 else self.getReturnValue(decoration)
|
||||
if (returnValue != 'undefined'):
|
||||
returnValue = re.search(r'{ return (.*); }', returnValue).group(1).strip()
|
||||
prop_define = f'{className}.prototype.{propName[1:-1]} = {returnValue};\n'
|
||||
self.append_record(decoration, prop_define)
|
||||
return
|
||||
|
||||
def append_record(self, decoration, code, init=False):
|
||||
|
||||
Reference in New Issue
Block a user