Skip to content

Commit

Permalink
Add macOS x86 package build (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
heatray authored May 31, 2021
1 parent 070c77f commit 3d9870e
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions scripts/packages_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ def make():
macos_dir = git_dir + "/desktop-apps/macos"
update_dir = macos_dir + "/build/update"

base.cmd_in_dir(macos_dir, "bundler", ["exec", "fastlane", "release", "skip_git_bump:true"])
isX86 = True if ("" != base.get_env("_X86")) else False

target = "release" if not isX86 else "release_x86"
base.cmd_in_dir(macos_dir, "bundler", ["exec", "fastlane", target, "skip_git_bump:true"])

package = "ONLYOFFICE" if not isX86 else "ONLYOFFICE-x86"
app_version = base.run_command("mdls -name kMDItemVersion -raw " +
macos_dir + "/build/ONLYOFFICE.app")['stdout']
macos_zip = macos_dir + "/build/ONLYOFFICE-" + app_version + ".zip"
macos_zip = macos_dir + "/build/" + package + "-" + app_version + ".zip"
update_storage = base.get_env("ARCHIVES_DIR") + "/" + package + "/_updates"
changes_dir = macos_dir + "/ONLYOFFICE/update/updates/ONLYOFFICE/changes/" + app_version
base.delete_dir(update_dir)
base.delete_dir(os.path.expanduser("~/Library/Caches/Sparkle_generate_appcast"))
base.create_dir(update_dir)
base.copy_dir_content(base.get_env("UPDATE_STORAGE"), update_dir, ".zip")
base.copy_dir_content(update_storage, update_dir, ".zip")
base.copy_file(macos_zip, update_dir)
for file in os.listdir(update_dir):
if file.endswith(".zip"):
Expand All @@ -42,15 +47,18 @@ def make():

base.cmd(macos_dir + "/Vendor/Sparkle/bin/generate_appcast", [update_dir])

base_url = "https://download.onlyoffice.com/install/desktop/editors/mac/updates/onlyoffice"
base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
changes_url = base_url + "/updates/onlyoffice/changes"
update_url = base_url + ("/updates/onlyoffice" if not isX86 else "/x86")

base.replaceInFileRE(update_dir + "/onlyoffice.xml",
r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
"\\1" + base_url + "/changes/\\2/ReleaseNotes.html\\3")
r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE(?:|-x86)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
"\\1" + changes_url + "/\\2/ReleaseNotes.html\\3")
base.replaceInFileRE(update_dir + "/onlyoffice.xml",
r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
"\\1" + base_url + "/changes/\\2/ReleaseNotesRU.html\\3")
r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE(?:|-x86)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
"\\1" + changes_url + "/\\2/ReleaseNotesRU.html\\3")
base.replaceInFileRE(update_dir + "/onlyoffice.xml",
r"(url=\")(?:.+)(ONLYOFFICE.+\.(zip|delta)\")", "\\1" + base_url + "/\\2")
r"(url=\")(?:.+/)(ONLYOFFICE.+\")", "\\1" + update_url + "/\\2")

for file in os.listdir(update_dir):
if -1 == file.find(app_version) and (file.endswith(".zip") or file.endswith(".html")):
Expand Down

0 comments on commit 3d9870e

Please sign in to comment.