From b23e14deb8e17a0693e1cfc055175d15074c83ae Mon Sep 17 00:00:00 2001 From: sebthom Date: Thu, 7 Nov 2024 22:57:37 +0100 Subject: [PATCH] ci: reduce dist sizes and build MacOS ARM dist --- .github/workflows/build.yml | 39 ++++++++++++++++++++++--- pom.xml | 5 ++++ product/fix_exec_flag_in_archives.py | 43 ---------------------------- product/pom.xml | 9 ++++-- 4 files changed, 46 insertions(+), 50 deletions(-) delete mode 100644 product/fix_exec_flag_in_archives.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc3dbef..397ec79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,10 +132,40 @@ jobs: ${{ github.event.inputs.additional_maven_args }} \ clean verify - python product/fix_exec_flag_in_archives.py - - mv product/target/products/org.haxe4e.studio-win32.win32.x86_64.zip \ - product/target/products/org.haxe4e.studio-win.x86_64.zip + cd product/target/products + + # remove unused dynamic libs + rm -rf \ + org.haxe4e.studio/linux/gtk/x86_64/plugins/com.sun.jna_*/com/sun/jna/{aix,darwin,freebsd,linux-a,linux-l,linux-m,linux-p,linux-r,linux-s,openbsd,sunos,win32}* \ + org.haxe4e.studio/macosx/cocoa/x86_64/Eclipse.app/Contents/Eclipse/plugins/com.sun.jna_*/com/sun/jna/{aix,freebsd,linux,openbsd,sunos,win32}* \ + org.haxe4e.studio/win32/win32/x86_64/plugins/com.sun.jna_*/com/sun/jna/{aix,darwin,freebsd,linux,openbsd,sunos}* + + # generate linux x86_64 archive + ( + cd org.haxe4e.studio/linux/gtk/x86_64; + tar -cf ../../../../org.haxe4e.studio-linux.gtk.x86_64.tar --exclude='HaxeStudio' --exclude='plugins/org.eclipse.justj.*/jre/bin' *; + tar --mode='+x' --append -f ../../../../org.haxe4e.studio-linux.gtk.x86_64.tar HaxeStudio plugins/org.eclipse.justj.*/jre/bin/* + ) + gzip -9 org.haxe4e.studio-linux.gtk.x86_64.tar + + # generate macos aarch64 archive + ( + cd org.haxe4e.studio/macosx/cocoa/aarch64; + tar -cf ../../../../org.haxe4e.studio-macosx.cocoa.aarch64.tar --exclude='Eclipse.app/Contents/MacOS/HaxeStudio' --exclude='Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.*/jre/bin' *; + tar --mode='+x' --append -f ../../../../org.haxe4e.studio-macosx.cocoa.aarch64.tar Eclipse.app/Contents/MacOS/HaxeStudio Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.*/jre/bin/* + ) + gzip -9 org.haxe4e.studio-macosx.cocoa.aarch64.tar + + # generate macos x86_64 archive + ( + cd org.haxe4e.studio/macosx/cocoa/x86_64; + tar -cf ../../../../org.haxe4e.studio-macosx.cocoa.x86_64.tar --exclude='Eclipse.app/Contents/MacOS/HaxeStudio' --exclude='Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.*/jre/bin' *; + tar --mode='+x' --append -f ../../../../org.haxe4e.studio-macosx.cocoa.x86_64.tar Eclipse.app/Contents/MacOS/HaxeStudio Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.*/jre/bin/* + ) + gzip -9 org.haxe4e.studio-macosx.cocoa.x86_64.tar + + # generate windows x86_64 archive + 7z a -mx9 -tzip org.haxe4e.studio-win.x86_64.zip ./org.haxe4e.studio/win32/win32/x86_64/* - name: Generate PortableApps archive @@ -184,6 +214,7 @@ jobs: --notes "$COMMIT_MSG" \ --target "${{ github.sha }}" \ product/target/products/org.haxe4e.studio-linux.gtk.x86_64.tar.gz \ + product/target/products/org.haxe4e.studio-macosx.cocoa.aarch64.tar.gz \ product/target/products/org.haxe4e.studio-macosx.cocoa.x86_64.tar.gz \ product/target/products/org.haxe4e.studio-win.x86_64.zip \ product/target/HaxeStudioPortable.paf.exe diff --git a/pom.xml b/pom.xml index 91c3b9a..cb3e88f 100644 --- a/pom.xml +++ b/pom.xml @@ -294,6 +294,11 @@ cocoa x86_64 + + macosx + cocoa + aarch64 + win32 win32 diff --git a/product/fix_exec_flag_in_archives.py b/product/fix_exec_flag_in_archives.py deleted file mode 100644 index 7e752ac..0000000 --- a/product/fix_exec_flag_in_archives.py +++ /dev/null @@ -1,43 +0,0 @@ -# SPDX-FileCopyrightText: © Haxe4E authors -# SPDX-FileContributor: Sebastian Thomschke -# SPDX-License-Identifier: EPL-2.0 -# SPDX-ArtifactOfProjectHomePage: https://github.com/haxe4e/haxe4e-studio -# -# Sets the missing executable flag in tar.gz files produced for Linux/MacOS when building on Windows -# https://bugs.eclipse.org/bugs/show_bug.cgi?id=442607 - -import fnmatch, os, tarfile - - -def set_executable(archivepath:str, files_to_change:list[str]): - print(f"Fixing file permission in {archivepath}...") - - os.rename(archivepath, f"{archivepath}.orig") - - source:tarfile.TarFile - target:tarfile.TarFile - - with tarfile.open(f"{archivepath}.orig", "r:gz") as source: - with tarfile.open(archivepath, "w:gz", compresslevel = 9) as target: - entry: tarfile.TarInfo - for entry in source.getmembers(): - if any(fnmatch.fnmatch(entry.path, pattern) for pattern in files_to_change): - entry.mode = 0o755 - - if entry.isfile(): - target.addfile(entry, source.extractfile(entry)) - else: - target.addfile(entry) - - os.remove(f"{archivepath}.orig") - - -cwd = os.path.dirname(__file__) - -set_executable(f"{cwd}/target/products/org.haxe4e.studio-linux.gtk.x86_64.tar.gz", [ - "HaxeStudio", - "plugins/org.eclipse.justj.openjdk.hotspot.jre.*/jre/bin/java"]) - -set_executable(f"{cwd}/target/products/org.haxe4e.studio-macosx.cocoa.x86_64.tar.gz", [ - "Eclipse.app/Contents/MacOS/HaxeStudio", - "Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.*/jre/bin/java"]) diff --git a/product/pom.xml b/product/pom.xml index 7f22dd9..b604737 100644 --- a/product/pom.xml +++ b/product/pom.xml @@ -31,7 +31,10 @@ create-product-distributions materialize-products - archive-products + @@ -41,11 +44,11 @@ org.haxe4e.studio - +