Author: kiwiwings
Date: Sat Jan  8 18:36:39 2022
New Revision: 1896839

URL: http://svn.apache.org/viewvc?rev=1896839&view=rev
Log:
add sonarqube

Modified:
    xmlbeans/trunk/build.gradle

Modified: xmlbeans/trunk/build.gradle
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/build.gradle?rev=1896839&r1=1896838&r2=1896839&view=diff
==============================================================================
--- xmlbeans/trunk/build.gradle (original)
+++ xmlbeans/trunk/build.gradle Sat Jan  8 18:36:39 2022
@@ -18,11 +18,11 @@
 buildscript {
     repositories {
         maven { url 'https://plugins.gradle.org/m2/' }
-        // mavenCentral()
+        mavenCentral()
     }
 
     dependencies {
-        // classpath 
'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
+        classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
         classpath 'de.thetaphi:forbiddenapis:3.2'
     }
 }
@@ -653,6 +653,32 @@ spotbugsTest {
         }
     }
 }
+
+if (project.hasProperty('enableSonar')) {
+    // See 
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/ and
+    // 
https://docs.sonarqube.org/display/SONARQUBE52/Analyzing+with+SonarQube+Scanner+for+Gradle
+    // for documentation of properties.
+    //
+    // Some additional properties are currently set in the Jenkins-DSL, see 
jenksin/create_jobs.groovy
+    //
+    sonarqube {
+        properties {
+            // as we currently use build/<module>/ as project-basedir, we need 
to tell Sonar to use
+            // the root-folder as "basedir" for the projects
+            property "sonar.projectBaseDir", "$projectDir"
+            // currently supported providers on Jenkins: "hg,git": property 
"sonar.scm.provider", "svn"
+
+            // the plugin seems to not detect our non-standard build-layout
+            property "sonar.junit.reportPaths", 
"$projectDir/build/test-results/test"
+
+            // the Gradle run will report an invalid directory for 
'ooxml-schema', but it seems to still work fine
+            property "sonar.coverage.jacoco.xmlReportPaths", 
"$projectDir/build/reports/jacoco/test/jacocoTestReport.xml"
+
+            // somehow the version was not use properly
+            property "sonar.projectVersion", version
+        }
+    }
+}
 
 Set<File> xsdDirs(File parent) {
     Set<File> xsdDirs = [] as Set<File>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to