Skip to content

Commit 2334556

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

File tree

5 files changed

+115
-20
lines changed

5 files changed

+115
-20
lines changed

exist-core/pom.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<dependency>
203203
<groupId>org.lz4</groupId>
204204
<artifactId>lz4-java</artifactId>
205-
<version>1.8.0</version>
205+
<version>${lz4-java.version}</version>
206206
</dependency>
207207

208208
<dependency>
@@ -251,17 +251,6 @@
251251
<version>${jline.version}</version>
252252
</dependency>
253253

254-
<dependency>
255-
<groupId>org.jline</groupId>
256-
<artifactId>jansi</artifactId>
257-
<version>${jline.version}</version>
258-
<!--
259-
Optionally used by jline at runtime on Linux and macOS,
260-
and required by jline at runtime on Windows.
261-
-->
262-
<scope>runtime</scope>
263-
</dependency>
264-
265254
<dependency>
266255
<groupId>net.bytebuddy</groupId>
267256
<artifactId>byte-buddy</artifactId>

exist-distribution/pom.xml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@
381381
<include>src/app/entitlements.plist</include>
382382
<include>src/assembly/**</include>
383383
<include>src/dmgbuild/settings.py</include>
384-
<include>src/main/scripts/codesign-jansi-mac.sh</include>
384+
<include>src/main/scripts/codesign-jline-mac.sh</include>
385+
<include>src/main/scripts/codesign-lz4-java-mac.sh</include>
385386
<include>src/main/scripts/create-dmg-mac.sh</include>
386387
<include>src/main/xslt/catalog.xml</include>
387388
<include>src/main/xslt/web.xslt</include>
@@ -1248,20 +1249,40 @@
12481249
<executions>
12491250
<execution>
12501251
<!--
1251-
Signs the jansi native binaries
1252+
Signs the JLine native binaries
12521253
-->
1253-
<id>mac-codesign-jansi-native</id>
1254+
<id>mac-codesign-jline-native</id>
12541255
<phase>package</phase>
12551256
<goals>
12561257
<goal>exec</goal>
12571258
</goals>
12581259
<configuration>
12591260
<useMavenLogger>true</useMavenLogger>
1260-
<executable>${project.basedir}/src/main/scripts/codesign-jansi-mac.sh</executable>
1261+
<executable>${project.basedir}/src/main/scripts/codesign-jline-mac.sh</executable>
12611262
<arguments>
12621263
<argument>${mac.bundle.java.dir}</argument>
12631264
<argument>${jline.version}</argument>
1264-
<argument>${project.build.directory}/jansi-native</argument>
1265+
<argument>${project.build.directory}/jline-native</argument>
1266+
<argument>${mac.codesign.identity}</argument>
1267+
</arguments>
1268+
</configuration>
1269+
</execution>
1270+
<execution>
1271+
<!--
1272+
Signs the LZ4 Java native binaries
1273+
-->
1274+
<id>mac-codesign-lz4-java-native</id>
1275+
<phase>package</phase>
1276+
<goals>
1277+
<goal>exec</goal>
1278+
</goals>
1279+
<configuration>
1280+
<useMavenLogger>true</useMavenLogger>
1281+
<executable>${project.basedir}/src/main/scripts/codesign-lz4-java-mac.sh</executable>
1282+
<arguments>
1283+
<argument>${mac.bundle.java.dir}</argument>
1284+
<argument>${lz4-java.version}</argument>
1285+
<argument>${project.build.directory}/lz4-java-native</argument>
12651286
<argument>${mac.codesign.identity}</argument>
12661287
</arguments>
12671288
</configuration>
@@ -1423,6 +1444,7 @@
14231444
<argument>notarytool</argument>
14241445
<argument>submit</argument>
14251446
<argument>--verbose</argument>
1447+
<argument>--wait</argument>
14261448
<argument>--apple-id</argument>
14271449
<argument>${elemental.release.notarize.apple-id}</argument>
14281450
<argument>--team-id</argument>
@@ -1433,6 +1455,23 @@
14331455
</arguments>
14341456
</configuration>
14351457
</execution>
1458+
<execution>
1459+
<id>mac-stapler-staple-dmg</id>
1460+
<phase>package</phase>
1461+
<goals>
1462+
<goal>exec</goal>
1463+
</goals>
1464+
<configuration>
1465+
<useMavenLogger>true</useMavenLogger>
1466+
<executable>/usr/bin/xcrun</executable>
1467+
<arguments>
1468+
<argument>stapler</argument>
1469+
<argument>staple</argument>
1470+
<argument>--verbose</argument>
1471+
<argument>${mac.dmg}</argument>
1472+
</arguments>
1473+
</configuration>
1474+
</execution>
14361475

14371476
</executions>
14381477
</plugin>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
# $1 is .app/Contents/Java dir
28-
# $2 is the jansi version
28+
# $2 is the jline version
2929
# $3 is temp work directory
3030
# $4 the mac codesign identity
3131

@@ -50,15 +50,16 @@ do
5050
pushd "${3}"
5151

5252
# extract the native files
53-
jar -xf "${1}/jansi-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
53+
jar -xf "${1}/jline-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
5454

5555
# test if the file is unsigned, and sign if needed
5656
/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"
5757

5858
# overwrite the file in the jar
59-
jar -uf "${1}/jansi-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
59+
jar -uf "${1}/jline-${2}.jar" "org/jline/nativ/Mac/${arch}/libjlinenative.jnilib"
6060

6161
# switch back from temp output dir
6262
popd
6363

6464
done
65+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
# Use of this software is governed by the Business Source License 1.1
10+
# included in the LICENSE file and at www.mariadb.com/bsl11.
11+
#
12+
# Change Date: 2028-04-27
13+
#
14+
# On the date above, in accordance with the Business Source License, use
15+
# of this software will be governed by the Apache License, Version 2.0.
16+
#
17+
# Additional Use Grant: Production use of the Licensed Work for a permitted
18+
# purpose. A Permitted Purpose is any purpose other than a Competing Use.
19+
# A Competing Use means making the Software available to others in a commercial
20+
# product or service that: substitutes for the Software; substitutes for any
21+
# other product or service we offer using the Software that exists as of the
22+
# date we make the Software available; or offers the same or substantially
23+
# similar functionality as the Software.
24+
#
25+
26+
27+
# $1 is .app/Contents/Java dir
28+
# $2 is the lz4-java version
29+
# $3 is temp work directory
30+
# $4 the mac codesign identity
31+
32+
33+
set -e
34+
#set -x ## enable to help debug
35+
36+
# ensure a clean temp work directory
37+
if [ -d "${3}/net" ]
38+
then
39+
rm -rf "${3}/net"
40+
fi
41+
42+
# for each native arch
43+
archs=('aarch64' 'x86_64')
44+
for arch in ${archs[@]}
45+
do
46+
# create the temp output dirs
47+
mkdir -p "${3}/net/jpountz/util/darwin/${arch}"
48+
49+
# switch to temp output dir
50+
pushd "${3}"
51+
52+
# extract the native files
53+
jar -xf "${1}/lz4-java-${2}.jar" "net/jpountz/util/darwin/${arch}/liblz4-java.dylib"
54+
55+
# test if the file is unsigned, and sign if needed
56+
/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"
57+
58+
# overwrite the file in the jar
59+
jar -uf "${1}/lz4-java-${2}.jar" "net/jpountz/util/darwin/${arch}/liblz4-java.dylib"
60+
61+
# switch back from temp output dir
62+
popd
63+
64+
done
65+

exist-parent/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<icu.version>59.1</icu.version>
103103
<izpack.version>5.2.4</izpack.version>
104104
<jline.version>3.29.0</jline.version>
105+
<lz4-java.version>1.8.0</lz4-java.version>
105106
<jdom1.version>1.1.3</jdom1.version>
106107
<jetty.version>11.0.25</jetty.version>
107108
<log4j.version>2.24.3</log4j.version>

0 commit comments

Comments
 (0)