Skip to content

Commit a2413c3

Browse files
committed
[build] Sign '*.node' files for MacOS
This PR has the goal to resolve issue #1403 by implementing the steps that are performed in Orbit to sign Mac '*.node' NPM modules for the WWD build. Fixes: #1403
1 parent 8e8277f commit a2413c3

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

pom.xml

+71-2
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,81 @@
211211
</plugins>
212212
</pluginManagement>
213213
</build>
214-
215-
214+
216215
<profiles>
217216
<profile>
218217
<id>packAndSign</id>
219218
<build>
220219
<plugins>
220+
<plugin>
221+
<groupId>org.apache.maven.plugins</groupId>
222+
<artifactId>maven-antrun-plugin</artifactId>
223+
<dependencies>
224+
<dependency>
225+
<groupId>ant-contrib</groupId>
226+
<artifactId>ant-contrib</artifactId>
227+
<version>1.0b3</version>
228+
<exclusions>
229+
<exclusion>
230+
<groupId>ant</groupId>
231+
<artifactId>ant</artifactId>
232+
</exclusion>
233+
</exclusions>
234+
</dependency>
235+
</dependencies>
236+
<executions>
237+
<execution>
238+
<id>sign-node-files</id>
239+
<goals>
240+
<goal>run</goal>
241+
</goals>
242+
<phase>package</phase> <!-- Do this before extracting sources-->
243+
<configuration>
244+
<target>
245+
<!-- See last answer of https://stackoverflow.com/questions/4368243/maven-antrun-with-sequential-ant-contrib-fails-to-run/45958355 -->
246+
<!-- and http://ant-contrib.sourceforge.net/tasks/tasks/index.html -->
247+
<taskdef resource="net/sf/antcontrib/antlib.xml"
248+
classpathref="maven.plugin.classpath" />
249+
<for param="jarFile">
250+
<fileset dir="${project.basedir}/target" includes="**/*.jar" />
251+
<sequential>
252+
<local name="jarFilename" />
253+
<basename property="jarFilename" file="@{jarFile}" suffix=".jar" />
254+
<local name="signingDir" />
255+
<property name="signingDir" value="${project.build.directory}/node-signing/${jarFilename}" />
256+
257+
<unzip src="@{jarFile}" dest="${signingDir}">
258+
<patternset includes="node_modules/**/*.node" />
259+
</unzip>
260+
261+
<for param="nodeFileAbsolute">
262+
<fileset dir="${signingDir}" includes="node_modules/**/*.node" erroronmissingdir="false" />
263+
<sequential>
264+
<echo level="info" message="Mac-sign @{nodeFileAbsolute}" />
265+
<local name="nodeFile" />
266+
<property name="nodeFile" value="@{nodeFileAbsolute}" relative="true" basedir="${signingDir}" />
267+
<move file="@{nodeFileAbsolute}" tofile="@{nodeFileAbsolute}-tosign" />
268+
<exec executable="curl" dir="${signingDir}" failonerror="true">
269+
<arg value="-o" />
270+
<arg value="${nodeFile}" />
271+
<arg value="-F" />
272+
<arg value="file=@${nodeFile}-tosign" />
273+
<arg value="https://cbi.eclipse.org/macos/codesign/sign" />
274+
</exec>
275+
<exec executable="jar" dir="${signingDir}" failonerror="true">
276+
<arg value="--update" />
277+
<arg value="--file=@{jarFile}" />
278+
<arg value="${nodeFile}" />
279+
</exec>
280+
</sequential>
281+
</for>
282+
</sequential>
283+
</for>
284+
</target>
285+
</configuration>
286+
</execution>
287+
</executions>
288+
</plugin>
221289
<plugin>
222290
<groupId>org.eclipse.cbi.maven.plugins</groupId>
223291
<artifactId>eclipse-jarsigner-plugin</artifactId>
@@ -252,6 +320,7 @@
252320
</plugins>
253321
</build>
254322
</profile>
323+
255324
<!-- Automatic profile for Mac-specific settings -->
256325
<profile>
257326
<id>macos</id>

0 commit comments

Comments
 (0)