Skip to content

Commit 7894495

Browse files
committed
[bugfix] Improve macOS notarization process
Closes #2
1 parent d83928f commit 7894495

File tree

5 files changed

+117
-25
lines changed

5 files changed

+117
-25
lines changed

exist-core/pom.xml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
<dependency>
200200
<groupId>org.lz4</groupId>
201201
<artifactId>lz4-java</artifactId>
202-
<version>1.8.0</version>
202+
<version>${lz4-java.version}</version>
203203
</dependency>
204204

205205
<dependency>
@@ -245,18 +245,7 @@
245245
<dependency>
246246
<groupId>org.jline</groupId>
247247
<artifactId>jline</artifactId>
248-
<version>3.29.0</version>
249-
</dependency>
250-
251-
<dependency>
252-
<groupId>org.fusesource.jansi</groupId>
253-
<artifactId>jansi</artifactId>
254-
<version>${jansi.version}</version>
255-
<!--
256-
Optionally used by jline at runtime on Linux and macOS,
257-
and required by jline at runtime on Windows.
258-
-->
259-
<scope>runtime</scope>
248+
<version>${jline.version}</version>
260249
</dependency>
261250

262251
<dependency>

exist-distribution/pom.xml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@
377377
<includes>
378378
<include>src/app/entitlements.plist</include>
379379
<include>src/dmgbuild/settings.py</include>
380-
<include>src/main/scripts/codesign-jansi-mac.sh</include>
380+
<include>src/main/scripts/codesign-jline-mac.sh</include>
381+
<include>src/main/scripts/codesign-lz4-java-mac.sh</include>
381382
<include>src/main/scripts/create-dmg-mac.sh</include>
382383
</includes>
383384
<excludes>
@@ -1241,20 +1242,40 @@
12411242
<executions>
12421243
<execution>
12431244
<!--
1244-
Signs the jansi native binaries
1245+
Signs the JLine native binaries
12451246
-->
1246-
<id>mac-codesign-jansi-native</id>
1247+
<id>mac-codesign-jline-native</id>
12471248
<phase>package</phase>
12481249
<goals>
12491250
<goal>exec</goal>
12501251
</goals>
12511252
<configuration>
12521253
<useMavenLogger>true</useMavenLogger>
1253-
<executable>${project.basedir}/src/main/scripts/codesign-jansi-mac.sh</executable>
1254+
<executable>${project.basedir}/src/main/scripts/codesign-jline-mac.sh</executable>
12541255
<arguments>
12551256
<argument>${mac.bundle.java.dir}</argument>
1256-
<argument>${jansi.version}</argument>
1257-
<argument>${project.build.directory}/jansi-native</argument>
1257+
<argument>${jline.version}</argument>
1258+
<argument>${project.build.directory}/jline-native</argument>
1259+
<argument>${mac.codesign.identity}</argument>
1260+
</arguments>
1261+
</configuration>
1262+
</execution>
1263+
<execution>
1264+
<!--
1265+
Signs the LZ4 Java native binaries
1266+
-->
1267+
<id>mac-codesign-lz4-java-native</id>
1268+
<phase>package</phase>
1269+
<goals>
1270+
<goal>exec</goal>
1271+
</goals>
1272+
<configuration>
1273+
<useMavenLogger>true</useMavenLogger>
1274+
<executable>${project.basedir}/src/main/scripts/codesign-lz4-java-mac.sh</executable>
1275+
<arguments>
1276+
<argument>${mac.bundle.java.dir}</argument>
1277+
<argument>${lz4-java.version}</argument>
1278+
<argument>${project.build.directory}/lz4-java-native</argument>
12581279
<argument>${mac.codesign.identity}</argument>
12591280
</arguments>
12601281
</configuration>
@@ -1416,6 +1437,7 @@
14161437
<argument>notarytool</argument>
14171438
<argument>submit</argument>
14181439
<argument>--verbose</argument>
1440+
<argument>--wait</argument>
14191441
<argument>--apple-id</argument>
14201442
<argument>${elemental.release.notarize.apple-id}</argument>
14211443
<argument>--team-id</argument>
@@ -1426,6 +1448,23 @@
14261448
</arguments>
14271449
</configuration>
14281450
</execution>
1451+
<execution>
1452+
<id>mac-stapler-staple-dmg</id>
1453+
<phase>package</phase>
1454+
<goals>
1455+
<goal>exec</goal>
1456+
</goals>
1457+
<configuration>
1458+
<useMavenLogger>true</useMavenLogger>
1459+
<executable>/usr/bin/xcrun</executable>
1460+
<arguments>
1461+
<argument>stapler</argument>
1462+
<argument>staple</argument>
1463+
<argument>--verbose</argument>
1464+
<argument>${mac.dmg}</argument>
1465+
</arguments>
1466+
</configuration>
1467+
</execution>
14291468

