mac build maven

This commit is contained in:
Bane Stojkovic
2025-03-17 23:42:05 +01:00
parent b3568b3ec9
commit f0ed0275cf
3 changed files with 270 additions and 29 deletions
+263 -28
View File
@@ -112,6 +112,13 @@
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>appbundler</artifactId>
<version>1.3.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/tools/ant-lib/appbundler-1.3.1.jar</systemPath>
</dependency>
<!-- Local dependencies from lib folder -->
<dependency>
@@ -212,14 +219,14 @@
<executions>
<execution>
<id>make-assembly</id>
<configuration>
<finalName>diylc-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>diylc-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
@@ -236,7 +243,6 @@
<jdk.archive.linux>OpenJDK17U-jre_x64_linux_hotspot_${jdk.version.file}.tar.gz</jdk.archive.linux>
<jdk.url.linux>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk.version}/${jdk.archive.linux}</jdk.url.linux>
<jre.dest.linux>${project.build.directory}/jre-temp</jre.dest.linux>
<appdir.jre>${appdir.dir}/usr/bin/jre</appdir.jre>
<wsl.command>wsl bash -c</wsl.command>
<appimage.output.file>DIYLayoutCreator-${project.version}-x86_64.AppImage</appimage.output.file>
</properties>
@@ -439,22 +445,6 @@
<!-- Clean up temporary directory -->
<delete dir="${project.build.directory}/docker-tmp" />
<!-- &lt;!&ndash; Linux-specific build &ndash;&gt;-->
<!-- <echo message="Linux build will execute: ${isLinux}" />-->
<!-- <exec executable="bash" failonerror="true" osfamily="unix">-->
<!-- <arg line="-c 'echo Building AppImage natively on Linux...'" />-->
<!-- </exec>-->
<!-- -->
<!-- &lt;!&ndash; Install dependencies if needed &ndash;&gt;-->
<!-- <exec executable="bash" failonerror="true" osfamily="unix">-->
<!-- <arg line="-c 'which appimagetool || (echo &quot;Installing appimagetool...&quot; &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install -y libfuse2 fuse &amp;&amp; wget -O /tmp/appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage &amp;&amp; chmod +x /tmp/appimagetool &amp;&amp; sudo mv /tmp/appimagetool /usr/local/bin/)'" />-->
<!-- </exec>-->
<!-- -->
<!-- &lt;!&ndash; Build AppImage &ndash;&gt;-->
<!-- <exec executable="bash" failonerror="true" osfamily="unix">-->
<!-- <arg line="-c 'appimagetool ${appdir.dir} ${project.build.directory}/${appimage.output.file}'" />-->
<!-- </exec>-->
<!-- Create zip package -->
<zip destfile="${project.build.directory}/diylc-${project.version}-linux.zip">
<zipfileset file="${project.build.directory}/${appimage.output.file}"
@@ -471,7 +461,6 @@
</build>
</profile>
<!-- Windows InnoSetup build profile using Docker -->
<profile>
<id>win64-installer</id>
<properties>
@@ -479,6 +468,7 @@
<jdk.version.file>17.0.14_7</jdk.version.file>
<jdk.archive.win64>OpenJDK17U-jre_x64_windows_hotspot_${jdk.version.file}.zip</jdk.archive.win64>
<jdk.url.win64>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk.version}/${jdk.archive.win64}</jdk.url.win64>
<jre.dest.win64>${project.build.directory}/jre_win</jre.dest.win64>
</properties>
<build>
<plugins>
@@ -497,10 +487,10 @@
<configuration>
<target>
<!-- Clean old jre_win folder -->
<delete dir="${project.build.directory}/jre_win" />
<delete dir="${jre.dest.win64}" />
<!-- Create folder to hold extracted JRE -->
<mkdir dir="${project.build.directory}/jre_win" />
<mkdir dir="${jre.dest.win64}" />
<!-- Download JRE 64-bit for Windows -->
<mkdir dir="${project.build.directory}/downloads" />
@@ -510,15 +500,15 @@
<!-- Extract JRE into jre_win -->
<unzip src="${project.build.directory}/downloads/${jdk.archive.win64}"
dest="${project.build.directory}/jre_win" />
dest="${jre.dest.win64}" />
<!-- Move files up one level -->
<move todir="${project.build.directory}/jre_win">
<fileset dir="${project.build.directory}/jre_win/jdk-${jdk.version}-jre" />
<move todir="${jre.dest.win64}">
<fileset dir="${jre.dest.win64}/jdk-${jdk.version}-jre" />
</move>
<!-- Remove empty top-level folder -->
<delete dir="${project.build.directory}/jre_win/jdk-${jdk.version}-jre" />
<delete dir="${jre.dest.win64}/jdk-${jdk.version}-jre" />
</target>
</configuration>
</execution>
@@ -556,5 +546,250 @@
</plugins>
</build>
</profile>
<profile>
<id>mac-x86</id>
<properties>
<jdk.version>17.0.14+7</jdk.version>
<jdk.version.file>17.0.14_7</jdk.version.file>
<jdk.archive.osx>OpenJDK17U-jre_x64_mac_hotspot_${jdk.version.file}.tar.gz</jdk.archive.osx>
<jdk.url.osx>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk.version}/${jdk.archive.osx}</jdk.url.osx>
<jre.dest.osx>${project.build.directory}/jre_x86</jre.dest.osx>
</properties>
<build>
<plugins>
<!-- Download and extract JRE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>download-extract-jre</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Clean old jre folders -->
<delete dir="${jre.dest.osx}" />
<mkdir dir="${jre.dest.osx}" />
<mkdir dir="${project.build.directory}/downloads" />
<!-- Download JRE -->
<get src="${jdk.url.osx}"
dest="${project.build.directory}/downloads/${jdk.archive.osx}"
usetimestamp="true" />
<!-- Extract JRE -->
<untar src="${project.build.directory}/downloads/${jdk.archive.osx}"
dest="${jre.dest.osx}"
compression="gzip" />
<!-- Move files up one level -->
<move todir="${jre.dest.osx}">
<fileset dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
</move>
<!-- Remove empty top-level folder -->
<delete dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
</target>
</configuration>
</execution>
<!-- Create macOS app bundle -->
<execution>
<id>create-mac-bundle</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpathref="maven.compile.classpath"/>
<bundleapp outputdirectory="${project.build.directory}"
name="DIYLC"
displayname="DIY Layout Creator"
identifier="org.diylc.Desktop"
shortversion="${project.version}"
applicationCategory="public.app-category.graphics-design"
icon="${project.basedir}/src/main/resources/icons/diylc.icns"
mainclassname="org.diylc.DIYLCStarter"
copyright="2025 bancika"
jvmrequired="17">
<bundledocument contentTypes="org.diylc.diy"
name="DIYLC document"
role="Editor"
handlerRank="Owner">
</bundledocument>
<typedeclaration
identifier="org.diylc.diy"
description="DIYLC file type"
icon="${project.basedir}/src/main/resources/icons/diylc_file.icns"
conformsTo="public.xml,public.text"
extensions="diy" />
<runtime dir="${jre.dest.osx}/Contents/Home" />
<arch name="x86_64"/>
<classpath file="${project.build.directory}/diylc.jar" />
<option value="-Xms512m" />
<option value="-Xmx4096m" />
<option value="--add-exports=java.desktop/com.apple.eawt.event=ALL-UNNAMED" />
<option value="--add-exports=java.desktop/com.apple.eio=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.util=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.text=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt.font=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED" />
<option value="-Dorg.diylc.scriptRun=true" />
<option value="-Dfile.encoding=UTF-8" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dapple.awt.application.name=DIY Layout Creator"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dsun.java2d.metal=true"/>
<option value="-Xdock:name=DIY Layout Creator"/>
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp>
<!-- Create zip package -->
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-x86.zip">
<zipfileset filemode="755" dir="${project.build.directory}/DIYLC.app" prefix="DIYLC.app" />
</zip>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>mac-arm</id>
<properties>
<jdk.version>17.0.14+7</jdk.version>
<jdk.version.file>17.0.14_7</jdk.version.file>
<jdk.archive.osx>OpenJDK17U-jre_aarch64_mac_hotspot_${jdk.version.file}.tar.gz</jdk.archive.osx>
<jdk.url.osx>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk.version}/${jdk.archive.osx}</jdk.url.osx>
<jre.dest.osx>${project.build.directory}/jre_arm</jre.dest.osx>
</properties>
<build>
<plugins>
<!-- Download and extract JRE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>download-extract-jre</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Clean old jre folders -->
<delete dir="${jre.dest.osx}" />
<mkdir dir="${jre.dest.osx}" />
<mkdir dir="${project.build.directory}/downloads" />
<!-- Download JRE -->
<get src="${jdk.url.osx}"
dest="${project.build.directory}/downloads/${jdk.archive.osx}"
usetimestamp="true" />
<!-- Extract JRE -->
<untar src="${project.build.directory}/downloads/${jdk.archive.osx}"
dest="${jre.dest.osx}"
compression="gzip" />
<!-- Move files up one level -->
<move todir="${jre.dest.osx}">
<fileset dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
</move>
<!-- Remove empty top-level folder -->
<delete dir="${jre.dest.osx}/jdk-${jdk.version}-jre" />
</target>
</configuration>
</execution>
<!-- Create macOS app bundle -->
<execution>
<id>create-mac-bundle</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpathref="maven.compile.classpath"/>
<bundleapp outputdirectory="${project.build.directory}"
name="DIYLC"
displayname="DIY Layout Creator"
identifier="org.diylc.Desktop"
shortversion="${project.version}"
applicationCategory="public.app-category.graphics-design"
icon="${project.basedir}/src/main/resources/icons/diylc.icns"
mainclassname="org.diylc.DIYLCStarter"
copyright="2025 bancika"
jvmrequired="17">
<bundledocument contentTypes="org.diylc.diy"
name="DIYLC document"
role="Editor"
handlerRank="Owner">
</bundledocument>
<typedeclaration
identifier="org.diylc.diy"
description="DIYLC file type"
icon="${project.basedir}/src/main/resources/icons/diylc_file.icns"
conformsTo="public.xml,public.text"
extensions="diy" />
<runtime dir="${jre.dest.osx}/Contents/Home" />
<arch name="arm64"/>
<arch name="arm64e"/>
<classpath file="${project.build.directory}/diylc.jar" />
<option value="-Xms512m" />
<option value="-Xmx4096m" />
<option value="--add-exports=java.desktop/com.apple.eawt.event=ALL-UNNAMED" />
<option value="--add-exports=java.desktop/com.apple.eio=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.util=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<option value="--add-opens=java.base/java.text=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt.font=ALL-UNNAMED" />
<option value="--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED" />
<option value="-Dorg.diylc.scriptRun=true" />
<option value="-Dfile.encoding=UTF-8" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dapple.awt.application.name=DIY Layout Creator"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dsun.java2d.metal=true"/>
<option value="-Xdock:name=DIY Layout Creator"/>
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp>
<!-- Create zip package -->
<zip destfile="${project.build.directory}/diylc-${project.version}-osx-arm.zip">
<zipfileset filemode="755" dir="${project.build.directory}/DIYLC.app" prefix="DIYLC.app" />
</zip>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>