Skip to content

Commit 55a9bb9

Browse files
fix: use system properties for skipCodeAnalysis flag
Project properties (-P) are not available in the buildscript block during early Gradle evaluation. Switch to system properties (-D) which are available everywhere via System.getProperty(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 14a9f98 commit 55a9bb9

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎.azure-pipelines/daily-ci-build.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ extends:
5050
jdkArchitectureOption: 'x64'
5151
jdkSourceOption: 'PreInstalled'
5252

53-
- script: chmod +x gradlew && ./gradlew build -PskipCodeAnalysis
53+
- script: chmod +x gradlew && ./gradlew build -DskipCodeAnalysis=true
5454
displayName: Build SDK
5555
workingDirectory: $(Build.SourcesDirectory)
5656

57-
- script: ./gradlew test -PskipCodeAnalysis
57+
- script: ./gradlew test -DskipCodeAnalysis=true
5858
displayName: Run unit tests
5959
workingDirectory: $(Build.SourcesDirectory)

‎build.gradle‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
gradlePluginPortal()
44
mavenCentral()
55
}
6-
if (!hasProperty('skipCodeAnalysis')) {
6+
if (System.getProperty('skipCodeAnalysis') == null) {
77
dependencies {
88
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:6.5.4'
99
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:7.3.0.8198'
@@ -21,7 +21,7 @@ plugins {
2121

2222
}
2323

24-
if (!project.hasProperty('skipCodeAnalysis')) {
24+
if (System.getProperty('skipCodeAnalysis') == null) {
2525
apply plugin: 'com.github.spotbugs'
2626
apply plugin: 'org.sonarqube'
2727
}
@@ -45,7 +45,7 @@ jacoco {
4545
toolVersion = "0.8.12"
4646
}
4747

48-
if (!project.hasProperty('skipCodeAnalysis')) {
48+
if (System.getProperty('skipCodeAnalysis') == null) {
4949
spotbugsMain {
5050
excludeFilter = file("spotBugsExcludeFilter.xml")
5151
reports {
@@ -101,7 +101,7 @@ def pomConfig = {
101101
}
102102
}
103103

104-
if (!project.hasProperty('skipCodeAnalysis')) {
104+
if (System.getProperty('skipCodeAnalysis') == null) {
105105
sonarqube {
106106
properties {
107107
property "sonar.projectKey", "microsoftgraph_msgraph-sdk-java-core"

0 commit comments

Comments
 (0)