Skip to content

Commit

Permalink
Merge pull request #13343 from woocommerce/build/update-build-scans-c…
Browse files Browse the repository at this point in the history
…onfig

[Gradle] Update Build Scans Config (`Develocity`)
  • Loading branch information
ParaskP7 authored Jan 17, 2025
2 parents 51f62d3 + 140fa3f commit 7c04b28
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ android {
}

lintOptions {
sarifReport System.getenv('CI') ? true : false
sarifReport gradle.ext.isCi
checkDependencies true
disable 'InvalidPackage'
}
Expand Down
7 changes: 2 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ ext {
file("${rootDir}/defaults.properties"),
file("${System.getProperty("user.home")}/.configure/woocommerce-android/secrets/secrets.properties")
)
userEnabledTracking = secretProperties.get('measureBuildsEnabled')?.toBoolean() ?: false

developerProperties = loadPropertiesWithFallback(
logger,
file("${rootDir}/developer.properties-example"),
Expand All @@ -34,9 +32,9 @@ ext {
}

measureBuilds {
enable = userEnabledTracking
enable = secretProperties.get('measureBuildsEnabled')?.toBoolean() ?: false
automatticProject = MeasureBuildsExtension.AutomatticProject.WooCommerce
attachGradleScanId = true
attachGradleScanId = false
authToken = secretProperties.get('appsMetricsToken')
}

Expand Down Expand Up @@ -114,4 +112,3 @@ tasks.register("installGitHooks", Copy) {
}

apply from: './config/gradle/jacoco.gradle'
apply from: './config/gradle/gradle_build_scan.gradle'
2 changes: 1 addition & 1 deletion config/gradle/gradle_build_cache.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Only run build cache on CI builds.
if (System.getenv('CI')) {
if (gradle.ext.isCi) {
buildCache {
remote(HttpBuildCache) {
url = "http://10.0.2.215:5071/cache/"
Expand Down
26 changes: 13 additions & 13 deletions config/gradle/gradle_build_scan.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Boolean isBuildOnCI = (System.getenv('CI') ?: false).toBoolean()

if (isBuildOnCI || userEnabledTracking) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
publishAlways()
if (isBuildOnCI) {
// Only run build scan on CI builds.
if (gradle.ext.isCi) {
develocity {
buildScan {
termsOfUseUrl = 'https://gradle.com/terms-of-service'
termsOfUseAgree = 'yes'
tag 'CI'
publishing.onlyIf { true }
uploadInBackground = false
} else {
obfuscation {
username { username -> username.digest('SHA-1') }
hostname { _ -> "" }
ipAddresses { addresses -> addresses.collect { address -> "0.0.0.0" } }
}
}
}
} else {
develocity {
buildScan {
publishing.onlyIf { false }
}
}
}
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ pluginManagement {
}

plugins {
id 'com.gradle.enterprise' version '3.17.2'
id 'com.gradle.develocity' version '3.19'
}

gradle.ext.isCi = System.getenv('CI')?.toBoolean() ?: false

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
Expand Down Expand Up @@ -94,4 +96,5 @@ gradle.ext {

apply from: './config/gradle/include_builds.gradle'
apply from: './config/gradle/gradle_build_cache.gradle'
apply from: './config/gradle/gradle_build_scan.gradle'
include ':WooCommerce-Wear'

0 comments on commit 7c04b28

Please sign in to comment.