Add web-apps js maps deploy (#796)

* Exclude js maps

* Add web-apps js maps deploy
This commit is contained in:
Semyon Bezrukov
2024-03-14 14:10:56 +03:00
committed by GitHub
parent 5b27f9843f
commit 70975098e2
5 changed files with 50 additions and 13 deletions

View File

@ -68,9 +68,11 @@ utils.delete_file(common.deploy_data)
if "core" in common.targets:
package_core.make()
if "closuremaps_opensource" in common.targets:
package_core.deploy_closuremaps("opensource")
package_core.deploy_closuremaps_sdkjs("opensource")
package_core.deploy_closuremaps_webapps("opensource")
if "closuremaps_commercial" in common.targets:
package_core.deploy_closuremaps("commercial")
package_core.deploy_closuremaps_sdkjs("commercial")
package_core.deploy_closuremaps_webapps("commercial")
if "desktop" in common.targets:
package_desktop.make()
if "builder" in common.targets:

View File

@ -214,6 +214,8 @@ def make():
base.create_dir(root_dir + "/editors")
base.copy_dir(base_dir + "/js/" + branding + "/desktop/sdkjs", root_dir + "/editors/sdkjs")
base.copy_dir(base_dir + "/js/" + branding + "/desktop/web-apps", root_dir + "/editors/web-apps")
for file in glob.glob(root_dir + "/editors/web-apps/apps/*/*/*.js.map"):
base.delete_file(file)
base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/resources/local", root_dir + "/editors/sdkjs/common/Images/local")
base.create_dir(root_dir + "/editors/sdkjs-plugins")

View File

@ -5,6 +5,7 @@ import base
import re
import shutil
import glob
from tempfile import mkstemp
def make():
@ -113,6 +114,9 @@ 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")
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)
# 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"])

View File

@ -53,27 +53,53 @@ def make_core():
utils.set_summary("core deploy", ret)
return
def deploy_closuremaps(license):
def deploy_closuremaps_sdkjs(license):
if not common.deploy: return
utils.log_h1("CLOSURE MAPS")
utils.set_cwd(utils.get_path("sdkjs/build/maps"))
utils.log_h1("SDKJS CLOSURE MAPS")
maps = utils.glob_path("*.js.map")
if not maps:
maps = utils.glob_path("sdkjs/build/maps/*.js.map")
if maps:
for m in maps: utils.log("- " + m)
else:
utils.log_err("files do not exist")
utils.set_summary("closure maps " + license + " deploy", False)
utils.set_summary("sdkjs closure maps %s deploy" % license, False)
return
utils.log_h2("closure maps " + license + " deploy")
utils.log_h2("sdkjs closure maps %s deploy" % license)
ret = True
for f in maps:
key = "closure-maps/%s/%s/%s/%s" % (license, common.version, common.build, f)
base = utils.get_basename(f)
key = "closure-maps/sdkjs/%s/%s/%s/%s" % (license, common.version, common.build, base)
upload = utils.s3_upload(f, "s3://" + branding.s3_bucket + "/" + key)
ret &= upload
if upload:
utils.log("URL: " + branding.s3_base_url + "/" + key)
utils.add_deploy_data(key)
utils.set_summary("closure maps " + license + " deploy", ret)
utils.set_cwd(common.workspace_dir)
utils.set_summary("sdkjs closure maps %s deploy" % license, ret)
return
def deploy_closuremaps_webapps(license):
if not common.deploy: return
utils.log_h1("WEB-APPS CLOSURE MAPS")
maps = utils.glob_path("web-apps/deploy/web-apps/apps/*/*/*.js.map") \
+ utils.glob_path("web-apps/deploy/web-apps/apps/*/mobile/dist/js/*.js.map")
if maps:
for m in maps: utils.log("- " + m)
else:
utils.log_err("files do not exist")
utils.set_summary("web-apps closure maps %s deploy" % license, False)
return
utils.log_h2("web-apps closure maps %s deploy" % license)
ret = True
for f in maps:
base = utils.get_relpath(f, "web-apps/deploy/web-apps/apps").replace("/", "_")
key = "closure-maps/web-apps/%s/%s/%s/%s" % (license, common.version, common.build, base)
upload = utils.s3_upload(f, "s3://" + branding.s3_bucket + "/" + key)
ret &= upload
if upload:
utils.log("URL: " + branding.s3_base_url + "/" + key)
utils.add_deploy_data(key)
utils.set_summary("web-apps closure maps %s deploy" % license, ret)
return

View File

@ -73,6 +73,9 @@ def get_path(path):
return path.replace("/", "\\")
return path
def get_relpath(path, rel_path):
return os.path.relpath(get_path(path), get_path(rel_path))
def get_abspath(path):
return os.path.abspath(get_path(path))