Skip to content

Commit ffa81d6

Browse files
authored
Merge pull request #55 from ledhed2222/fix-mac-packaging
Fix mac packaging
2 parents 96a4c1a + 91fe902 commit ffa81d6

File tree

6 files changed

+133
-7
lines changed

6 files changed

+133
-7
lines changed

.github/macos/entitlements.plist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- Allow JIT compilation (required for Java) -->
6+
<key>com.apple.security.cs.allow-jit</key>
7+
<true/>
8+
9+
<!-- Allow unsigned executable memory (required for Java) -->
10+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
11+
<true/>
12+
13+
<!-- Allow DYLD environment variables (for library loading) -->
14+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
15+
<true/>
16+
17+
<!-- Disable library validation (to load Java native libraries) -->
18+
<key>com.apple.security.cs.disable-library-validation</key>
19+
<true/>
20+
</dict>
21+
</plist>

.github/workflows/build-installers.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ jobs:
6969
# Remove any existing app bundle
7070
rm -rf target/EWItool.app
7171
72+
# Build module path from Maven dependencies
73+
ARCH=$(uname -m)
74+
if [ "$ARCH" = "arm64" ]; then
75+
JAVAFX_ARCH="mac-aarch64"
76+
else
77+
JAVAFX_ARCH="mac"
78+
fi
79+
80+
MODULE_PATH="target/libs/javafx-base-23.0.2-$JAVAFX_ARCH.jar"
81+
MODULE_PATH="$MODULE_PATH:target/libs/javafx-graphics-23.0.2-$JAVAFX_ARCH.jar"
82+
MODULE_PATH="$MODULE_PATH:target/libs/javafx-controls-23.0.2-$JAVAFX_ARCH.jar"
83+
7284
# First create just the app-image (app bundle), not DMG yet
7385
jpackage \
7486
--type app-image \
@@ -79,20 +91,22 @@ jobs:
7991
--dest target \
8092
--app-version ${{ steps.version.outputs.version }} \
8193
--vendor "Ledhed2222" \
82-
--icon src/main/resources/logo.icns
94+
--icon src/main/resources/logo.icns \
95+
--module-path "$MODULE_PATH" \
96+
--add-modules javafx.base,javafx.graphics,javafx.controls
8397
8498
- name: Sign app bundle with hardened runtime
8599
run: |
86100
CERT_IDENTITY=$(security find-identity -v -p codesigning | grep "Developer ID Application" | head -1 | sed -n 's/.*"\(.*\)"/\1/p')
87101
88-
# Sign all nested binaries, libraries, and frameworks with hardened runtime
102+
# Sign all nested binaries, libraries, and frameworks with hardened runtime and entitlements
89103
find target/EWItool.app/Contents -type f \( -name "*.dylib" -o -name "*.jnilib" -o -perm +111 \) | while read file; do
90104
echo "Signing: $file"
91-
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime "$file" || true
105+
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --entitlements .github/macos/entitlements.plist "$file" || true
92106
done
93107
94-
# Sign the app bundle itself
95-
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --deep target/EWItool.app
108+
# Sign the app bundle itself with entitlements
109+
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --entitlements .github/macos/entitlements.plist --deep target/EWItool.app
96110
97111
# Verify signature
98112
codesign --verify --deep --strict --verbose=2 target/EWItool.app

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Ignore Maven build output directory
77
target
88

9+
# jpackage build artifacts
10+
jpackage-input
11+
912
# macos artifacts
1013
.DS_Store
1114

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.github.ledhed2222</groupId>
66
<artifactId>EWItool</artifactId>
7-
<version>2.7.2</version>
7+
<version>2.7.3</version>
88
<name>EWItool</name>
99
<url>https://github.com/ledhed2222/EWItool</url>
1010

