Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SonarSource/sonar-scanner-gradle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.1
Choose a base ref
...
head repository: SonarSource/sonar-scanner-gradle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.1.1
Choose a head ref
  • 4 commits
  • 5 files changed
  • 3 contributors

Commits on Jan 13, 2021

  1. Copy the full SHA
    9427f2e View commit details

Commits on Jan 15, 2021

  1. Add the SonarSource Team as a developer (#82)

    The SonarSource Team is mentioned as the developer in the pom file of
    the publication.
    malena-ebert-sonarsource authored Jan 15, 2021
    Copy the full SHA
    64586b2 View commit details

Commits on Jan 22, 2021

  1. SONARGRADL-76 Unwrap Optional (#83)

    * SONARGRADL-76 Unwrap Optional
    * More tests
    * Forward output
    * Increase memory to pass on CirrusCI
    henryju authored Jan 22, 2021
    Copy the full SHA
    fee6f9f View commit details

Commits on Jan 25, 2021

  1. Copy the full SHA
    daf85b4 View commit details
Showing with 43 additions and 3 deletions.
  1. +1 −1 .cirrus.yml
  2. +6 −0 build.gradle
  3. +1 −1 gradle.properties
  4. +1 −1 src/main/java/org/sonarqube/gradle/SonarUtils.java
  5. +34 −0 src/test/groovy/org/sonarqube/gradle/FunctionalTests.groovy
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ build_task:
gke_container:
<<: *CONTAINER_DEFINITION
cpu: 1.5
memory: 2G
memory: 4G
env:
SONAR_TOKEN: ENCRYPTED[!5ba7cbb5bf9d168de69bcd444d9e884c9cf664be1115640cc64e49df6d241c309a87fc527cab533c08f289b167187017!]
SONAR_HOST_URL: https://next.sonarqube.com/sonarqube
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -152,6 +152,12 @@ publishing {
scm {
url = githubUrl
}
developers {
developer {
id = 'sonarsource-team'
name = 'SonarSource Team'
}
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=3.1
version=3.1.1
org.gradle.jvmargs=-XX:MaxPermSize=256M
2 changes: 1 addition & 1 deletion src/main/java/org/sonarqube/gradle/SonarUtils.java
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ static void setMainClasspathProps(Map<String, Object> properties, boolean addFor
}

static void populateJdkProperties(Map<String, Object> properties, JavaCompilerConfiguration config) {
properties.put("sonar.java.jdkHome", config.getJdkHome());
config.getJdkHome().ifPresent(s -> properties.put("sonar.java.jdkHome", s));
Optional<String> release = config.getRelease();
if (release.isPresent()) {
properties.put(SONAR_JAVA_SOURCE_PROP, release.get());
34 changes: 34 additions & 0 deletions src/test/groovy/org/sonarqube/gradle/FunctionalTests.groovy
Original file line number Diff line number Diff line change
@@ -44,6 +44,32 @@ class FunctionalTests extends Specification {
Files.copy(is, testProjectDir.newFile('gradle.properties').toPath(), StandardCopyOption.REPLACE_EXISTING)
}

def "no jdkHome, source and target for non 'java' projects"() {
given:
settingsFile << "rootProject.name = 'java-task-toolchains'"
buildFile << """
plugins {
id 'org.sonarqube'
}
"""

when:
def result = GradleRunner.create()
.withProjectDir(testProjectDir.root)
.forwardOutput()
.withArguments('sonarqube', '-Dsonar.scanner.dumpToFile=' + outFile.absolutePath )
.withPluginClasspath()
.build()

then:
result.task(":sonarqube").outcome == SUCCESS
def props = new Properties()
props.load(outFile.newDataInputStream())
!props.containsKey("sonar.java.jdkHome")
!props.containsKey("sonar.java.source")
!props.containsKey("sonar.java.target")
}

def "set jdkHome, source and target for 'java' projects from global toolchains"() {
given:
settingsFile << "rootProject.name = 'java-task-toolchains'"
@@ -63,6 +89,7 @@ class FunctionalTests extends Specification {
def result = GradleRunner.create()
.withGradleVersion("6.7")
.withProjectDir(testProjectDir.root)
.forwardOutput()
.withArguments('sonarqube', '-Dsonar.scanner.dumpToFile=' + outFile.absolutePath )
.withPluginClasspath()
.build()
@@ -72,6 +99,7 @@ class FunctionalTests extends Specification {
def props = new Properties()
props.load(outFile.newDataInputStream())
props."sonar.java.jdkHome".contains('8')
new File(props."sonar.java.jdkHome").exists()
props."sonar.java.source" == '8'
props."sonar.java.target" == '8'
}
@@ -95,6 +123,7 @@ class FunctionalTests extends Specification {
def result = GradleRunner.create()
.withGradleVersion("6.7")
.withProjectDir(testProjectDir.root)
.forwardOutput()
.withArguments('sonarqube', '--info', '-Dsonar.scanner.dumpToFile=' + outFile.absolutePath )
.withPluginClasspath()
.build()
@@ -105,6 +134,7 @@ class FunctionalTests extends Specification {
def props = new Properties()
props.load(outFile.newDataInputStream())
props."sonar.java.jdkHome".contains('8')
new File(props."sonar.java.jdkHome").exists()
props."sonar.java.source" == '8'
props."sonar.java.target" == '8'
}
@@ -128,6 +158,7 @@ class FunctionalTests extends Specification {
def result = GradleRunner.create()
.withGradleVersion("6.6")
.withProjectDir(testProjectDir.root)
.forwardOutput()
.withArguments('sonarqube', '-Dsonar.scanner.dumpToFile=' + outFile.absolutePath )
.withPluginClasspath()
.build()
@@ -138,5 +169,8 @@ class FunctionalTests extends Specification {
props.load(outFile.newDataInputStream())
props."sonar.java.source" == '7'
props."sonar.java.target" == '7'
// sonar.java.jdkHome will be the runtime JDK used to run Gradle, so we can't really assert its particular value
// just check that it points to a valid path
new File(props."sonar.java.jdkHome").exists()
}
}