11/* *****************************************************************************
22 * Copyright (c) 2016 TypeFox and others.
3- *
3+ *
44 * This program and the accompanying materials are made available under the
55 * terms of the Eclipse Public License v. 2.0 which is available at
66 * http://www.eclipse.org/legal/epl-2.0,
77 * or the Eclipse Distribution License v. 1.0 which is available at
88 * http://www.eclipse.org/org/documents/edl-v10.php.
9- *
9+ *
1010 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
1111 ******************************************************************************/
1212
@@ -39,28 +39,28 @@ tasks.withType(Test).configureEach {
3939}
4040
4141task sourcesJar (type : Jar , dependsOn : classes) {
42- group ' Build'
43- description ' Assembles a jar archive containing the sources.'
42+ group = ' Build'
43+ description = ' Assembles a jar archive containing the sources.'
4444 archiveClassifier = ' sources'
4545 from sourceSets. main. allSource
4646}
4747
4848task javadocJar (type : Jar , dependsOn : javadoc) {
49- group ' Build'
50- description ' Assembles a jar archive containing the JavaDoc output.'
49+ group = ' Build'
50+ description = ' Assembles a jar archive containing the JavaDoc output.'
5151 archiveClassifier = ' javadoc'
5252 from javadoc. destinationDir
5353}
5454
55- ext. signMethod = { jarfile ->
55+ ext. signMethod = { jarfile ->
5656 println " Signing $jarfile "
5757 def SIGNING_SERVICE = ' https://cbi.eclipse.org/jarsigner/sign'
5858 def STDOUT_FORMAT = ' %{size_upload} bytes uploaded, %{size_download} bytes downloaded (%{time_total} s)\\ n'
5959
60- ProcessBuilder curl_pb = new ProcessBuilder (" curl" ,
60+ ProcessBuilder curl_pb = new ProcessBuilder (" curl" ,
6161 " --fail" , " --silent" , " --show-error" , " --output" ,
6262 " ${ jarfile} -signed" , " --form" , " file=@${ jarfile} " ,
63- " --write-out" , STDOUT_FORMAT ,
63+ " --write-out" , STDOUT_FORMAT ,
6464 SIGNING_SERVICE );
6565 println String . join(" " , curl_pb. command());
6666 curl_pb. directory(new File (" ${ project.buildDir} " ));
@@ -71,26 +71,31 @@ ext.signMethod = { jarfile ->
7171 println curl_process. text
7272
7373 if (curl_process. exitValue() != 0 ) {
74- throw new GradleException (" Failed to run curl" );
74+ throw new GradleException (" Failed to run curl" );
7575 }
7676
77- ProcessBuilder mv_pb = new ProcessBuilder (" mv" ,
77+ ProcessBuilder mv_pb = new ProcessBuilder (" mv" ,
7878 " ${ jarfile} -signed" , jarfile)
7979 println String . join(" " , mv_pb. command());
8080 mv_pb. directory(new File (" ${ project.buildDir} " ));
8181 Process mv_process = mv_pb. start()
8282 mv_process. waitFor()
8383
8484 if (curl_process. exitValue() != 0 ) {
85- throw new GradleException (" Failed to run mv" );
85+ throw new GradleException (" Failed to run mv" );
8686 }
8787}
8888
8989task signJar (description : ' Sign JARs with Eclipse Signing Service' , group : ' Build' ){
90- doLast {
91- signMethod(" ${ project.buildDir} /libs/${ project.name} -${ project.version} .jar" )
92- signMethod(" ${ project.buildDir} /libs/${ project.name} -${ project.version} -sources.jar" )
93- signMethod(" ${ project.buildDir} /libs/${ project.name} -${ project.version} -javadoc.jar" )
90+ def projectBase = " ${ project.buildDir} /libs/${ project.name} -${ project.version} "
91+
92+ // Declare inputs/outputs for config-cache friendliness
93+ inputs. property(' projectBase' , projectBase)
94+
95+ doLast {
96+ signMethod(" ${ projectBase} .jar" )
97+ signMethod(" ${ projectBase} -sources.jar" )
98+ signMethod(" ${ projectBase} -javadoc.jar" )
9499 }
95100}
96101signJar. dependsOn jar, sourcesJar, javadocJar
0 commit comments