scripts/build-macos-local.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Get version from pom.xml
5+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
6+
echo "Building version: $VERSION"
7+
8+
# Find Developer ID certificate
9+
CERT_IDENTITY=$(security find-identity -v -p codesigning | grep "Developer ID Application" | head -1 | sed -n 's/.*"\(.*\)"/\1/p')
10+
echo "Using certificate: $CERT_IDENTITY"
11+
12+
# Build JAR
13+
echo "Building JAR..."
14+
mvn clean package
15+
16+
# Create clean input directory
17+
echo "Preparing jpackage input..."
18+
rm -rf jpackage-input
19+
mkdir -p jpackage-input
20+
cp target/EWItool-$VERSION.jar jpackage-input/
21+
22+
# Remove old app bundle
23+
rm -rf target/EWItool.app
24+
25+
# Create app bundle
26+
echo "Creating app bundle..."
27+
28+
# Get JavaFX version and architecture
29+
JAVAFX_VERSION=23.0.2
30+
ARCH=$(uname -m)
31+
if [ "$ARCH" = "arm64" ]; then
32+
JAVAFX_ARCH="mac-aarch64"
33+
else
34+
JAVAFX_ARCH="mac"
35+
fi
36+
37+
# Build module path from Maven repository
38+
JAVAFX_BASE="$HOME/.m2/repository/org/openjfx"
39+
MODULE_PATH="$JAVAFX_BASE/javafx-base/$JAVAFX_VERSION/javafx-base-$JAVAFX_VERSION-$JAVAFX_ARCH.jar"
40+
MODULE_PATH="$MODULE_PATH:$JAVAFX_BASE/javafx-graphics/$JAVAFX_VERSION/javafx-graphics-$JAVAFX_VERSION-$JAVAFX_ARCH.jar"
41+
MODULE_PATH="$MODULE_PATH:$JAVAFX_BASE/javafx-controls/$JAVAFX_VERSION/javafx-controls-$JAVAFX_VERSION-$JAVAFX_ARCH.jar"
42+
43+
jpackage \
44+
--type app-image \
45+
--name EWItool \
46+
--input jpackage-input \
47+
--main-jar EWItool-$VERSION.jar \
48+
--main-class com.github.ledhed2222.ewitool.Main \
49+
--dest target \
50+
--app-version $VERSION \
51+
--vendor "Ledhed2222" \
52+
--icon src/main/resources/logo.icns \
53+
--module-path "$MODULE_PATH" \
54+
--add-modules javafx.base,javafx.graphics,javafx.controls
55+
56+
# Sign nested binaries with entitlements
57+
echo "Signing nested binaries..."
58+
find target/EWItool.app/Contents -type f \( -name "*.dylib" -o -name "*.jnilib" -o -perm +111 \) | while read file; do
59+
echo " Signing: $file"
60+
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --entitlements .github/macos/entitlements.plist "$file" 2>/dev/null || true
61+
done
62+
63+
# Sign app bundle with entitlements
64+
echo "Signing app bundle..."
65+
codesign --force --sign "$CERT_IDENTITY" --timestamp --options runtime --entitlements .github/macos/entitlements.plist --deep target/EWItool.app
66+
67+
# Verify signature
68+
echo "Verifying signature..."
69+
codesign --verify --deep --strict --verbose=2 target/EWItool.app
70+
71+
# Create DMG
72+
echo "Creating DMG..."
73+
rm -f target/EWItool-$VERSION.dmg
74+
hdiutil create -volname EWItool -srcfolder target/EWItool.app -ov -format UDZO target/EWItool-$VERSION.dmg
75+
76+
# Sign DMG
77+
echo "Signing DMG..."
78+
codesign --force --sign "$CERT_IDENTITY" --timestamp target/EWItool-$VERSION.dmg
79+
80+
# Verify DMG
81+
codesign --verify --verbose=4 target/EWItool-$VERSION.dmg
82+
83+
echo ""
84+
echo "✅ Build complete!"
85+
echo "App bundle: target/EWItool.app"
86+
echo "DMG: target/EWItool-$VERSION.dmg"
87+
echo ""
88+
echo "Test the app with: target/EWItool.app/Contents/MacOS/EWItool"

src/main/java/com/github/ledhed2222/ewitool/UiMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class UiMain extends Application {
3939

4040
static final String APP_NAME = "EWItool";
41-
static final String APP_VERSION = "2.7.2";
41+
static final String APP_VERSION = "2.7.3";
4242
static final int COPYRIGHT_YEAR = 2025;
4343
static final String RELEASE_STATUS = "Production";
4444
static final String LEAD_AUTHOR = "S.Merrony & ledhed2222";

0 commit comments

Comments
 (0)