Skip to content

Commit

Permalink
Do not alter already signed jar
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria committed Apr 24, 2024
1 parent 6542bba commit 1b86d75
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
container('container') {
withCredentials([string(credentialsId: "${GITHUB_API_CREDENTIALS_ID}", variable: 'GITHUB_API_TOKEN')]) {
wrap([$class: 'Xvnc', useXauthority: true]) {
sh """mvn clean verify -B -fae -Dtycho.disableP2Mirrors=true -Ddownload.cache.skip=true -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true ${env.BRANCH_NAME=='master' ? '-Psign': ''} -Dmaven.repo.local=$WORKSPACE/.m2/repository -Dgithub.api.token="${GITHUB_API_TOKEN}" """
sh """mvn clean verify -B -fae -Dtycho.disableP2Mirrors=true -Ddownload.cache.skip=true -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Psign -Dmaven.repo.local=$WORKSPACE/.m2/repository -Dgithub.api.token="${GITHUB_API_TOKEN}" """
}
}
}
Expand Down
73 changes: 66 additions & 7 deletions org.eclipse.wildwebdeveloper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<goals>
<goal>checkout</goal>
</goals>
<phase>process-sources</phase>
<phase>generate-sources</phase>
<configuration>
<connectionUrl>scm:git:https://github.com/microsoft/vscode-eslint.git</connectionUrl>
<scmVersionType>tag</scmVersionType>
Expand All @@ -55,7 +55,7 @@
<executions>
<execution>
<id>fetch-vscode</id>
<phase>generate-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>wget</goal>
</goals>
Expand All @@ -67,7 +67,7 @@
</execution>
<execution>
<id>fetch-eslint-ls</id>
<phase>generate-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>wget</goal>
</goals>
Expand All @@ -80,7 +80,7 @@
</execution>
<execution>
<id>fetch-js-debug</id>
<phase>generate-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>wget</goal>
</goals>
Expand All @@ -99,7 +99,7 @@
<executions>
<execution>
<id>install-eslint-ls-package.json</id>
<phase>process-resources</phase>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
Expand Down Expand Up @@ -147,7 +147,7 @@
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<phase>generate-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
Expand All @@ -168,7 +168,7 @@
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<phase>process-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
Expand Down Expand Up @@ -200,4 +200,63 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>sign-node-files</id>
<goals>
<goal>run</goal>
</goals>
<phase>compile</phase>
<configuration>
<target>
<!-- See last answer of https://stackoverflow.com/questions/4368243/maven-antrun-with-sequential-ant-contrib-fails-to-run/45958355 -->
<!-- and http://ant-contrib.sourceforge.net/tasks/tasks/index.html -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" />
<property name="signingDir" value="${project.buiild.directory}/node-signing/" />
<for param="nodeFileAbsolute">
<fileset dir="${project.basedir}/node_modules" includes="**/*.node" erroronmissingdir="false" />
<sequential>
<echo level="info" message="Mac-sign @{nodeFileAbsolute}" />
<move file="@{nodeFileAbsolute}" tofile="@{nodeFileAbsolute}-tosign" />
<exec executable="curl" dir="${signingDir}" failonerror="true">
<arg value="-o" />
<arg value="@{nodeFileAbsolute}" />
<arg value="-F" />
<arg value="file=@{nodeFileAbsolute}-tosign" />
<arg value="https://cbi.eclipse.org/macos/codesign/sign" />
</exec>
<delete file="@{nodeFileAbsolute}-tosign" />
</sequential>
</for>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
81 changes: 14 additions & 67 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,88 +194,35 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<groupId>org.eclipse.cbi.maven.plugins</groupId>
<artifactId>eclipse-jarsigner-plugin</artifactId>
<version>1.4.3</version>
<executions>
<execution>
<id>sign-node-files</id>
<id>sign</id>
<phase>package</phase>
<goals>
<goal>run</goal>
<goal>sign</goal>
</goals>
<phase>package</phase> <!-- Do this before extracting sources-->
<configuration>
<target>
<!-- See last answer of https://stackoverflow.com/questions/4368243/maven-antrun-with-sequential-ant-contrib-fails-to-run/45958355 -->
<!-- and http://ant-contrib.sourceforge.net/tasks/tasks/index.html -->
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpathref="maven.plugin.classpath" />
<for param="jarFile">
<fileset dir="${project.basedir}/target" includes="**/*.jar" />
<sequential>
<local name="jarFilename" />
<basename property="jarFilename" file="@{jarFile}" suffix=".jar" />
<local name="signingDir" />
<property name="signingDir" value="${project.build.directory}/node-signing/${jarFilename}" />

<unzip src="@{jarFile}" dest="${signingDir}">
<patternset includes="node_modules/**/*.node" />
</unzip>

<for param="nodeFileAbsolute">
<fileset dir="${signingDir}" includes="node_modules/**/*.node" erroronmissingdir="false" />
<sequential>
<echo level="info" message="Mac-sign @{nodeFileAbsolute}" />
<local name="nodeFile" />
<property name="nodeFile" value="@{nodeFileAbsolute}" relative="true" basedir="${signingDir}" />
<move file="@{nodeFileAbsolute}" tofile="@{nodeFileAbsolute}-tosign" />
<exec executable="curl" dir="${signingDir}" failonerror="true">
<arg value="-o" />
<arg value="${nodeFile}" />
<arg value="-F" />
<arg value="file=@${nodeFile}-tosign" />
<arg value="https://cbi.eclipse.org/macos/codesign/sign" />
</exec>
<exec executable="jar" dir="${signingDir}" failonerror="true">
<arg value="--update" />
<arg value="--file=@{jarFile}" />
<arg value="${nodeFile}" />
</exec>
</sequential>
</for>
</sequential>
</for>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.cbi.maven.plugins</groupId>
<artifactId>eclipse-jarsigner-plugin</artifactId>
<version>1.4.3</version>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>sign</id>
<id>p2-metadata</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
<configuration>
<defaultP2Metadata>false</defaultP2Metadata>
</configuration>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 1b86d75

Please sign in to comment.