From 4cdbfbfb86958cad168f7d2ffa243062784c450a Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Mon, 12 Aug 2024 18:24:51 +0400 Subject: [PATCH 01/53] Deploy JNI helper dynamic library --- scripts/base.py | 2 +- scripts/deploy_builder.py | 4 +++- sln.json | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index 86df1472..32908534 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1272,7 +1272,7 @@ def linux_set_origin_rpath_libraries(dir, libs): return def linux_correct_rpath_docbuilder(dir): - linux_set_origin_rpath_libraries(dir, ["docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so"]) + linux_set_origin_rpath_libraries(dir, ["docbuilder.jni.so", "docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so"]) return def common_check_version(name, good_version, clean_func): diff --git a/scripts/deploy_builder.py b/scripts/deploy_builder.py index 808e7b55..2bef32d6 100644 --- a/scripts/deploy_builder.py +++ b/scripts/deploy_builder.py @@ -76,9 +76,11 @@ def make(): if (0 == platform.find("win")): base.copy_file(core_build_dir + "/lib/" + platform_postfix + "/doctrenderer.lib", root_dir + "/doctrenderer.lib") base.copy_v8_files(core_dir, root_dir, platform, isWindowsXP) + # python wrapper base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "docbuilder.c") - base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py", root_dir + "/docbuilder.py") + # java wrapper + base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "docbuilder.jni") # app base.copy_exe(core_build_dir + "/bin/" + platform_postfix, root_dir, "docbuilder") diff --git a/sln.json b/sln.json index ecd3f438..f056c2f7 100644 --- a/sln.json +++ b/sln.json @@ -24,6 +24,7 @@ "core/DesktopEditor/doctrenderer/doctrenderer.pro", "core/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder_func_lib.pro", + "core/DesktopEditor/doctrenderer/docbuilder.java/src/jni/docbuilder_jni.pro", "[!no_x2t]core/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro", "[!no_x2t]core/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro", From 5bc8ca2266014060d33fc72acc51cdeabe179e7d Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Mon, 12 Aug 2024 18:42:18 +0400 Subject: [PATCH 02/53] Build and deploy JAR --- scripts/deploy_builder.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/deploy_builder.py b/scripts/deploy_builder.py index 2bef32d6..aae1f6c2 100644 --- a/scripts/deploy_builder.py +++ b/scripts/deploy_builder.py @@ -81,6 +81,8 @@ def make(): base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py", root_dir + "/docbuilder.py") # java wrapper base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "docbuilder.jni") + base.cmd_in_dir(core_dir + "/DesktopEditor/doctrenderer/docbuilder.java", "python", ["make.py"]) + base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.java/build/libs/docbuilder.jar", root_dir + "/docbuilder.jar") # app base.copy_exe(core_build_dir + "/bin/" + platform_postfix, root_dir, "docbuilder") From b3987b0ad5d90379575ad9fe5cfcab163ec65ede Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Tue, 13 Aug 2024 20:42:54 +0400 Subject: [PATCH 03/53] Move build of Java wrapper to `build_sln.py` --- scripts/build_sln.py | 11 +++++++++++ scripts/deploy_builder.py | 1 - scripts/qmake.py | 6 +++--- sln.json | 1 - 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/build_sln.py b/scripts/build_sln.py index 69074369..92e3e750 100644 --- a/scripts/build_sln.py +++ b/scripts/build_sln.py @@ -46,4 +46,15 @@ def make(solution=""): else: base.make_sln_project("../core/DesktopEditor/doctrenderer/docbuilder.com/src", "docbuilder.com.sln") base.restorePathForBuilder(new_replace_path) + + # build Java docbuilder wrapper + if config.check_option("module", "builder") and "onlyoffice" == config.branding(): + for platform in platforms: + if not platform in config.platforms: + continue + # build JNI library + qmake.make(platform, os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.java/src/jni/docbuilder_jni.pro", "", True) + # build Java code to JAR + base.cmd_in_dir(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.java", "python", ["make.py"]) + return diff --git a/scripts/deploy_builder.py b/scripts/deploy_builder.py index aae1f6c2..82e970ac 100644 --- a/scripts/deploy_builder.py +++ b/scripts/deploy_builder.py @@ -81,7 +81,6 @@ def make(): base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py", root_dir + "/docbuilder.py") # java wrapper base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir, "docbuilder.jni") - base.cmd_in_dir(core_dir + "/DesktopEditor/doctrenderer/docbuilder.java", "python", ["make.py"]) base.copy_file(core_dir + "/DesktopEditor/doctrenderer/docbuilder.java/build/libs/docbuilder.jar", root_dir + "/docbuilder.jar") # app diff --git a/scripts/qmake.py b/scripts/qmake.py index def7bc1b..ceef7378 100644 --- a/scripts/qmake.py +++ b/scripts/qmake.py @@ -29,7 +29,7 @@ def check_support_platform(platform): return False return True -def make(platform, project, qmake_config_addon=""): +def make(platform, project, qmake_config_addon="", is_no_errors=False): # check platform if not check_support_platform(platform): print("THIS PLATFORM IS NOT SUPPORTED") @@ -100,7 +100,7 @@ def make(platform, project, qmake_config_addon=""): base.cmd_and_return_cwd("make", distclean_params, True) base.cmd(qmake_app, build_params) base.correct_makefile_after_qmake(platform, makefile) - base.cmd_and_return_cwd("make", ["-f", makefile] + get_j_num()) + base.cmd_and_return_cwd("make", ["-f", makefile] + get_j_num(), is_no_errors) else: config_params_array = base.qt_config_as_param(config_param) config_params_string = "" @@ -123,7 +123,7 @@ def make(platform, project, qmake_config_addon=""): if ("0" != config.option("multiprocess")): qmake_bat.append("set CL=/MP") qmake_bat.append("call nmake -f " + makefile) - base.run_as_bat(qmake_bat) + base.run_as_bat(qmake_bat, is_no_errors) if (base.is_file(stash_file)): base.delete_file(stash_file) diff --git a/sln.json b/sln.json index f056c2f7..ecd3f438 100644 --- a/sln.json +++ b/sln.json @@ -24,7 +24,6 @@ "core/DesktopEditor/doctrenderer/doctrenderer.pro", "core/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder_func_lib.pro", - "core/DesktopEditor/doctrenderer/docbuilder.java/src/jni/docbuilder_jni.pro", "[!no_x2t]core/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro", "[!no_x2t]core/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro", From f50d5d2cd10d94c0bb917ae8e97028d90302a82c Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Wed, 14 Aug 2024 15:54:07 +0400 Subject: [PATCH 04/53] Fix path problems on mac --- scripts/build_sln.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build_sln.py b/scripts/build_sln.py index 92e3e750..5f0d4d11 100644 --- a/scripts/build_sln.py +++ b/scripts/build_sln.py @@ -52,9 +52,10 @@ def make(solution=""): for platform in platforms: if not platform in config.platforms: continue + # build JNI library - qmake.make(platform, os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.java/src/jni/docbuilder_jni.pro", "", True) + qmake.make(platform, base.get_script_dir() + "/../../core/DesktopEditor/doctrenderer/docbuilder.java/src/jni/docbuilder_jni.pro", "", True) # build Java code to JAR - base.cmd_in_dir(os.getcwd() + "/../core/DesktopEditor/doctrenderer/docbuilder.java", "python", ["make.py"]) + base.cmd_in_dir(base.get_script_dir() + "/../../core/DesktopEditor/doctrenderer/docbuilder.java", "python", ["make.py"]) return From e1cc7f3c839d201a4423acb83dbf00c66ed65e1c Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Wed, 14 Aug 2024 19:24:34 +0400 Subject: [PATCH 05/53] Fix libraries not loading on mac --- scripts/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/base.py b/scripts/base.py index 32908534..cf4719d3 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1226,7 +1226,12 @@ def mac_correct_rpath_docbuilder(dir): cmd("install_name_tool", ["-add_rpath", "@executable_path", "./docbuilder"], True) mac_correct_rpath_binary("./docbuilder", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"]) mac_correct_rpath_library("docbuilder.c", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer"]) - cmd("install_name_tool", ["-add_rpath", "@loader_path", "libdocbuilder.c.dylib"], True) + + def add_loader_path_to_rpath(libs): + for lib in libs: + cmd("install_name_tool", ["-add_rpath", "@loader_path", "lib" + lib + ".dylib"], True) + + add_loader_path_to_rpath(["icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer", "docbuilder.c"]) os.chdir(cur_dir) return From d812ba379b6776af94bba626ac352ee6c809e973 Mon Sep 17 00:00:00 2001 From: Nikita Khromov Date: Fri, 16 Aug 2024 19:28:56 +0700 Subject: [PATCH 06/53] [jsdoc] Fixed paths generation --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index ea4dc39d..ac33a1c7 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -69,9 +69,9 @@ def replace_with_links(match): element = match.group(1).strip() base_type = element.split('.')[0] # Take only the first part before the dot, if any if any(enum['name'] == base_type for enum in enumerations): - return f"<[{element}](../../Enumeration/{base_type}.md)>" + return f"<[{element}]({root}Enumeration/{base_type}.md)>" elif base_type in classes: - return f"<[{element}](../../{base_type}/{base_type}.md)>" + return f"<[{element}]({root}{base_type}/{base_type}.md)>" return f"<{element}>" return re.sub(r'<([^<>]+)>', replace_with_links, param_types_md) From 9481e0158117701882b2285bcd9a2fd222b0b22f Mon Sep 17 00:00:00 2001 From: Nikita Khromov Date: Fri, 16 Aug 2024 20:04:51 +0700 Subject: [PATCH 07/53] [jsdoc] Replacing line breaks with spaces --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index ac33a1c7..bdb6a8cc 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -53,7 +53,7 @@ def correct_default_value(value, enumerations, classes): return generate_data_types_markdown([value], enumerations, classes) def remove_line_breaks(string): - return re.sub(r'[\r\n]', '', string) + return re.sub(r'[\r\n]', ' ', string) def generate_data_types_markdown(types, enumerations, classes, root='../../'): param_types_md = ' |'.join(types) From 3baee0c14e2892591e6a85c38b17ad98d177515b Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 22 Aug 2024 14:07:05 +0300 Subject: [PATCH 08/53] Move pro to builder module --- sln.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sln.json b/sln.json index 6a596c5f..63b71147 100644 --- a/sln.json +++ b/sln.json @@ -27,7 +27,6 @@ "core/DocxRenderer/DocxRenderer.pro", "core/DesktopEditor/doctrenderer/doctrenderer.pro", - "core/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder_func_lib.pro", "[!no_x2t]core/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro", "[!no_x2t]core/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro", @@ -66,7 +65,8 @@ ], "builder" : [ - "core" + "core", + "core/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder_func_lib.pro" ], "server" : [ From a2c00deba2cdec018978da5f0a60cd8aa2b7a03a Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Mon, 26 Aug 2024 14:20:14 +0300 Subject: [PATCH 09/53] Add function for portable test utilities --- scripts/base.py | 35 ++++++++++++++++++++++++++++++++ scripts/develop/config_server.py | 8 ++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index cf4719d3..53151c30 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -39,6 +39,9 @@ def is_os_arm(): return False return True +def get_platform(): + return platform.machine().lower() + def is_python_64bit(): return (struct.calcsize("P") == 8) @@ -1760,3 +1763,35 @@ def apply_patch(file, patch): #file_content_new = "\n#if 0" + file_content_old + "#else" + file_content_new + "#endif\n" replaceInFile(file, file_content_old, file_content_new) return + +def get_autobuild_version(product, platform="", branch="", build=""): + download_platform = platform + if ("" == download_platform): + osType = get_platform() + isArm = True if (-1 != osType.find("arm")) else False + is64 = True if (osType.endswith("64")) else False + + if ("windows" == host_platform()): + download_platform = "win-" + elif ("linux" == host_platform()): + download_platform = "linux-" + else: + download_platform = "mac-" + + download_platform += ("arm" if isArm else "") + download_platform += ("64" if is64 else "32") + else: + download_platform = download_platform.replace("_", "-") + + download_build = build + if ("" == download_build): + download_build = "latest" + + download_branch = branch + if ("" == download_branch): + download_branch = "develop" + + download_addon = download_branch + "/" + download_build + "/" + product + "-" + download_platform + ".7z" + return "http://repo-doc-onlyoffice-com.s3.amazonaws.com/archive/" + download_addon + + diff --git a/scripts/develop/config_server.py b/scripts/develop/config_server.py index f2eb67e6..933490d3 100644 --- a/scripts/develop/config_server.py +++ b/scripts/develop/config_server.py @@ -5,10 +5,6 @@ import os import json -def get_core_url(platform, branch): - return "http://repo-doc-onlyoffice-com.s3.amazonaws.com/archive/" \ - + branch + "/latest/core-" + platform.replace("_", "-") + ".7z" - def make(): git_dir = base.get_script_dir() + "/../.." old_cur = os.getcwd() @@ -32,10 +28,10 @@ def make(): else: platform = base.host_platform() + arch2 - url = get_core_url(platform, config.option("branch")) + url = base.get_autobuild_version("core", "", config.option("branch")) data_url = base.get_file_last_modified_url(url) if (data_url == "" and config.option("branch") != "develop"): - url = get_core_url(platform, "develop") + url = base.get_autobuild_version("core", "", "develop") data_url = base.get_file_last_modified_url(url) old_data_url = base.readFile("./core.7z.data") From 70e9fbabce009982f237e8cc8802862b87ea8e2d Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Tue, 27 Aug 2024 21:44:41 +0300 Subject: [PATCH 10/53] [web-apps] copy api.js as api.js.tpl for server package --- scripts/deploy_server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/deploy_server.py b/scripts/deploy_server.py index c41e49e7..429027bb 100644 --- a/scripts/deploy_server.py +++ b/scripts/deploy_server.py @@ -114,6 +114,7 @@ def make(): js_dir = root_dir base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs") base.copy_dir(base_dir + "/js/" + branding + "/builder/web-apps", js_dir + "/web-apps") + base.copy_file(js_dir + "/web-apps/apps/api/documents/api.js", js_dir + "/web-apps/apps/api/documents/api.js.tpl") for file in glob.glob(js_dir + "/web-apps/apps/*/*/*.js.map") \ + glob.glob(js_dir + "/web-apps/apps/*/mobile/dist/js/*.js.map"): base.delete_file(file) From 9161aa15569e5039caece43994a90b705b4b070a Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Wed, 28 Aug 2024 13:06:12 +0300 Subject: [PATCH 11/53] Add generate snapshots --- scripts/base.py | 7 +++++++ scripts/deploy_builder.py | 2 ++ scripts/deploy_core.py | 5 +++++ scripts/deploy_desktop.py | 2 ++ scripts/deploy_server.py | 2 ++ scripts/develop/config_server.py | 13 ------------- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index 53151c30..95698348 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1794,4 +1794,11 @@ def get_autobuild_version(product, platform="", branch="", build=""): download_addon = download_branch + "/" + download_build + "/" + product + "-" + download_platform + ".7z" return "http://repo-doc-onlyoffice-com.s3.amazonaws.com/archive/" + download_addon +def create_x2t_js_cache(dir, product): + if is_file(dir + "/libdoctrenderer.dylib") and (os.path.getsize(dir + "/libdoctrenderer.dylib") < 5*1024*1024): + return + if (product in ["builder", "server"]) + cmd_in_dir(dir, "./x2t", ["-create-js-cache"]) + cmd_in_dir(dir, "./x2t", ["-create-js-snapshots"]) + return diff --git a/scripts/deploy_builder.py b/scripts/deploy_builder.py index 82e970ac..bee66812 100644 --- a/scripts/deploy_builder.py +++ b/scripts/deploy_builder.py @@ -123,6 +123,8 @@ def make(): if (0 == platform.find("mac")): base.mac_correct_rpath_x2t(root_dir) base.mac_correct_rpath_docbuilder(root_dir) + + base.create_x2t_js_cache(root_dir, "builder") return diff --git a/scripts/deploy_core.py b/scripts/deploy_core.py index 9f7ad71c..ac1c3281 100644 --- a/scripts/deploy_core.py +++ b/scripts/deploy_core.py @@ -64,6 +64,11 @@ def make(): base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "metafiletester") base.copy_exe(core_build_dir + "/bin/" + platform_postfix, archive_dir, "dictionariestester") + # js cache + base.generate_doctrenderer_config(archive_dir + "/DoctRenderer.config", "./", "builder", "", "./dictionaries") + base.create_x2t_js_cache(archive_dir, "core") + base.delete_file(archive_dir + "/DoctRenderer.config") + # dictionaries base.copy_dictionaries(git_dir + "/dictionaries", archive_dir + "/dictionaries", True, False) return diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index dde9f888..9e48de18 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -260,6 +260,8 @@ def make(): if isUseJSC: base.delete_file(root_dir + "/converter/icudtl.dat") + base.create_x2t_js_cache(root_dir + "/converter", "desktop") + if (0 == platform.find("win")): base.delete_file(root_dir + "/cef_sandbox.lib") base.delete_file(root_dir + "/libcef.lib") diff --git a/scripts/deploy_server.py b/scripts/deploy_server.py index c41e49e7..514220e5 100644 --- a/scripts/deploy_server.py +++ b/scripts/deploy_server.py @@ -118,6 +118,8 @@ def make(): + glob.glob(js_dir + "/web-apps/apps/*/mobile/dist/js/*.js.map"): base.delete_file(file) + base.create_x2t_js_cache(converter_dir, "server") + # add embed worker code base.cmd_in_dir(git_dir + "/sdkjs/common/embed", "python", ["make.py", js_dir + "/web-apps/apps/api/documents/api.js"]) diff --git a/scripts/develop/config_server.py b/scripts/develop/config_server.py index 933490d3..a7118c5a 100644 --- a/scripts/develop/config_server.py +++ b/scripts/develop/config_server.py @@ -15,19 +15,6 @@ def make(): os.chdir(work_dir) - arch = "x64" - arch2 = "_64" - if base.is_windows() and not base.host_platform_is64(): - arch = "x86" - arch2 = "_32" - if base.is_os_arm(): - arch2 = "_arm64" - platform = "" - if base.is_windows(): - platform = "win" + arch2 - else: - platform = base.host_platform() + arch2 - url = base.get_autobuild_version("core", "", config.option("branch")) data_url = base.get_file_last_modified_url(url) if (data_url == "" and config.option("branch") != "develop"): From 341671a612354bf437510aabe000a05046ad3778 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Wed, 28 Aug 2024 13:10:29 +0300 Subject: [PATCH 12/53] Fix typo --- scripts/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/base.py b/scripts/base.py index 95698348..271c034b 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1798,7 +1798,7 @@ def create_x2t_js_cache(dir, product): if is_file(dir + "/libdoctrenderer.dylib") and (os.path.getsize(dir + "/libdoctrenderer.dylib") < 5*1024*1024): return - if (product in ["builder", "server"]) + if (product in ["builder", "server"]): cmd_in_dir(dir, "./x2t", ["-create-js-cache"]) cmd_in_dir(dir, "./x2t", ["-create-js-snapshots"]) return From 6bd525c3b4f9f5633fca54f2ef31686c0dbbe289 Mon Sep 17 00:00:00 2001 From: Nikita Khromov Date: Wed, 28 Aug 2024 17:29:12 +0700 Subject: [PATCH 13/53] [jsdoc] Fixed output path --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index bdb6a8cc..be6be118 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -247,7 +247,7 @@ def generate(output_dir): os.makedirs(output_dir + f'/{editor_name.title()}', exist_ok=True) data = load_json(input_file) - process_doclets(data, output_dir + f'/{editor_name}') + process_doclets(data, output_dir + f'/{editor_name.title()}') shutil.rmtree(output_dir + 'tmp_json') print('Done') From d1344dab71b8bedf342148b47bb10906c4678627 Mon Sep 17 00:00:00 2001 From: Nikita Khromov Date: Wed, 28 Aug 2024 18:00:53 +0700 Subject: [PATCH 14/53] [jsdoc] Fixed creating data types. --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index be6be118..f5c2ce13 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -72,7 +72,7 @@ def replace_with_links(match): return f"<[{element}]({root}Enumeration/{base_type}.md)>" elif base_type in classes: return f"<[{element}]({root}{base_type}/{base_type}.md)>" - return f"<{element}>" + return f"<{element}>" return re.sub(r'<([^<>]+)>', replace_with_links, param_types_md) From 414af6bdb0c1adeaf80bb03e3522b718d4023b71 Mon Sep 17 00:00:00 2001 From: Nikita Khromov Date: Thu, 29 Aug 2024 14:27:47 +0700 Subject: [PATCH 15/53] [jsdoc] Fixed style --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index f5c2ce13..b21bd249 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -56,7 +56,7 @@ def remove_line_breaks(string): return re.sub(r'[\r\n]', ' ', string) def generate_data_types_markdown(types, enumerations, classes, root='../../'): - param_types_md = ' |'.join(types) + param_types_md = ' | '.join(types) for enum in enumerations: if enum['name'] in types: From f09eeb19e56c87f13c8b39924e294113648c3129 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 29 Aug 2024 23:19:21 +0300 Subject: [PATCH 16/53] Fix generation on linux --- scripts/sdkjs_common/jsdoc/generate_docs_json.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_json.py index b920dba4..adc0329b 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_json.py @@ -3,6 +3,7 @@ import json import argparse import re +import platform root = '../../../..' @@ -35,7 +36,10 @@ def generate(output_dir, md=False): for config in configs: editor_name = config.split('/')[-1].replace('.json', '') output_file = os.path.join(output_dir, editor_name + ".json") - command = f"set EDITOR={editors_maps[editor_name]} && npx jsdoc -c {config} -X > {output_file}" + command_set_env = "export" + if (platform.system().lower() == "windows"): + command_set_env = "set" + command = f"{command_set_env} EDITOR={editors_maps[editor_name]} && npx jsdoc -c {config} -X > {output_file}" print(f"Generating {editor_name}.json: {command}") subprocess.run(command, shell=True) From c29ac1549fe46428b48219f33ec9af392af62476 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 08:26:58 +0300 Subject: [PATCH 17/53] Update README.md fix default path --- scripts/sdkjs_common/jsdoc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/README.md b/scripts/sdkjs_common/jsdoc/README.md index 01c14063..66ba9b17 100644 --- a/scripts/sdkjs_common/jsdoc/README.md +++ b/scripts/sdkjs_common/jsdoc/README.md @@ -48,7 +48,7 @@ This script generates Markdown documentation from the `apiBuilder.js` files. ``` - **Parameters**: - - `output_path` (optional): The directory where the Markdown documentation will be saved. If not specified, the default path is `Onlyoffice/office-js-api`. + - `output_path` (optional): The directory where the Markdown documentation will be saved. If not specified, the default path is `../../../../office-js-api/`. ## Example From 1ad87383e3324a8465820fa7ae1b337ff6086780 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 08:31:45 +0300 Subject: [PATCH 18/53] Update README.md fix Requirements and Installation --- scripts/sdkjs_common/jsdoc/README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/README.md b/scripts/sdkjs_common/jsdoc/README.md index 66ba9b17..246e94b0 100644 --- a/scripts/sdkjs_common/jsdoc/README.md +++ b/scripts/sdkjs_common/jsdoc/README.md @@ -3,14 +3,20 @@ This guide explains how to generate documentation for Onlyoffice Builder/Plugins API using the provided Python scripts: `generate_docs_json.py`, `generate_docs_plugins_json.py`, `generate_docs_md.py`. These scripts are used to create JSON and Markdown documentation for the `apiBuilder.js` files from the word, cell, and slide editors. -## Prerequisites +## Requirements -1. **Node.js and npm**: Ensure you have Node.js and npm installed on your machine. You can download them from [Node.js official website](https://nodejs.org/). +```bash +Node.js v20 and above +Python v3.10 and above +``` + +## Installation -2. **jsdoc**: The scripts use `jsdoc` to generate documentation. Install it using npm: - ```bash - npm install - ``` +```bash +git clone https://github.com/ONLYOFFICE/build_tools.git +cd build_tools/scripts/sdkjs_common/jsdoc +npm install +``` ## Scripts Overview From 78561ca6599a799fe5b7a40e3a423ecfa98665ac Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:25:23 +0300 Subject: [PATCH 19/53] Update README.md --- scripts/sdkjs_common/jsdoc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/README.md b/scripts/sdkjs_common/jsdoc/README.md index 246e94b0..2b0fc0f3 100644 --- a/scripts/sdkjs_common/jsdoc/README.md +++ b/scripts/sdkjs_common/jsdoc/README.md @@ -30,7 +30,7 @@ This script generates JSON documentation based on the `apiBuilder.js` files. ``` - **Parameters**: - - `output_path` (optional): The directory where the JSON documentation will be saved. If not specified, the default path is `Onlyoffice/document-builder-declarations/document-builder`. + - `output_path` (optional): The directory where the JSON documentation will be saved. If not specified, the default path is `../../../../office-js-api-declarations/office-js-api`. ### `generate_docs_plugins_json.py` From e9c9712e52ddea39458c502b6b3f316f6f25d7cb Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:25:34 +0300 Subject: [PATCH 20/53] Update generate_docs_json.py change default path --- scripts/sdkjs_common/jsdoc/generate_docs_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_json.py index adc0329b..ef60ae0e 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_json.py @@ -134,7 +134,7 @@ def get_current_branch(path): type=str, help="Destination directory for the generated documentation", nargs='?', # Indicates the argument is optional - default=f"{root}/document-builder-declarations/document-builder" # Default value + default=f"{root}/office-js-api-declarations/office-js-api" ) args = parser.parse_args() From da1a4ba393321bfc4b02baa4289f348069538755 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:29:44 +0300 Subject: [PATCH 21/53] Update README.md change default --- scripts/sdkjs_common/jsdoc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/README.md b/scripts/sdkjs_common/jsdoc/README.md index 2b0fc0f3..ba77eaf0 100644 --- a/scripts/sdkjs_common/jsdoc/README.md +++ b/scripts/sdkjs_common/jsdoc/README.md @@ -42,7 +42,7 @@ This script generates JSON documentation based on the `api_plugins.js` files. ``` - **Parameters**: - - `output_path` (optional): The directory where the JSON documentation will be saved. If not specified, the default path is `Onlyoffice/document-builder-declarations/document-builder-plugin`. + - `output_path` (optional): The directory where the JSON documentation will be saved. If not specified, the default path is `../../../../office-js-api-declarations/office-js-api-plugins`. ### `generate_docs_md.py` From fa523c673f2a526ad6bfc8c0945fea64ff292b12 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:29:54 +0300 Subject: [PATCH 22/53] Update generate_docs_plugins_json.py change default --- scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py index bf1cff46..66e1366a 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py @@ -123,7 +123,7 @@ def get_current_branch(path): type=str, help="Destination directory for the generated documentation", nargs='?', # Indicates the argument is optional - default=f"{root}/document-builder-declarations/document-builder-plugin" # Default value + default=f"{root}/office-js-api-declarations/office-js-api-plugins" ) args = parser.parse_args() From 2d0bbc824f57234a0acbcfdc1a45e986ccfeba33 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:33:34 +0300 Subject: [PATCH 23/53] Update generate_docs_json.py delete branch name from path --- .../sdkjs_common/jsdoc/generate_docs_json.py | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_json.py index ef60ae0e..38f974b6 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_json.py @@ -107,25 +107,6 @@ def remove_js_comments(text): # Remove multi-line comments, leaving text after /* text = re.sub(r'/\*\s*|\s*\*/', '', text, flags=re.DOTALL) return text.strip() - -def get_current_branch(path): - try: - # Navigate to the specified directory and get the current branch name - result = subprocess.run( - ["git", "rev-parse", "--abbrev-ref", "HEAD"], - cwd=path, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - text=True - ) - if result.returncode == 0: - return result.stdout.strip() - else: - print(f"Error: {result.stderr}") - return None - except Exception as e: - print(f"Exception: {e}") - return None if __name__ == "__main__": parser = argparse.ArgumentParser(description="Generate documentation") @@ -137,12 +118,4 @@ def get_current_branch(path): default=f"{root}/office-js-api-declarations/office-js-api" ) args = parser.parse_args() - - branch_name = get_current_branch(f"{root}/sdkjs") - if branch_name: - index_last_name = branch_name.rfind("/") - if -1 != index_last_name: - branch_name = branch_name[index_last_name + 1:] - args.destination = f"{args.destination}/{branch_name}" - generate(args.destination) From 9b9dba05c224c0dd8a4aae62a1d33692dec52c71 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 30 Aug 2024 09:36:10 +0300 Subject: [PATCH 24/53] Update generate_docs_plugins_json.py delete branch from path --- .../jsdoc/generate_docs_plugins_json.py | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py index 66e1366a..79b879ef 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py @@ -96,25 +96,6 @@ def remove_js_comments(text): # Remove multi-line comments, leaving text after /* text = re.sub(r'/\*\s*|\s*\*/', '', text, flags=re.DOTALL) return text.strip() - -def get_current_branch(path): - try: - # Navigate to the specified directory and get the current branch name - result = subprocess.run( - ["git", "rev-parse", "--abbrev-ref", "HEAD"], - cwd=path, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - text=True - ) - if result.returncode == 0: - return result.stdout.strip() - else: - print(f"Error: {result.stderr}") - return None - except Exception as e: - print(f"Exception: {e}") - return None if __name__ == "__main__": parser = argparse.ArgumentParser(description="Generate documentation") @@ -126,12 +107,4 @@ def get_current_branch(path): default=f"{root}/office-js-api-declarations/office-js-api-plugins" ) args = parser.parse_args() - - branch_name = get_current_branch(f"{root}/sdkjs") - if branch_name: - index_last_name = branch_name.rfind("/") - if -1 != index_last_name: - branch_name = branch_name[index_last_name + 1:] - args.destination = f"{args.destination}/{branch_name}" - generate(args.destination) From 597529a16dca29022604cc86b2f8d95b441931f0 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Fri, 30 Aug 2024 10:49:09 +0300 Subject: [PATCH 25/53] Fix crossbuild --- scripts/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index 271c034b..02865c0b 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1799,6 +1799,6 @@ def create_x2t_js_cache(dir, product): return if (product in ["builder", "server"]): - cmd_in_dir(dir, "./x2t", ["-create-js-cache"]) - cmd_in_dir(dir, "./x2t", ["-create-js-snapshots"]) + cmd_in_dir(dir, "./x2t", ["-create-js-cache"], True) + cmd_in_dir(dir, "./x2t", ["-create-js-snapshots"], True) return From f245a4a9c65d2092ea5295fff0e77af227a0d3a4 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 01:40:00 +0300 Subject: [PATCH 26/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index b21bd249..7db958cb 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -13,6 +13,8 @@ "forms" ] +missing_examples = [] + def load_json(file_path): with open(file_path, 'r', encoding='utf-8') as f: return json.load(f) @@ -136,6 +138,8 @@ def generate_method_markdown(method, enumerations, classes): comment, code = example.split('```js', 1) comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" + else: + missing_examples.append(method) return content @@ -193,6 +197,8 @@ def generate_enumeration_markdown(enumeration, enumerations, classes): comment, code = example.split('```js', 1) comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" + else: + missing_examples.append(enumeration) return content @@ -262,5 +268,7 @@ def generate(output_dir): default="../../../../office-js-api/" # Default value ) args = parser.parse_args() - generate(args.destination) + print("START_MISSING_EXAMPLES") + print(",".join(missing_examples)) + print("END_MISSING_EXAMPLES") From a8f1d11cbc7e4a1374e669cf5844b6dada7d81ba Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 01:48:55 +0300 Subject: [PATCH 27/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index 7db958cb..d4e26dd8 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -139,7 +139,7 @@ def generate_method_markdown(method, enumerations, classes): comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" else: - missing_examples.append(method) + missing_examples.append(method_name) return content @@ -198,7 +198,7 @@ def generate_enumeration_markdown(enumeration, enumerations, classes): comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" else: - missing_examples.append(enumeration) + missing_examples.append(enum_name) return content From 8406e48009008eac37c6166eb5a046ba079f7fff Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 10:14:28 +0300 Subject: [PATCH 28/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index d4e26dd8..cd822b79 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -139,7 +139,7 @@ def generate_method_markdown(method, enumerations, classes): comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" else: - missing_examples.append(method_name) + missing_examples.append(f"{memberof}/{method_name}") return content From ea65ba02f177dd7c46ac4188fdd1fa061addea2f Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 10:23:46 +0300 Subject: [PATCH 29/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index cd822b79..3d53c4af 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -138,8 +138,6 @@ def generate_method_markdown(method, enumerations, classes): comment, code = example.split('```js', 1) comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" - else: - missing_examples.append(f"{memberof}/{method_name}") return content @@ -233,8 +231,11 @@ def process_doclets(data, output_dir): # Write method files for method in methods: + method_file_path = os.path.join(methods_dir, f"{method['name']}.md") method_content = generate_method_markdown(method, enumerations, classes) - write_markdown_file(os.path.join(methods_dir, f"{method['name']}.md"), method_content) + write_markdown_file(method_file_path, method_content) + if not method.get('example', ''): + missing_examples.append(method_file_path) # Process enumerations enum_dir = os.path.join(output_dir, 'Enumeration') From 19e1bd558693fed56b368e2b28fa5b259cd0a7c7 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 10:27:23 +0300 Subject: [PATCH 30/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index 3d53c4af..c1a9eb85 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -195,8 +195,6 @@ def generate_enumeration_markdown(enumeration, enumerations, classes): comment, code = example.split('```js', 1) comment = remove_js_comments(comment) content += f"\n\n## Example\n\n{comment}\n\n```javascript\n{code.strip()}\n" - else: - missing_examples.append(enum_name) return content @@ -242,8 +240,11 @@ def process_doclets(data, output_dir): os.makedirs(enum_dir, exist_ok=True) for enum in enumerations: + enum_file_path = os.path.join(enum_dir, f"{enum['name']}.md") enum_content = generate_enumeration_markdown(enum, enumerations, classes) - write_markdown_file(os.path.join(enum_dir, f"{enum['name']}.md"), enum_content) + write_markdown_file(enum_file_path, enum_content) + if not enum.get('example', ''): + missing_examples.append(enum_file_path) def generate(output_dir): print('Generating Markdown documentation...') From e0a44502b1a19c4c3cc0b5efdb4900bcddc2e0df Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 12:49:30 +0300 Subject: [PATCH 31/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index c1a9eb85..c89366e5 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -233,7 +233,7 @@ def process_doclets(data, output_dir): method_content = generate_method_markdown(method, enumerations, classes) write_markdown_file(method_file_path, method_content) if not method.get('example', ''): - missing_examples.append(method_file_path) + missing_examples.append(os.path.relpath(method_file_path, output_dir)) # Process enumerations enum_dir = os.path.join(output_dir, 'Enumeration') @@ -244,7 +244,7 @@ def process_doclets(data, output_dir): enum_content = generate_enumeration_markdown(enum, enumerations, classes) write_markdown_file(enum_file_path, enum_content) if not enum.get('example', ''): - missing_examples.append(enum_file_path) + missing_examples.append(os.path.relpath(enum_file_path, output_dir)) def generate(output_dir): print('Generating Markdown documentation...') From 6930a9ffe1afba03fd2839e5b3bad2ae5d6a1a49 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 31 Aug 2024 12:58:41 +0300 Subject: [PATCH 32/53] Update generate_docs_md.py --- scripts/sdkjs_common/jsdoc/generate_docs_md.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_md.py b/scripts/sdkjs_common/jsdoc/generate_docs_md.py index c89366e5..1586f89d 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_md.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_md.py @@ -198,10 +198,11 @@ def generate_enumeration_markdown(enumeration, enumerations, classes): return content -def process_doclets(data, output_dir): +def process_doclets(data, output_dir, editor_name): classes = {} classes_props = {} enumerations = [] + editor_dir = os.path.join(output_dir, editor_name) for doclet in data: if doclet['kind'] == 'class': @@ -219,7 +220,7 @@ def process_doclets(data, output_dir): # Process classes for class_name, methods in classes.items(): - class_dir = os.path.join(output_dir, class_name) + class_dir = os.path.join(editor_dir, class_name) methods_dir = os.path.join(class_dir, 'Methods') os.makedirs(methods_dir, exist_ok=True) @@ -236,7 +237,7 @@ def process_doclets(data, output_dir): missing_examples.append(os.path.relpath(method_file_path, output_dir)) # Process enumerations - enum_dir = os.path.join(output_dir, 'Enumeration') + enum_dir = os.path.join(editor_dir, 'Enumeration') os.makedirs(enum_dir, exist_ok=True) for enum in enumerations: @@ -255,7 +256,7 @@ def generate(output_dir): os.makedirs(output_dir + f'/{editor_name.title()}', exist_ok=True) data = load_json(input_file) - process_doclets(data, output_dir + f'/{editor_name.title()}') + process_doclets(data, output_dir, editor_name.title()) shutil.rmtree(output_dir + 'tmp_json') print('Done') From 3539e36bde8463958aa384f5a3ba92f71e71ac85 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sun, 1 Sep 2024 00:32:50 +0300 Subject: [PATCH 33/53] Update generate_docs_json.py delete generate missing examples with json files --- scripts/sdkjs_common/jsdoc/generate_docs_json.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_json.py index 38f974b6..0ccb48a0 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_json.py @@ -23,15 +23,9 @@ } def generate(output_dir, md=False): - missing_examples_file = f'{output_dir}/missing_examples.txt' - if not os.path.exists(output_dir): os.makedirs(output_dir) - # Recreate missing_examples.txt file - with open(missing_examples_file, 'w', encoding='utf-8') as f: - f.write('') - # Generate JSON documentation for config in configs: editor_name = config.split('/')[-1].replace('.json', '') @@ -84,11 +78,6 @@ def generate(output_dir, md=False): if "forms" == document_type: document_type = "pdf" doclet['description'] = doclet['description'] + f'\n\n## Try it\n\n ```js document-builder={{"documentType": "{document_type}"}}\n{code_content}\n```' - - else: - # Record missing examples in missing_examples.txt - with open(missing_examples_file, 'a', encoding='utf-8') as missing_file: - missing_file.write(f"{file_path}\n") # Write the modified JSON file back with open(output_file, 'w', encoding='utf-8') as f: From a817e2b046d8dd394059d403bb45ae5f6083b724 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sun, 1 Sep 2024 00:34:25 +0300 Subject: [PATCH 34/53] Update generate_docs_plugins_json.py delete generating missing files with json --- .../sdkjs_common/jsdoc/generate_docs_plugins_json.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py index 79b879ef..be24c8c7 100644 --- a/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py +++ b/scripts/sdkjs_common/jsdoc/generate_docs_plugins_json.py @@ -16,15 +16,9 @@ root = '../../../..' def generate(output_dir, md=False): - missing_examples_file = f'{output_dir}/missing_examples.txt' - if not os.path.exists(output_dir): os.makedirs(output_dir) - # Recreate missing_examples.txt file - with open(missing_examples_file, 'w', encoding='utf-8') as f: - f.write('') - # Generate JSON documentation for config in configs: editor_name = config.split('/')[-1].replace('.json', '') @@ -73,11 +67,6 @@ def generate(output_dir, md=False): if "forms" == document_type: document_type = "pdf" doclet['description'] = doclet['description'] + f'\n\n## Try it\n\n ```js document-builder={{"documentType": "{document_type}"}}\n{code_content}\n```' - - else: - # Record missing examples in missing_examples.txt - with open(missing_examples_file, 'a', encoding='utf-8') as missing_file: - missing_file.write(f"{file_path}\n") # Write the modified JSON file back with open(output_file, 'w', encoding='utf-8') as f: From f463bff49e9543d1cdf0f1a4f40277eb717d5f77 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 3 Sep 2024 15:09:37 +0300 Subject: [PATCH 35/53] Fixes for working by ssh --- configure.py | 2 +- scripts/base.py | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/configure.py b/configure.py index 1badfef8..857b50fc 100755 --- a/configure.py +++ b/configure.py @@ -27,7 +27,7 @@ parser.add_option("--compiler", action="store", type="string", dest="compiler", default="", help="defines compiler name. It is not recommended to use it as it's defined automatically (msvc2015, msvc2015_64, gcc, gcc_64, clang, clang_64, etc)") parser.add_option("--no-apps", action="store", type="string", dest="no-apps", default="0", help="disables building desktop apps that use qt") parser.add_option("--themesparams", action="store", type="string", dest="themesparams", default="", help="provides settings for generating presentation themes thumbnails") -parser.add_option("--git-protocol", action="store", type="string", dest="git-protocol", default="https", help="can be used only if update is set to true - 'https', 'ssh'") +parser.add_option("--git-protocol", action="store", type="string", dest="git-protocol", default="auto", help="can be used only if update is set to true - 'https', 'ssh'") parser.add_option("--branding", action="store", type="string", dest="branding", default="", help="provides branding path") parser.add_option("--branding-name", action="store", type="string", dest="branding-name", default="", help="provides branding name") parser.add_option("--branding-url", action="store", type="string", dest="branding-url", default="", help="provides branding url") diff --git a/scripts/base.py b/scripts/base.py index 02865c0b..b1175d94 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -500,12 +500,37 @@ def set_cwd(dir): return # git --------------------------------------------------- +def git_get_origin(): + cur_dir = os.getcwd() + os.chdir(get_script_dir() + "/../") + ret = run_command("git config --get remote.origin.url")["stdout"] + os.chdir(cur_dir) + return ret + +def git_is_ssh(): + git_protocol = config.option("git-protocol") + if (git_protocol == "https"): + return False + if (git_protocol == "ssh"): + return True + origin = git_get_origin() + if (git_protocol == "auto") and (origin.find(":ONLYOFFICE/") != -1): + return True + return False + +def get_ssh_base_url(): + cur_origin = git_get_origin() + ind = cur_origin.find(":ONLYOFFICE/") + if (ind == -1): + return "git@github.com:ONLYOFFICE/" + return cur_origin[:ind+12] + def git_update(repo, is_no_errors=False, is_current_dir=False, git_owner=""): print("[git] update: " + repo) owner = git_owner if git_owner else "ONLYOFFICE" url = "https://github.com/" + owner + "/" + repo + ".git" - if config.option("git-protocol") == "ssh": - url = "git@github.com:ONLYOFFICE/" + repo + ".git" + if git_is_ssh(): + url = get_ssh_base_url() + repo + ".git" folder = get_script_dir() + "/../../" + repo if is_current_dir: folder = repo @@ -574,8 +599,8 @@ def get_branding_repositories(checker): def create_pull_request(branches_to, repo, is_no_errors=False, is_current_dir=False): print("[git] create pull request: " + repo) url = "https://github.com/ONLYOFFICE/" + repo + ".git" - if config.option("git-protocol") == "ssh": - url = "git@github.com:ONLYOFFICE/" + repo + ".git" + if git_is_ssh(): + url = get_ssh_base_url() + repo + ".git" folder = get_script_dir() + "/../../" + repo if is_current_dir: folder = repo @@ -1336,7 +1361,7 @@ def copy_marketplace_plugin(dst_dir, is_name_as_guid=False, is_desktop_local=Fal git_dir = __file__script__path__ + "/../.." if False: # old version - base.copy_sdkjs_plugin(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins", dst_dir, "manager", is_name_as_guid, is_desktop_local) + copy_sdkjs_plugin(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins", dst_dir, "manager", is_name_as_guid, is_desktop_local) return src_dir_path = git_dir + "/onlyoffice.github.io/store/plugin" name = "marketplace" From 486a6683fd4b515e9b46f26a86380294bbe67d78 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Mon, 9 Sep 2024 06:38:13 +0300 Subject: [PATCH 36/53] Add dependencies for doctrenderer --- scripts/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index b1175d94..156e08bf 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1216,7 +1216,7 @@ def mac_correct_rpath_x2t(dir): mac_correct_rpath_library("kernel", ["UnicodeConverter"]) mac_correct_rpath_library("kernel_network", ["UnicodeConverter", "kernel"]) mac_correct_rpath_library("graphics", ["UnicodeConverter", "kernel"]) - mac_correct_rpath_library("doctrenderer", ["UnicodeConverter", "kernel", "kernel_network", "graphics"]) + mac_correct_rpath_library("doctrenderer", ["UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer"]) mac_correct_rpath_library("HtmlFile2", ["UnicodeConverter", "kernel", "kernel_network", "graphics"]) mac_correct_rpath_library("EpubFile", ["UnicodeConverter", "kernel", "HtmlFile2", "graphics"]) mac_correct_rpath_library("Fb2File", ["UnicodeConverter", "kernel", "graphics"]) @@ -1305,7 +1305,7 @@ def linux_set_origin_rpath_libraries(dir, libs): return def linux_correct_rpath_docbuilder(dir): - linux_set_origin_rpath_libraries(dir, ["docbuilder.jni.so", "docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so"]) + linux_set_origin_rpath_libraries(dir, ["docbuilder.jni.so", "docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer"]) return def common_check_version(name, good_version, clean_func): From 71eb25e561828e34f6eedce561c8d0c2ed331980 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 10 Sep 2024 09:58:13 +0300 Subject: [PATCH 37/53] Remove unused files --- tests/puppeteer/config_chrome.json | 4 - tests/puppeteer/config_firefox.json | 4 - tests/puppeteer/install.py | 9 -- tests/puppeteer/run.py | 64 ----------- tests/puppeteer/tester.js | 171 ---------------------------- tests/puppeteer/tests/bold.js | 27 ----- 6 files changed, 279 deletions(-) delete mode 100644 tests/puppeteer/config_chrome.json delete mode 100644 tests/puppeteer/config_firefox.json delete mode 100644 tests/puppeteer/install.py delete mode 100644 tests/puppeteer/run.py delete mode 100644 tests/puppeteer/tester.js delete mode 100644 tests/puppeteer/tests/bold.js diff --git a/tests/puppeteer/config_chrome.json b/tests/puppeteer/config_chrome.json deleted file mode 100644 index 3064650b..00000000 --- a/tests/puppeteer/config_chrome.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "browser" : "chrome", - "browserUrl" : "C:/Program Files/Google/Chrome/Application/chrome.exe" -} \ No newline at end of file diff --git a/tests/puppeteer/config_firefox.json b/tests/puppeteer/config_firefox.json deleted file mode 100644 index 1293bee6..00000000 --- a/tests/puppeteer/config_firefox.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "browser" : "firefox", - "browserUrl" : "C:/Program Files/Mozilla Firefox/firefox.exe" -} \ No newline at end of file diff --git a/tests/puppeteer/install.py b/tests/puppeteer/install.py deleted file mode 100644 index cb73e867..00000000 --- a/tests/puppeteer/install.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append('../../scripts') -import base -import os - -os.environ["PUPPETEER_SKIP_CHROMIUM_DOWNLOAD"] = "true" -base.cmd("npm", ["i", "puppeteer"]) diff --git a/tests/puppeteer/run.py b/tests/puppeteer/run.py deleted file mode 100644 index f13b5a48..00000000 --- a/tests/puppeteer/run.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append('../../scripts') -import base -import os -import glob -import json - -def get_tests_in_dir(directory): - files = [] - for file in glob.glob(directory + "/*.js"): - if base.is_file(file): - files.append(file) - elif is_dir(file): - files += get_tests_in_dir(file) - return files - -params = sys.argv[1:] -if (0 == len(params)): - print("use: run.py path_to_config [path_to_test]") - exit(0) - -config_path = params[0] -test_file = "./tests" - -if (1 < len(params)): - test_file = params[1] - -tests_array = [test_file] -if base.is_dir(test_file): - tests_array = get_tests_in_dir(test_file) - -config_content = "{}" -with open(config_path, "r") as config_path_loader: - config_content = config_path_loader.read() - -print(config_content) - -config = json.loads(config_content) -os.environ["PUPPETEER_SKIP_CHROMIUM_DOWNLOAD"] = "true" -if "browser" in config: - print("browser: " + config["browser"]) - os.environ["PUPPETEER_PRODUCT"] = config["browser"] - -if "browserUrl" in config: - print("browserUrl: " + config["browserUrl"]) - os.environ["PUPPETEER_EXECUTABLE_PATH"] = config["browserUrl"] - -if not base.is_dir("./work_directory"): - base.create_dir("./work_directory") - base.create_dir("./work_directory/cache") - base.create_dir("./work_directory/downloads") - -for test in tests_array: - print("run test: " + test) - run_file = test + ".runned.js" - base.copy_file("./tester.js", run_file) - test_content = base.readFile(test) - test_content = test_content.replace("await Tester.", "Tester.") - test_content = test_content.replace("Tester.", "await Tester.") - base.replaceInFile(run_file, "\"%%CODE%%\"", test_content) - base.cmd("node", [run_file]) - base.delete_file(run_file) diff --git a/tests/puppeteer/tester.js b/tests/puppeteer/tester.js deleted file mode 100644 index 997e58a2..00000000 --- a/tests/puppeteer/tester.js +++ /dev/null @@ -1,171 +0,0 @@ -const puppeteer = require('puppeteer') -const pathfs = require('path') -const fs = require('fs'); - -function TesterImpl() -{ - this.browser = null; - this.page = null; - this.width = 1500; - this.height = 800; - this.pixelRatio = 1; - - this.cacheDir = pathfs.resolve("./work_directory/cache"); - this.downloadsDir = pathfs.resolve("./work_directory/downloads"); - this.downloadCounter = 0; - - this.load = async function(url) - { - const head = { x: 100, y: 200 }; - this.browser = await puppeteer.launch({ - headless: false, - product: process.env["PUPPETEER_PRODUCT"], - args: [ - "--disable-infobars", - `--window-size=${this.width+head.x},${this.height+head.y}`, - "--disk-cache-dir=" + this.cacheDir - ], - defaultViewport : {width: this.width, height: this.height, deviceScaleFactor : this.pixelRatio } - }); - - this.page = await this.browser.newPage(); - await this.page.setViewport({ width: this.width, height: this.height }); - let waitObject = (process.env["PUPPETEER_PRODUCT"] === "firefox") ? { waitUntil: "networkidle0", timeout: 15000 } : {}; - await this.page.goto(url + "&autotest=enabled", waitObject); - console.log("[tester] pageLoaded"); - return this.page; - }; - - this.close = async function(nosleep) - { - if (true !== nosleep) - await this.waitAutosave(); - await this.browser.close(); - }; - - this.sleep = async function(ms) - { - return await new Promise(resolve => setTimeout(resolve, ms)); - }; - - this.waitEditor = async function() - { - // TODO: wait first onEndRecalculate - await this.sleep(5000); - console.log("[tester] editorReady"); - }; - - this.waitAutosave = async function() - { - await this.sleep(5000); - }; - - this.evaluateInMainFrame = async function(code) - { - return await this.page.evaluate(code); - }; - this.evaluateInEditorFrame = async function(code) - { - const frame = await this.page.frames().find(frame => frame.name() === 'frameEditor'); - if (!frame) - return; - return await frame.evaluate(code); - }; - - this.click = async function(id) - { - let res = await this.evaluateInEditorFrame("document.getElementById(\"" + id + "\").click(); \"[tester] clicked: " + id + "\""); - //console.log(res); - await this.sleep(200); - return res; - }; - - this.mouseClick = async function(x, y, options) - { - let res = await this.page.mouse.click(x, y, options); - await this.sleep(200); - return res; - }; - - this.eval = async function(code) - { - let res = await this.evaluateInEditorFrame(code); - await this.sleep(200); - return res; - }; - - this.keyDown = async function(key) - { - // https://pptr.dev/api/puppeteer.keyinput - let res = await this.page.keyboard.down(key); - await this.sleep(200); - return res; - }; - - this.keyUp = async function(key) - { - // https://pptr.dev/api/puppeteer.keyinput - let res = await this.page.keyboard.up(key); - await this.sleep(200); - return res; - }; - - this.keyClick = async function(key) - { - // https://pptr.dev/api/puppeteer.keyinput - let res = await this.page.keyboard.down(key); - res = await this.page.keyboard.up(key); - await this.sleep(200); - return res; - }; - - this.keyPress = async function(key) - { - // https://pptr.dev/api/puppeteer.keyinput - let res = await this.page.keyboard.press(key); - await this.sleep(200); - return res; - }; - - this.input = async function(text) - { - let res = await this.page.keyboard.type(text); - await this.sleep(200); - return res; - }; - - this.downloadFile = async function(format, path) - { - const tmpDir = pathfs.resolve(this.downloadsDir, "./tmp" + this.downloadCounter++); - fs.mkdirSync(tmpDir); - - // emulate download - const client = await this.page.target().createCDPSession(); - await client.send("Page.setDownloadBehavior", { - behavior: "allow", - downloadPath: tmpDir - }); - - await this.evaluateInEditorFrame("document.querySelectorAll('[data-layout-name=\"toolbar-file\"]')[0].click();"); - await this.sleep(200); - await this.evaluateInEditorFrame("document.getElementsByClassName(\"svg-format-" + format + "\")[0].click();"); - await this.sleep(200); - await this.evaluateInEditorFrame("document.getElementById(\"fm-btn-return\").click();"); - - await this.sleep(2000); - - const files = fs.readdirSync(tmpDir); - fs.copyFileSync(pathfs.resolve(tmpDir, "./" + files[0]), pathfs.resolve(path)); - fs.rmSync(tmpDir, { recursive: true, force: true }); - }; -} - -const Tester = new TesterImpl; - -try { - (async () => { - "%%CODE%%" - })(); -} catch (err) { - console.error(err); -} diff --git a/tests/puppeteer/tests/bold.js b/tests/puppeteer/tests/bold.js deleted file mode 100644 index 94b8c681..00000000 --- a/tests/puppeteer/tests/bold.js +++ /dev/null @@ -1,27 +0,0 @@ -Tester.load("path_to_file"); -Tester.waitEditor(); - -// down Enter -Tester.keyClick("Enter"); - -// type text -Tester.input("Hello World!"); - -Tester.keyPress("ArrowLeft"); -Tester.keyDown("Shift"); -for (let i = 0; i < 5; i++) - Tester.keyPress("ArrowLeft"); -Tester.keyUp("Shift"); - -// bold -Tester.click("id-toolbar-btn-bold"); -// italic -Tester.mouseClick(115, 105); - -// if needed -Tester.waitAutosave(); - -Tester.downloadFile("docx", "./work_directory/new.docx") -Tester.downloadFile("odt", "./work_directory/new.odt") - -Tester.close(true); From c4a89ecf619b7bad9ead82eaa75edb597a4b81ef Mon Sep 17 00:00:00 2001 From: "Oleg.Korshul" Date: Tue, 10 Sep 2024 14:23:17 +0300 Subject: [PATCH 38/53] Fix update --- scripts/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/base.py b/scripts/base.py index 156e08bf..d4024363 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -563,10 +563,12 @@ def get_repositories(): result.update(get_sdkjs_addons()) result["onlyoffice.github.io"] = [False, False] result["web-apps"] = [False, False] - result.update(get_web_apps_addons()) result["dictionaries"] = [False, False] result["core-fonts"] = [False, False] + if config.check_option("module", "server"): + result.update(get_web_apps_addons()) + if config.check_option("module", "builder"): result["document-templates"] = [False, False] From f5d0ef4005858fdc5ca7ca7b9226d2f26b4121dc Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Wed, 11 Sep 2024 11:21:30 +0300 Subject: [PATCH 39/53] Fix macos bug --- scripts/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index d4024363..b3e25fbe 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1237,7 +1237,7 @@ def mac_correct_rpath_x2t(dir): if is_file("./allthemesgen"): cmd("chmod", ["-v", "+x", "./allthemesgen"]) cmd("install_name_tool", ["-add_rpath", "@executable_path", "./allthemesgen"], True) - mac_correct_rpath_binary("./allthemesgen", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "graphics", "kernel_network", "doctrenderer"]) + mac_correct_rpath_binary("./allthemesgen", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "graphics", "kernel_network", "doctrenderer", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer"]) if is_file("./pluginsmanager"): cmd("chmod", ["-v", "+x", "./pluginsmanager"]) cmd("install_name_tool", ["-add_rpath", "@executable_path", "./pluginsmanager"], True) @@ -1255,13 +1255,13 @@ def mac_correct_rpath_docbuilder(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", "PdfFile", "HtmlRenderer", "XpsFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer"]) - mac_correct_rpath_library("docbuilder.c", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer"]) + mac_correct_rpath_library("docbuilder.c", ["icudata.58", "icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer"]) def add_loader_path_to_rpath(libs): for lib in libs: cmd("install_name_tool", ["-add_rpath", "@loader_path", "lib" + lib + ".dylib"], True) - add_loader_path_to_rpath(["icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer", "docbuilder.c"]) + add_loader_path_to_rpath(["icuuc.58", "UnicodeConverter", "kernel", "kernel_network", "graphics", "doctrenderer", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer", "docbuilder.c"]) os.chdir(cur_dir) return From cf970efbec721f91facef7d2aed43c9139f91087 Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 18 Sep 2024 12:32:18 +0300 Subject: [PATCH 40/53] [desktop] copy templates to package --- scripts/deploy_desktop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 9e48de18..5915f19a 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -102,6 +102,7 @@ def make(): base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries") base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty") + base.copy_dir(root_dir + "/templates", root_dir + "/converter/templates") # dictionaries base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries") From 1b646a6e00ed862cb0d2a9809e4e5d7982100127 Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 18 Sep 2024 12:51:45 +0300 Subject: [PATCH 41/53] [desktop] correct path --- scripts/deploy_desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 5915f19a..37770215 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -102,7 +102,7 @@ def make(): base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries") base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty") - base.copy_dir(root_dir + "/templates", root_dir + "/converter/templates") + base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") # dictionaries base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries") From fdd9c329b1181f9924eac30e93730ef5b206d5c6 Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Thu, 26 Sep 2024 16:51:44 +0000 Subject: [PATCH 42/53] Fix deploy automation API --- scripts/deploy_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy_server.py b/scripts/deploy_server.py index 2cfdfc8f..ac95df9f 100644 --- a/scripts/deploy_server.py +++ b/scripts/deploy_server.py @@ -114,7 +114,7 @@ def make(): js_dir = root_dir base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs") base.copy_dir(base_dir + "/js/" + branding + "/builder/web-apps", js_dir + "/web-apps") - base.copy_file(js_dir + "/web-apps/apps/api/documents/api.js", js_dir + "/web-apps/apps/api/documents/api.js.tpl") + base.move_file(js_dir + "/web-apps/apps/api/documents/api.js", js_dir + "/web-apps/apps/api/documents/api.js.tpl") for file in glob.glob(js_dir + "/web-apps/apps/*/*/*.js.map") \ + glob.glob(js_dir + "/web-apps/apps/*/mobile/dist/js/*.js.map"): base.delete_file(file) From 0c180e6ee50f2783b213d5688069478170e4987d Mon Sep 17 00:00:00 2001 From: Alexey Golubev Date: Fri, 27 Sep 2024 12:13:45 +0000 Subject: [PATCH 43/53] Fix deploy automation API --- scripts/deploy_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy_server.py b/scripts/deploy_server.py index ac95df9f..f4022ce8 100644 --- a/scripts/deploy_server.py +++ b/scripts/deploy_server.py @@ -122,7 +122,7 @@ def make(): base.create_x2t_js_cache(converter_dir, "server") # add embed worker code - base.cmd_in_dir(git_dir + "/sdkjs/common/embed", "python", ["make.py", js_dir + "/web-apps/apps/api/documents/api.js"]) + base.cmd_in_dir(git_dir + "/sdkjs/common/embed", "python", ["make.py", js_dir + "/web-apps/apps/api/documents/api.js.tpl"]) # plugins base.create_dir(js_dir + "/sdkjs-plugins") From 952270e1ba33c5e8dec475ca42a2d90ebdbe5122 Mon Sep 17 00:00:00 2001 From: Mikhail Lobotskiy Date: Wed, 2 Oct 2024 17:43:37 +0400 Subject: [PATCH 44/53] Fix rpaths --- scripts/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/base.py b/scripts/base.py index b3e25fbe..10ed8136 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1307,7 +1307,7 @@ def linux_set_origin_rpath_libraries(dir, libs): return def linux_correct_rpath_docbuilder(dir): - linux_set_origin_rpath_libraries(dir, ["docbuilder.jni.so", "docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer"]) + linux_set_origin_rpath_libraries(dir, ["docbuilder.jni.so", "docbuilder.c.so", "icuuc.so.58", "doctrenderer.so", "graphics.so", "kernel.so", "kernel_network.so", "UnicodeConverter.so", "PdfFile.so", "XpsFile.so", "DjVuFile.so", "DocxRenderer.so"]) return def common_check_version(name, good_version, clean_func): From 18bba5da3d149895f3681d2c2951bde7e7fb9dc4 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 3 Oct 2024 13:49:58 +0300 Subject: [PATCH 45/53] Disable bitcode by default --- scripts/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/base.py b/scripts/base.py index 10ed8136..062793de 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -769,8 +769,9 @@ def qt_config(platform): if (-1 != platform.find("xp")): config_param += " build_xp" if ("ios" == platform): - set_env("BITCODE_GENERATION_MODE", "bitcode") - set_env("ENABLE_BITCODE", "YES") + if (config.check_option("bitcode", "yes")): + set_env("BITCODE_GENERATION_MODE", "bitcode") + set_env("ENABLE_BITCODE", "YES") config_param = config_param.replace("desktop", "") config_param += " iphoneos device" if (-1 == config_param_lower.find("debug")): From 6fbea9c8a4b590e74c109eb91428693d071e12f5 Mon Sep 17 00:00:00 2001 From: "Oleg.Korshul" Date: Thu, 3 Oct 2024 21:54:17 +0300 Subject: [PATCH 46/53] Fix build v8 on macos with xcode 16+ --- scripts/core_common/modules/v8_89.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/core_common/modules/v8_89.py b/scripts/core_common/modules/v8_89.py index 96432631..bd1e1718 100644 --- a/scripts/core_common/modules/v8_89.py +++ b/scripts/core_common/modules/v8_89.py @@ -137,6 +137,11 @@ def make(): else: base.replaceInFile("depot_tools/gclient_paths.py", "@functools.lru_cache", "") + if ("mac" == base.host_platform()): + if not base.is_file("v8/build/config/compiler/BUILD.gn.bak"): + base.copy_file("v8/build/config/compiler/BUILD.gn", "v8/build/config/compiler/BUILD.gn.bak") + base.replaceInFile("v8/build/config/compiler/BUILD.gn", "\"-Wloop-analysis\",", "\"-Wloop-analysis\", \"-D_Float16=short\",") + if not base.is_file("v8/third_party/jinja2/tests.py.bak"): base.copy_file("v8/third_party/jinja2/tests.py", "v8/third_party/jinja2/tests.py.bak") base.replaceInFile("v8/third_party/jinja2/tests.py", "from collections import Mapping", "try:\n from collections.abc import Mapping\nexcept ImportError:\n from collections import Mapping") From 3534f65f0e60988b8bc678eb2ae08c627c591324 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Fri, 4 Oct 2024 18:10:31 +0300 Subject: [PATCH 47/53] Remove empty items in plugins list --- scripts/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/base.py b/scripts/base.py index 062793de..45112807 100644 --- a/scripts/base.py +++ b/scripts/base.py @@ -1430,6 +1430,7 @@ def support_old_versions_plugins(out_dir): def generate_sdkjs_plugin_list(dst): plugins_list = config.option("sdkjs-plugin").rsplit(", ") \ + config.option("sdkjs-plugin-server").rsplit(", ") + plugins_list = list(filter(None, plugins_list)) with open(get_path(dst), 'w') as file: dump = json.dumps(sorted(plugins_list), indent=4) file.write(re.sub(r"^(\s{4})", '\t', dump, 0, re.MULTILINE)) From edec5bb25fe5ee0f256114046742a378c94494d9 Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 9 Oct 2024 01:08:19 +0300 Subject: [PATCH 48/53] [desktop] debug macOS app launch --- scripts/deploy_desktop.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 37770215..508c7042 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -103,6 +103,11 @@ def make(): base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries") base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty") base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") + if (0 == platform.find("mac")): + # TODO: check macOS app launch issue when localized file name templates inside + base.copy_dir(git_dir + "/desktop-apps/common/templates/EN", root_dir + "/converter/templates/EN") + else: + base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") # dictionaries base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries") From 6d956566c5b5aa68e83311d2909ca9077844f6a1 Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 9 Oct 2024 01:13:47 +0300 Subject: [PATCH 49/53] [desktop] debug --- scripts/deploy_desktop.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 508c7042..1f0a92b8 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -102,7 +102,6 @@ def make(): base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries") base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty") - base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") if (0 == platform.find("mac")): # TODO: check macOS app launch issue when localized file name templates inside base.copy_dir(git_dir + "/desktop-apps/common/templates/EN", root_dir + "/converter/templates/EN") From 772fb721ae182804b101dfb7301fe1707d8a772c Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Wed, 9 Oct 2024 10:48:59 +0300 Subject: [PATCH 50/53] Add data for hard update hunspell module --- scripts/core_common/modules/hunspell.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/core_common/modules/hunspell.py b/scripts/core_common/modules/hunspell.py index 47674b42..35b3536d 100644 --- a/scripts/core_common/modules/hunspell.py +++ b/scripts/core_common/modules/hunspell.py @@ -3,6 +3,11 @@ import base import os +def clean(): + if base.is_dir("hunspell"): + base.delete_dir_with_access_error("hunspell") + return + def make(build_js = True): old_cur_dir = os.getcwd() @@ -11,6 +16,8 @@ def make(build_js = True): core_common_dir = base.get_script_dir() + "/../../core/Common" os.chdir(core_common_dir + "/3dParty/hunspell") + + base.common_check_version("hunspell", "1", clean) base.cmd("python", ["./before.py"]) if (build_js): From 0985b4dbe80861364d2b953976a04f03df588efd Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 10 Oct 2024 02:45:16 +0300 Subject: [PATCH 51/53] Add script for deploy templates --- tools/common/desktop_templates.py | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tools/common/desktop_templates.py diff --git a/tools/common/desktop_templates.py b/tools/common/desktop_templates.py new file mode 100644 index 00000000..6891e1a6 --- /dev/null +++ b/tools/common/desktop_templates.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +import sys +sys.path.append('../../scripts') +import base +import os +import glob +import base64 + +sys.stdin.reconfigure(encoding='utf-8') +sys.stdout.reconfigure(encoding='utf-8') + +def get_files(dir): + arr_files = [] + for file in glob.glob(dir + "/*"): + if base.is_file(file): + arr_files.append(file) + elif base.is_dir(file): + arr_files += get_files(file) + return arr_files + +def get_local_path(base, src_dir): + test1 = base.replace("\\", "/") + test2 = src_dir.replace("\\", "/") + return test2[len(test1)+1:] + +params = sys.argv[1:] + +if (3 > len(params)): + print("use: convert.py path_to_x2t_directory path_to_input_directory path_to_output_directory") + exit(0) + +base.configure_common_apps() + +x2t_directory = params[0] +src_directory = params[1] +dst_directory = params[2] + +if base.is_dir(dst_directory): + base.delete_dir(dst_directory) +base.create_dir(dst_directory) + +src_files = get_files(src_directory) + +for file in src_files: + directory = os.path.dirname(file) + name = os.path.basename(file) + directory_out_file = dst_directory + "/" + get_local_path(src_directory, directory) + if not base.is_dir(directory_out_file): + os.makedirs(directory_out_file, exist_ok=True) + name_without_ext = os.path.splitext(name)[0] + name_ext = os.path.splitext(name)[1][1:] + + dst_ext = name_ext + if ("docx" == name_ext) or ("dotx" == name_ext): + dst_ext = "dotx" + elif ("pptx" == name_ext) or ("potx" == name_ext): + dst_ext = "potx" + elif ("xlsx" == name_ext) or ("xltx" == name_ext): + dst_ext = "xltx" + + dst_name = "[32]" + base64.b32encode(name_without_ext.encode("utf-8")).decode("utf-8") + + dst_file = directory_out_file + "/" + dst_name + "." + dst_ext + + os.makedirs(directory_out_file, exist_ok=True) + base.cmd_in_dir(x2t_directory, "x2t", [file, dst_file]) + + print(name_without_ext + " => " + dst_name) From 7b9f18867a68e0a101567dd96ffba46a3dd806c5 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 10 Oct 2024 10:51:28 +0300 Subject: [PATCH 52/53] Revert all remplates to desktop for macos --- scripts/deploy_desktop.py | 6 +----- tools/common/desktop_templates.py | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/deploy_desktop.py b/scripts/deploy_desktop.py index 1f0a92b8..37770215 100644 --- a/scripts/deploy_desktop.py +++ b/scripts/deploy_desktop.py @@ -102,11 +102,7 @@ def make(): base.generate_doctrenderer_config(root_dir + "/converter/DoctRenderer.config", "../editors/", "desktop", "", "../dictionaries") base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty") - if (0 == platform.find("mac")): - # TODO: check macOS app launch issue when localized file name templates inside - base.copy_dir(git_dir + "/desktop-apps/common/templates/EN", root_dir + "/converter/templates/EN") - else: - base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") + base.copy_dir(git_dir + "/desktop-apps/common/templates", root_dir + "/converter/templates") # dictionaries base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries") diff --git a/tools/common/desktop_templates.py b/tools/common/desktop_templates.py index 6891e1a6..266a1f2f 100644 --- a/tools/common/desktop_templates.py +++ b/tools/common/desktop_templates.py @@ -59,7 +59,9 @@ def get_local_path(base, src_dir): elif ("xlsx" == name_ext) or ("xltx" == name_ext): dst_ext = "xltx" - dst_name = "[32]" + base64.b32encode(name_without_ext.encode("utf-8")).decode("utf-8") + dst_name = name_without_ext + if (len(dst_name) < 4) or (dst_name[0:4] != "[32]"): + dst_name = "[32]" + base64.b32encode(name_without_ext.encode("utf-8")).decode("utf-8") dst_file = directory_out_file + "/" + dst_name + "." + dst_ext From cf1c25031c204e9802d911d9fe067eea240b2e47 Mon Sep 17 00:00:00 2001 From: Semyon Bezrukov Date: Thu, 17 Oct 2024 12:45:40 +0300 Subject: [PATCH 53/53] Update version --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 406b8982..fbb9ea12 100644 --- a/version +++ b/version @@ -1 +1 @@ -8.1.3 +8.2.0