]> source.dussan.org Git - poi.git/commitdiff
Allow to enable Sonar as part of the Gradle build and add Jenkins DSL job to test it
authorDominik Stadler <centic@apache.org>
Fri, 10 Mar 2017 20:13:46 +0000 (20:13 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 10 Mar 2017 20:13:46 +0000 (20:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1786430 13f79535-47bb-0310-9956-ffa450edef68

build.gradle
jenkins/create_jobs.groovy

index 3f73826b5f2e9f4522f5115ce85a0189bd49383c..fbcd6c628de16b13753f835384dfcd9af0dfee25 100644 (file)
@@ -21,14 +21,15 @@ buildscript {
 
        dependencies {
                classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.2'
+               classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2.1"
        }
 }
 
-/* We cannot add this here as the Sonar-plugin requires Java 8, but
- * we want to at least keep Java 7 compatibility for building POI via Gradle for now
-plugins {
-  id "org.sonarqube" version "2.2.1"
-}*/
+// Only add the plugin for Sonar if enabled as it requires Java 8
+if (project.hasProperty('enableSonar')) {
+       println 'Enabling Sonar support'
+       apply plugin: "org.sonarqube"
+}
 
 // For help converting an Ant build to a Gradle build, see
 // https://docs.gradle.org/current/userguide/ant.html
index c18fd7e3879da2f9efe7fb96aa30424e7aca9ca1..c52c1c5d0d85f3f5ac0531b3215ca260e5661cb2 100644 (file)
@@ -63,6 +63,8 @@ def poijobs = [
     ],
     [ name: 'POI-DSL-SonarQube', jdk: '1.8', trigger: 'H 9 * * *', maven: true, sonar: true
     ],
+    [ name: 'POI-DSL-SonarQube-Gradle', jdk: '1.8', trigger: 'H 9 * * *', gradle: true, sonar: true, skipcigame: true
+    ],
 ]
 
 def svnBase = 'https://svn.apache.org/repos/asf/poi/trunk'
@@ -244,6 +246,24 @@ for more details about the DSL.</b>
                 }
                 mailer(email, false, false)
             }
+        } else if(poijob.sonar) {
+            steps {
+                shell(shellcmds)
+                gradle {
+                    switches('-PenableSonar')
+                    switches('-PsystemProp.sonar.host.url=$SONAR_HOST_URL')
+                    tasks('sonarqube')
+                    useWrapper(false)
+                }
+            }
+            publishers {
+                if (!poijob.skipcigame) {
+                    configure { project ->
+                        project / publishers << 'hudson.plugins.cigame.GamePublisher' {}
+                    }
+                }
+                mailer(email, false, false)
+            }
         } else {
             steps {
                 shell(shellcmds)