This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git


The following commit(s) were added to refs/heads/master by this push:
     new db95016  No need to build javadocs if branch built != master, as they 
are generated so they can be published at jspwiki.a.o - should speed up 
feedback on PRs
db95016 is described below

commit db950163de9a937401f31f3e8d967359e0c1f176
Author: Juan Pablo Santos Rodríguez <[email protected]>
AuthorDate: Sat Apr 24 18:55:33 2021 +0200

    No need to build javadocs if branch built != master, as they are generated 
so they can be published at jspwiki.a.o - should speed up feedback on PRs
---
 Jenkinsfile | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index c21cbdc..1e03de6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -37,17 +37,15 @@ try {
         stage( 'build source' ) {
             dir( build ) {
                 git url: buildRepo, poll: true
-                withMaven( jdk: buildJdk, maven: buildMvn, publisherStrategy: 
'EXPLICIT', options: [ jacocoPublisher(), junitPublisher() ] ) {
-                    withCredentials( [ string( credentialsId: 
'sonarcloud-jspwiki', variable: 'SONAR_TOKEN' ) ] ) {
-                        def sonarOptions = "-Dsonar.projectKey=jspwiki-builder 
-Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io 
-Dsonar.login=$SONAR_TOKEN"
-                        echo 'Will use SonarQube instance at 
https://sonarcloud.io'
-                        sh "mvn clean 
org.jacoco:jacoco-maven-plugin:prepare-agent package 
org.jacoco:jacoco-maven-plugin:report -Pattach-additional-artifacts sonar:sonar 
$sonarOptions -Djdk.javadoc.doclet.version=2.0.12"
-                    }
+                if( env.BRANCH_NAME == 'master' ) {
+                    build( '-Pattach-additional-artifacts 
-Djdk.javadoc.doclet.version=2.0.12' )
                     pom = readMavenPom file: 'pom.xml'
                     writeFile file: 'target/classes/apidocs.txt', text: 'file 
created in order to allow aggregated javadoc generation, target/classes is 
needed for all modules'
                     writeFile file: 
'jspwiki-it-tests/target/classes/apidocs.txt', text: 'file created in order to 
allow aggregated javadoc generation, target/classes is needed for all modules'
                     sh 'mvn package javadoc:aggregate-no-fork -DskipTests -pl 
!jspwiki-portable -Djdk.javadoc.doclet.version=2.0.12'
                     sh 'java -cp jspwiki-main/target/classes 
org.apache.wiki.TranslationsCheck site'
+                } else {
+                    build()
                 }
             }
         }
@@ -67,7 +65,6 @@ try {
                 }
             }
         }
-        
     }
 
     node( 'git-websites' ) {
@@ -113,3 +110,14 @@ try {
         }
     }
 }
+
+def build( buildOpts = '' ) {
+    withMaven( jdk: buildJdk, maven: buildMvn, publisherStrategy: 'EXPLICIT', 
options: [ jacocoPublisher(), junitPublisher() ] ) {
+        withCredentials( [ string( credentialsId: 'sonarcloud-jspwiki', 
variable: 'SONAR_TOKEN' ) ] ) {
+            def masterBranchOptions = ""
+            def sonarOptions = "-Dsonar.projectKey=jspwiki-builder 
-Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io 
-Dsonar.login=$SONAR_TOKEN"
+            echo 'Will use SonarQube instance at https://sonarcloud.io'
+            sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package 
org.jacoco:jacoco-maven-plugin:report sonar:sonar $sonarOptions $buildOpts"
+        }
+    }
+}
\ No newline at end of file

Reply via email to