14301469
</executions>
14311470
</plugin>

exist-distribution/src/main/scripts/codesign-jansi-mac.sh renamed to exist-distribution/src/main/scripts/codesign-jline-mac.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
# $1 is .app/Contents/Java dir
25-
# $2 is the jansi version
25+
# $2 is the jline version
2626
# $3 is temp work directory
2727
# $4 the mac codesign identity
2828

@@ -41,21 +41,22 @@ archs=('arm64' 'x86' 'x86_64')
4141
for arch in ${archs[@]}
4242
do
4343
# create the temp output dirs
44-
mkdir -p "${3}/org/fusesource/jansi/internal/native/Mac/${arch}"
44+
mkdir -p "${3}/org/jline/nativ/Mac/${arch}"
4545

4646
# switch to temp output dir
4747
pushd "${3}"
4848

4949
# extract the native files
50-
jar -xf "${1}/jansi-${2}.jar" "org/fusesource/jansi/internal/native/Mac/${arch}/libjansi.jnilib"
50+
jar -xf "${1}/jline-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
5151

5252
# test if the file is unsigned, and sign if needed
53-
/usr/bin/codesign --verbose --test-requirement="=anchor trusted" --verify "org/fusesource/jansi/internal/native/Mac/${arch}/libjansi.jnilib" || /usr/bin/codesign --verbose --force --timestamp --sign "${4}" "org/fusesource/jansi/internal/native/Mac/${arch}/libjansi.jnilib"
53+
/usr/bin/codesign --verbose --test-requirement="=anchor trusted" --verify "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib" || /usr/bin/codesign --verbose --force --timestamp --sign "${4}" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
5454

5555
# overwrite the file in the jar
56-
jar -uf "${1}/jansi-${2}.jar" "org/fusesource/jansi/internal/native/Mac/${arch}/libjansi.jnilib"
56+
jar -uf "${1}/jline-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
5757

5858
# switch back from temp output dir
5959
popd
6060

6161
done
62+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Elemental
4+
# Copyright (C) 2024, Evolved Binary Ltd
5+
#
6+
7+
# https://www.evolvedbinary.com | https://www.elemental.xyz
8+
#
9+
# This library is free software; you can redistribute it and/or
10+
# modify it under the terms of the GNU Lesser General Public
11+
# License as published by the Free Software Foundation; version 2.1.
12+
#
13+
# This library is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
# Lesser General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Lesser General Public
19+
# License along with this library; if not, write to the Free Software
20+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
#
22+
23+
24+
# $1 is .app/Contents/Java dir
25+
# $2 is the lz4-java version
26+
# $3 is temp work directory
27+
# $4 the mac codesign identity
28+
29+
30+
set -e
31+
#set -x ## enable to help debug
32+
33+
# ensure a clean temp work directory
34+
if [ -d "${3}/net" ]
35+
then
36+
rm -rf "${3}/net"
37+
fi
38+
39+
# for each native arch
40+
archs=('aarch64' 'x86_64')
41+
for arch in ${archs[@]}
42+
do
43+
# create the temp output dirs
44+
mkdir -p "${3}/net/jpountz/util/darwin/${arch}"
45+
46+
# switch to temp output dir
47+
pushd "${3}"
48+
49+
# extract the native files
50+
jar -xf "${1}/lz4-java-${2}.jar" "net/jpountz/util/darwin/${arch}/liblz4-java.dylib"
51+
52+
# test if the file is unsigned, and sign if needed
53+
/usr/bin/codesign --verbose --test-requirement="=anchor trusted" --verify "net/jpountz/util/darwin/${arch}/liblz4-java.dylib" || /usr/bin/codesign --verbose --force --timestamp --sign "${4}" "net/jpountz/util/darwin/${arch}/liblz4-java.dylib"
54+
55+
# overwrite the file in the jar
56+
jar -uf "${1}/lz4-java-${2}.jar" "net/jpountz/util/darwin/${arch}/liblz4-java.dylib"
57+
58+
# switch back from temp output dir
59+
popd
60+
61+
done
62+

exist-parent/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
<exquery.distribution.version>0.2.1</exquery.distribution.version>
9999
<icu.version>59.1</icu.version>
100100
<izpack.version>5.2.4</izpack.version>
101-
<jansi.version>2.4.1</jansi.version>
101+
<jline.version>3.29.0</jline.version>
102+
<lz4-java.version>1.8.0</lz4-java.version>
102103
<jdom1.version>1.1.3</jdom1.version>
103104
<jetty.version>11.0.25</jetty.version>
104105
<log4j.version>2.24.3</log4j.version>

0 commit comments

Comments
 (0)