You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/03/21 21:39:08 UTC
[groovy] branch sonarcloud updated (607eb10 -> 7a0a8ef)
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a change to branch sonarcloud
in repository https://gitbox.apache.org/repos/asf/groovy.git.
discard 607eb10 Try to fix the failing build
discard 8823bba Try to fix the failing build
discard f506230 Try to fix the failing build
discard f6a2a1f Try to fix the failing build
discard b3628e6 Enable sonarcloud
new 7a0a8ef Support inspecting the code quality and security with SonarQube
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (607eb10)
\
N -- N -- N refs/heads/sonarcloud (7a0a8ef)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[groovy] 01/01: Support inspecting the code quality and security
with SonarQube
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch sonarcloud
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 7a0a8efaf72f787ad45a95a51253ce00f9c85302
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Mar 22 05:38:26 2020 +0800
Support inspecting the code quality and security with SonarQube
---
.travis.yml | 3 ++-
build.gradle | 1 +
gradle/jacoco/jacoco.gradle | 15 ++++++++++-----
gradle/jacoco/jacocofix.gradle | 6 ++++--
gradle/quality.gradle | 8 ++++++++
.../groovy/transform/GeneratedAnnotationTest.groovy | 2 +-
6 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index a75e5ce..9dd2ec0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,7 +29,7 @@ matrix:
jdk: openjdk13
- env: BC='legacy'
jdk: openjdk12
- - env: BC='legacy'
+ - env: BC='legacy' SONAR='true'
jdk: openjdk11
- env: BC='legacy'
jdk: openjdk10
@@ -59,6 +59,7 @@ before_script:
script:
- ./gradlew -version
- if [ "$BC" == "legacy" ]; then travis_wait 60 ./gradlew test; else travis_wait 60 ./gradlew testWithIndy; fi
+ - if [ "$SONAR" == "true" ]; then travis_wait 60 ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN -Pcoverage=true; fi
# As recommended in:
# https://docs.travis-ci.com/user/languages/java/#Caching
diff --git a/build.gradle b/build.gradle
index 6762e39..3fa3933 100644
--- a/build.gradle
+++ b/build.gradle
@@ -49,6 +49,7 @@ plugins {
id 'com.github.spotbugs' version '4.0.2'
id 'com.github.ben-manes.versions' version '0.28.0'
id 'com.github.blindpirate.osgi' version '0.0.3'
+ id 'org.sonarqube' version '2.8'
}
buildScanRecipes {
diff --git a/gradle/jacoco/jacoco.gradle b/gradle/jacoco/jacoco.gradle
index 64cb666..9853f78 100644
--- a/gradle/jacoco/jacoco.gradle
+++ b/gradle/jacoco/jacoco.gradle
@@ -29,7 +29,8 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
project.afterEvaluate {
tasks.withType(JacocoReport) {
if (name != 'jacocoAllReport' && name != 'jacocoAllIndyReport') {
- sourceDirectories += files(project.sourceSets.main.allGroovy.srcDirs)
+// sourceDirectories += files(project.sourceSets.main.allGroovy.srcDirs)
+ additionalSourceDirs(files(project.sourceSets.main.allGroovy.srcDirs))
// classDirectories += files(project.sourceSets.main.output)
}
}
@@ -72,8 +73,10 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
project.plugins.withType(JavaPlugin) {
def sd = sourceDirectories ?: files()
def cd = classDirectories ?: files()
- sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
- classDirectories = cd + files(compileGroovy.destinationDir)
+// sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
+ additionalSourceDirs(sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs))
+// classDirectories = cd + files(compileGroovy.destinationDir)
+ additionalClassDirs(cd + files(compileGroovy.destinationDir))
}
}
}
@@ -84,8 +87,10 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
project.plugins.withType(JavaPlugin) {
def sd = sourceDirectories ?: files()
def cd = classDirectories ?: files()
- sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
- classDirectories = cd + files(compileGroovyWithIndy.destinationDir)
+// sourceDirectories = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
+ additionalSourceDirs(sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs))
+// classDirectories = cd + files(compileGroovyWithIndy.destinationDir)
+ additionalClassDirs(cd + files(compileGroovyWithIndy.destinationDir))
}
}
}
diff --git a/gradle/jacoco/jacocofix.gradle b/gradle/jacoco/jacocofix.gradle
index d050118..4780e9b 100644
--- a/gradle/jacoco/jacocofix.gradle
+++ b/gradle/jacoco/jacocofix.gradle
@@ -20,7 +20,9 @@
// workaround for configuration of Jacoco task being executed before all information is available
gradle.taskGraph.whenReady {
tasks.withType(JacocoReport) {
- sourceDirectories = files(sourceSets.main.allGroovy.srcDirs + sourceSets.main.allJava.srcDirs)
- classDirectories = files(sourceSets.main.output)
+// sourceDirectories = files(sourceSets.main.allGroovy.srcDirs + sourceSets.main.allJava.srcDirs)
+ additionalSourceDirs(files(sourceSets.main.allGroovy.srcDirs + sourceSets.main.allJava.srcDirs))
+// classDirectories = files(sourceSets.main.output)
+ additionalClassDirs(files(sourceSets.main.output))
}
}
diff --git a/gradle/quality.gradle b/gradle/quality.gradle
index d4fba6e..1173a33 100644
--- a/gradle/quality.gradle
+++ b/gradle/quality.gradle
@@ -202,3 +202,11 @@ rat {
}
apply from: 'gradle/jacoco/jacoco.gradle'
+
+sonarqube {
+ properties {
+ property "sonar.projectKey", "apache_groovy"
+ property "sonar.organization", "apache"
+ property "sonar.host.url", "https://sonarcloud.io"
+ }
+}
diff --git a/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
index 539ebbb..ba8c0bd 100644
--- a/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
@@ -55,7 +55,7 @@ class GeneratedAnnotationTest extends GroovyShellTestCase {
GroovyObject.declaredMethods.each { m ->
def method = person.class.declaredMethods.find { it.name == m.name }
- if (method) {
+ if (method && !method.name.contains('jacoco')) {
assert method.annotations*.annotationType().name.contains('groovy.transform.Generated')
}
}