base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_js_content = base.readFile( "./../../license/header.license") + "\n" + engine_base_js_content.replace( "//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell.js", engine_js_content) base.copy_file("spell.wasm", "./deploy/spell/spell.wasm") # ie asm version arguments = arguments.replace("WASM=1", "WASM=0") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat)
def make(): print("[fetch & build]: cef") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/cef" old_cur = os.getcwd() os.chdir(base_dir) platforms = ["win_64", "win_32", "win_64_xp", "win_32_xp", "linux_64", "linux_32", "mac_64"] url = "http://d2ettrnqo7v976.cloudfront.net/cef/3770/" for platform in platforms: if not config.check_option("platform", platform): continue url += (platform + "/cef_binary.7z") if not base.is_dir(platform): base.create_dir(platform) os.chdir(platform) data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./cef_binary.7z.data") if (data_url != old_data_url): if base.is_file("./cef_binary.7z"): base.delete_file("./cef_binary.7z") if base.is_dir("build"): base.delete_dir("build") if base.is_dir("build"): continue # download if not base.is_file("./cef_binary.7z"): base.download(url, "./cef_binary.7z") # extract base.extract("./cef_binary.7z", "./") base.delete_file("./cef_binary.7z.data") base.writeFile("./cef_binary.7z.data", data_url) base.create_dir("./build") # deploy if ("mac_64" != platform): base.copy_files("cef_binary/Release/*", "build/") base.copy_files("cef_binary/Resources/*", "build/") if (0 == platform.find("linux")): base.cmd("chmod", ["a+xr", "build/locales"]) if ("mac_64" == platform): base.cmd("mv", ["Chromium Embedded Framework.framework", "build/Chromium Embedded Framework.framework"]) os.chdir(base_dir) os.chdir(old_cur) return
compilation_level = "SIMPLE_OPTIMIZATIONS" base.cmd("java", ["-jar", "../../build/node_modules/google-closure-compiler-java/compiler.jar", "--compilation_level", compilation_level, "--js_output_file", "plugins.js", "--js", "../device_scale.js", "--js", "plugin_base.js", "--js", "plugin_base_api.js"]) code_content = base.readFile("plugins.js") dst_content = base.readFile("../plugins.js") startCode = dst_content.find("/*<code>*/") endCode = dst_content.find("/*</code>*/") code_content = code_content.replace("\r", "") code_content = code_content.replace("\n", "") code_content = code_content.replace("\\", "\\\\") code_content = code_content.replace("\"", "\\\"") content = "" content += dst_content[0:startCode] content += "/*<code>*/\"" content += code_content content += "\"" content += dst_content[endCode:] base.delete_file("plugins.js") base.delete_file("../plugins.js") base.writeFile("../plugins.js", content)
def install_deps(): if base.is_file("./packages_complete"): return # dependencies packages = [ "apt-transport-https", "autoconf2.13", "build-essential", "ca-certificates", "cmake", "curl", "git", "glib-2.0-dev", "libglu1-mesa-dev", "libgtk-3-dev", "libpulse-dev", "libtool", "p7zip-full", "subversion", "gzip", "libasound2-dev", "libatspi2.0-dev", "libcups2-dev", "libdbus-1-dev", "libicu-dev", "libglu1-mesa-dev", "libgstreamer1.0-dev", "libgstreamer-plugins-base1.0-dev", "libx11-xcb-dev", "libxcb*", "libxi-dev", "libxrender-dev", "libxss1", "libncurses5" ] base.cmd("sudo", ["apt-get", "install", "-y"] + packages) # nodejs base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) nodejs_cur = 0 try: nodejs_version = base.run_command('node -v')['stdout'] nodejs_cur_version_major = int(nodejs_version.split('.')[0][1:]) nodejs_cur_version_minor = int(nodejs_version.split('.')[1]) nodejs_cur = nodejs_cur_version_major * 1000 + nodejs_cur_version_minor print("Installed Node.js version: " + str(nodejs_cur_version_major) + "." + str(nodejs_cur_version_minor)) except: nodejs_cur = 1 if (nodejs_cur < 10020): print("Node.js version cannot be less 10.20") print("Reinstall") if (base.is_dir("./node_js_setup_10.x")): base.delete_dir("./node_js_setup_10.x") base.cmd("sudo", ["apt-get", "remove", "--purge", "-y", "nodejs"]) base.download("https://deb.nodesource.com/setup_10.x", "./node_js_setup_10.x") base.cmd( 'curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -' ) base.cmd("sudo", ["bash", "./node_js_setup_10.x"]) base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"]) base.cmd("sudo", ["npm", "install", "-g", "npm@6"]) else: print("OK") base.cmd("sudo", ["apt-get", "-y", "install", "npm", "yarn"], True) base.cmd("sudo", ["npm", "install", "-g", "grunt-cli"]) base.cmd("sudo", ["npm", "install", "-g", "pkg"]) # java java_error = base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-11-jdk"], True) if (0 != java_error): java_error = base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"], True) if (0 != java_error): base.cmd("sudo", ["apt-get", "-y", "install", "software-properties-common"]) base.cmd("sudo", ["add-apt-repository", "-y", "ppa:openjdk-r/ppa"]) base.cmd("sudo", ["apt-get", "update"]) base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"]) base.cmd("sudo", ["update-alternatives", "--config", "java"]) base.cmd("sudo", ["update-alternatives", "--config", "javac"]) base.writeFile("./packages_complete", "complete") return
def make(build_js = True): old_cur_dir = os.getcwd() #fetch libhunspell print("[fetch & build]: hunspell") base_dir = base.get_script_dir() + "/../../core/Common/3dParty/hunspell" os.chdir(base_dir) if not base.is_dir("hunspell"): last_stable_commit = "8a2fdfe5a6bb1cbafc04b0c8486abcefd17ad903" repo_path = "https://github.com/hunspell/hunspell.git" base.cmd("git", ["clone", repo_path]) os.chdir("hunspell") base.cmd("git", ["checkout", last_stable_commit]) base.replaceInFile("./src/hunspell/filemgr.hxx", "FileMgr& operator=(const FileMgr&);", "FileMgr& operator=(const FileMgr&); \n" +" #ifdef HUNSPELL_WASM_MODULE \n char* memory;size_t index;size_t size; \n #endif") #custon filemgr support watch filemgr_wrapper_new.cxx os.chdir("../") if not build_js: os.chdir(old_cur_dir) return base.configure_common_apps() # remove previous version if base.is_dir("./deploy"): base.delete_dir("./deploy") base.create_dir("./deploy") base.create_dir("./deploy/spell") # fetch emsdk command_prefix = "" if ("windows" == base.host_platform()) else "./" if not base.is_dir("emsdk"): base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"]) os.chdir("emsdk") base.cmd(command_prefix + "emsdk", ["install", "latest"]) base.cmd(command_prefix + "emsdk", ["activate", "latest"]) os.chdir("../") # compile compiler_flags = ["-o spell.js", "-O3", "-fno-exceptions", "-fno-rtti", "-s WASM=1", "-s ALLOW_MEMORY_GROWTH=1", "-s FILESYSTEM=0", "-s ENVIRONMENT='web,worker'"] exported_functions = ["_malloc", "_free", "_Spellchecker_Malloc", "_Spellchecker_Free", "_Spellchecker_Create", "_Spellchecker_Destroy", "_Spellchecker_AddDictionary", "_Spellchecker_RemoveDicrionary", "_Spellchecker_Load", "_Spellchecker_Spell", "_Spellchecker_Suggest", "_Spellchecker_RemoveEngine", "_Spellchecker_TotalAllocatedMemory"] version_hunspell = 17 libhunspell_src_path = "./hunspell/src/hunspell" input_sources = ["affentry.cxx", "affixmgr.cxx", "csutil.cxx", "dictmgr.cxx", "hashmgr.cxx", "hunspell.cxx", "hunzip.cxx", "phonet.cxx", "replist.cxx", "suggestmgr.cxx"] sources = [] for item in input_sources: if base.is_file(libhunspell_src_path + "/" + item): sources.append(libhunspell_src_path + "/" + item) if (13 == version_hunspell): sources.append("./wasm/src/filemgr_wrapper.cxx") else: sources.append("./wasm/src/filemgr_wrapper_new.cxx") sources.append("./wasm/src/base.cpp") compiler_flags.append("-I" + libhunspell_src_path) compiler_flags.append("-DWIN32 -DNDEBUG -DHUNSPELL_STATIC -DBUILDING_LIBHUNSPELL -DHUNSPELL_WASM_MODULE") # arguments arguments = "" for item in compiler_flags: arguments += (item + " ") arguments += "-s EXPORTED_FUNCTIONS=\"[" for item in exported_functions: arguments += ("'" + item + "',") arguments = arguments[:-1] arguments += "]\" " for item in sources: arguments += (item + " ") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_js_content = engine_base_js_content.replace("//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell.js", engine_js_content) base.copy_file("spell.wasm", "./deploy/spell/spell.wasm") # ie asm version arguments = arguments.replace("WASM=1", "WASM=0") # command windows_bat = [] if (base.host_platform() == "windows"): windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) else: windows_bat.append("#!/bin/bash") windows_bat.append("source ./emsdk/emsdk_env.sh") windows_bat.append("emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./spell.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){self.onEngineInit();}];") base.replaceInFile("./spell.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") spell_js_content = base.readFile("./spell.js") engine_base_js_content = base.readFile("./wasm/js/spell.js") engine_base_js_polyfill = base.readFile("./wasm/js/polyfill.js") engine_js_content = engine_base_js_polyfill + "\n\n" + engine_base_js_content.replace("//module", spell_js_content) # write new version base.writeFile("./deploy/spell/spell_ie.js", engine_js_content) base.copy_file("spell.js.mem", "./deploy/spell/spell.js.mem") base.copy_file("./wasm/js/code.js", "./deploy/spell.js") base.copy_file("./wasm/js/index.html", "./deploy/index.html") base.delete_file("spell.js") base.delete_file("spell.js.mem") os.chdir(old_cur_dir)
def make(): git_dir = base.get_script_dir() + "/../.." old_cur = os.getcwd() work_dir = git_dir + "/server/FileConverter/bin" if not base.is_dir(work_dir): base.create_dir(work_dir) os.chdir(work_dir) arch = "x64" arch2 = "_64" if ("windows" == base.host_platform()) and not base.host_platform_is64(): arch = "x86" arch2 = "_32" url = "http://repo-doc-onlyoffice-com.s3.amazonaws.com/" + base.host_platform( ) + "/core/" + config.option("branch") + "/latest/" + arch + "/core.7z" data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./core.7z.data") if (old_data_url != data_url): print("-----------------------------------------------------------") print("Downloading core last version... --------------------------") print("-----------------------------------------------------------") if (base.is_file("./core.7z")): base.delete_file("./core.7z") if (base.is_dir("./core")): base.delete_dir("./core") if (base.is_dir("./HtmlFileInternal")): base.delete_dir("./HtmlFileInternal") base.download(url, "./core.7z") print("-----------------------------------------------------------") print("Extracting core last version... ---------------------------") print("-----------------------------------------------------------") base.extract("./core.7z", "./") base.writeFile("./core.7z.data", data_url) platform = "" if ("windows" == base.host_platform()): platform = "win" + arch2 else: platform = base.host_platform() + arch2 base.copy_files("./core/*", "./") base.generate_doctrenderer_config("./DoctRenderer.config", "../../../sdkjs/deploy/", "server", "../../../web-apps/vendor/") base.support_old_versions_plugins(git_dir + "/sdkjs-plugins") if base.is_dir(git_dir + "/fonts"): base.delete_dir(git_dir + "/fonts") base.create_dir(git_dir + "/fonts") if ("mac" == base.host_platform()): base.mac_correct_rpath_x2t("./") print("-----------------------------------------------------------") print("All fonts generation... -----------------------------------") print("-----------------------------------------------------------") base.cmd_exe("./allfontsgen", [ "--input=../../../core-fonts", "--allfonts-web=../../../sdkjs/common/AllFonts.js", "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images", "--selection=./font_selection.bin", "--use-system=true", "--output-web=../../../fonts" ]) print("All presentation themes generation... ---------------------") print("-----------------------------------------------------------") base.cmd_exe("./allthemesgen", [ "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"" ]) # add directories to open directories data_local_devel = "{\n" data_local_devel += "\"services\": {\n" data_local_devel += "\"CoAuthoring\": {\n" data_local_devel += "\"server\": {\n" data_local_devel += "\"static_content\": {\n" is_exist_addons = False for addon in config.sdkjs_addons: data_local_devel += ("\"/" + config.sdkjs_addons[addon] + "\" : { \"path\": \"../../../" + config.sdkjs_addons[addon] + "\" },\n") is_exist_addons = True for addon in config.web_apps_addons: data_local_devel += ("\"/" + config.web_apps_addons[addon] + "\" : { \"path\": \"../../../" + config.web_apps_addons[addon] + "\" },\n") is_exist_addons = True if is_exist_addons: data_local_devel = data_local_devel[:-2] data_local_devel += "\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" data_local_devel += "}\n" base.writeFile( git_dir + "/server/Common/config/local-development-" + base.host_platform() + ".json", data_local_devel) os.chdir(old_cur) return
def make(): git_dir = base.get_script_dir() + "/../.." old_cur = os.getcwd() work_dir = git_dir + "/server/FileConverter/bin" if not base.is_dir(work_dir): base.create_dir(work_dir) os.chdir(work_dir) arch = "x64" arch2 = "_64" if ("windows" == base.host_platform()) and not base.host_platform_is64(): arch = "x86" arch2 = "_32" url = get_core_url(arch, config.option("branch")) data_url = base.get_file_last_modified_url(url) if (data_url == "" and config.option("branch") != "develop"): url = get_core_url(arch, "develop") data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./core.7z.data") if (data_url != "" and old_data_url != data_url): print("-----------------------------------------------------------") print("Downloading core last version... --------------------------") print("-----------------------------------------------------------") if (base.is_file("./core.7z")): base.delete_file("./core.7z") if (base.is_dir("./core")): base.delete_dir("./core") base.download(url, "./core.7z") print("-----------------------------------------------------------") print("Extracting core last version... ---------------------------") print("-----------------------------------------------------------") base.extract("./core.7z", "./") base.writeFile("./core.7z.data", data_url) platform = "" if ("windows" == base.host_platform()): platform = "win" + arch2 else: platform = base.host_platform() + arch2 base.copy_files("./core/*", "./") else: print("-----------------------------------------------------------") print("Core is up to date. ---------------------------------------") print("-----------------------------------------------------------") base.generate_doctrenderer_config("./DoctRenderer.config", "../../../sdkjs/deploy/", "server", "../../../web-apps/vendor/") base.support_old_versions_plugins(git_dir + "/sdkjs-plugins") if base.is_dir(git_dir + "/fonts"): base.delete_dir(git_dir + "/fonts") base.create_dir(git_dir + "/fonts") if ("mac" == base.host_platform()): base.mac_correct_rpath_x2t("./") print("-----------------------------------------------------------") print("All fonts generation... -----------------------------------") print("-----------------------------------------------------------") base.cmd_exe("./allfontsgen", [ "--input=../../../core-fonts", "--allfonts-web=../../../sdkjs/common/AllFonts.js", "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images", "--selection=./font_selection.bin", "--use-system=true", "--output-web=../../../fonts" ]) print("All presentation themes generation... ---------------------") print("-----------------------------------------------------------") base.cmd_exe("./allthemesgen", [ "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"" ]) #print("- allthemesgen (ios) --------------------------------------") #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=ios", "--params=280,224"]) # android #print("- allthemesgen (android) ----------------------------------") #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=android", "--params=280,224"]) # add directories to open directories addon_base_path = "../../../" server_config = {} static_content = {} sql = {} server_addons = [] if (config.option("server-addons") != ""): server_addons = config.option("server-addons").rsplit(", ") if ("server-lockstorage" in server_addons): server_config["editorDataStorage"] = "editorDataRedis" sdkjs_addons = [] if (config.option("sdkjs-addons") != ""): sdkjs_addons = config.option("sdkjs-addons").rsplit(", ") for addon in sdkjs_addons: static_content["/" + addon] = {"path": addon_base_path + addon} web_apps_addons = [] if (config.option("web-apps-addons") != ""): web_apps_addons = config.option("web-apps-addons").rsplit(", ") for addon in web_apps_addons: static_content["/" + addon] = {"path": addon_base_path + addon} if (config.option("external-folder") != ""): external_folder = config.option("external-folder") static_content["/sdkjs"] = { "path": addon_base_path + external_folder + "/sdkjs" } static_content["/web-apps"] = { "path": addon_base_path + external_folder + "/web-apps" } if (config.option("sql-type") != ""): sql["type"] = config.option("sql-type") if (config.option("db-port") != ""): sql["dbPort"] = config.option("db-port") if (config.option("db-user") != ""): sql["dbUser"] = config.option("db-user") if (config.option("db-pass") != ""): sql["dbPass"] = config.option("db-pass") server_config["static_content"] = static_content json_file = git_dir + "/server/Common/config/local-development-" + base.host_platform( ) + ".json" base.writeFile( json_file, json.dumps( { "services": { "CoAuthoring": { "server": server_config, "sql": sql } } }, indent=2)) os.chdir(old_cur) return
def make(packages): base_dir = base.get_script_dir() + "/../out" git_dir = base.get_script_dir() + "/../.." for package in packages: if -1 != package.find("diskimage"): macos_dir = os.path.abspath(git_dir + "/desktop-apps/macos") update_dir = macos_dir + "/build/update" changes_dir = macos_dir + "/ONLYOFFICE/update/updates/ONLYOFFICE/changes" if (package == "diskimage-x86_64"): lane = "release_x86_64" scheme = "ONLYOFFICE-x86_64" elif (package == "diskimage-v8-x86_64"): lane = "release_v8" scheme = "ONLYOFFICE-v8" elif (package == "diskimage-arm64"): lane = "release_arm" scheme = "ONLYOFFICE-arm" else: exit(1) print("Build package " + scheme) print("$ bundler exec fastlane " + lane + " skip_git_bump:true") base.cmd_in_dir(macos_dir, "bundler", ["exec", "fastlane", lane, "skip_git_bump:true"]) print("Build updates") app_version = base.run_command( "/usr/libexec/PlistBuddy -c 'print :CFBundleShortVersionString' " + macos_dir + "/build/ONLYOFFICE.app/Contents/Info.plist")['stdout'] zip_filename = scheme + "-" + app_version macos_zip = macos_dir + "/build/" + zip_filename + ".zip" update_storage_dir = base.get_env( "ARCHIVES_DIR") + "/" + scheme + "/_updates" base.create_dir(update_dir) base.copy_dir_content(update_storage_dir, update_dir, ".zip") base.copy_dir_content(update_storage_dir, update_dir, ".html") base.copy_file(macos_zip, update_dir) notes_src = changes_dir + "/" + app_version + "/ReleaseNotes.html" notes_dst = update_dir + "/" + zip_filename + ".html" cur_date = base.run_command( "LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"")['stdout'] if base.is_exist(notes_src): base.copy_file(notes_src, notes_dst) base.replaceInFileRE( notes_dst, r"(<span class=\"releasedate\">).+(</span>)", "\\1 - " + cur_date + "\\2") else: base.writeFile(notes_dst, "placeholder\n") notes_src = changes_dir + "/" + app_version + "/ReleaseNotesRU.html" notes_dst = update_dir + "/" + zip_filename + ".ru.html" cur_date = base.run_command( "LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"")['stdout'] if base.is_exist(notes_src): base.copy_file(notes_src, notes_dst) base.replaceInFileRE( notes_dst, r"(<span class=\"releasedate\">).+(</span>)", "\\1 - " + cur_date + "\\2") else: base.writeFile(notes_dst, "placeholder\n") print("$ ./generate_appcast " + update_dir) base.cmd(macos_dir + "/Vendor/Sparkle/bin/generate_appcast", [update_dir]) print("Edit Sparkle appcast links") sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac" if (package == "diskimage-x86_64"): sparkle_base_url += "/x86_64" elif (package == "diskimage-v8-x86_64"): sparkle_base_url += "/v8" elif (package == "diskimage-arm64"): sparkle_base_url += "/arm" base.replaceInFileRE( update_dir + "/onlyoffice.xml", r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)", "\\1" + sparkle_base_url + "/updates/changes/\\2/ReleaseNotes.html\\3") base.replaceInFileRE( update_dir + "/onlyoffice.xml", r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)", "\\1" + sparkle_base_url + "/updates/changes/\\2/ReleaseNotesRU.html\\3") base.replaceInFileRE(update_dir + "/onlyoffice.xml", r"(url=\")(?:.+/)(ONLYOFFICE.+\")", "\\1" + sparkle_base_url + "/updates/\\2") print("Delete unnecessary files") for file in os.listdir(update_dir): if (-1 == file.find(app_version)) and (file.endswith(".zip") or file.endswith(".html")): base.delete_file(update_dir + "/" + file) return
for item in exported_functions: arguments += ("'" + item + "',") arguments = arguments[:-1] arguments += "]\" " for item in sources: arguments += (item + " ") # command windows_bat = [] windows_bat.append("call emsdk/emsdk_env.bat") windows_bat.append("call emcc " + arguments) base.run_as_bat(windows_bat) # finalize base.replaceInFile("./fonts.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){window[\"AscFonts\"].onLoadModule();}];") base.replaceInFile("./fonts.js", "function getBinaryPromise(){", "function getBinaryPromise2(){") fonts_js_content = base.readFile("fonts.js") engine_base_js_content = base.readFile("../engine_base.js") engine_js_content = engine_base_js_content.replace("//module", fonts_js_content) # remove previous version if base.is_file("../engine.js"): base.delete_file("../engine.js") if base.is_file("../fonts.wasm"): base.delete_file("../fonts.wasm") # write new version base.writeFile("../engine.js", engine_js_content) base.copy_file("fonts.wasm", "../fonts.wasm")