Skip to content

Commit

Permalink
Extract isCi to global Gradle extension
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Nov 13, 2024
1 parent ce95b3f commit 79fe4cb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ sentry {
autoInstallation.enabled = false
includeDependenciesReport = false

Boolean isCi = System.getenv('CI')?.toBoolean() ?: false
includeSourceContext = isCi
includeProguardMapping = isCi
includeSourceContext = gradle.ext.isCi
includeProguardMapping = gradle.ext.isCi
/* Sentry won't send source context or add performance instrumentations for debug builds
so we can save build times. Sending events will still work in debug builds
(if enabled in WPCrashLoggingDataProvider).
Expand Down Expand Up @@ -303,7 +302,7 @@ android {
checkGeneratedSources = true
lintConfig file("${project.rootDir}/config/lint/lint.xml")
baseline file("${project.rootDir}/config/lint/baseline.xml")
sarifReport = System.getenv('CI') ? true : false
sarifReport = gradle.ext.isCi
}

packagingOptions {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ measureBuilds {
findProperty('appsMetricsToken')
)
}
attachGradleScanId = System.getenv('CI')?.toBoolean() ?: false
attachGradleScanId = gradle.ext.isCi
}

allprojects {
Expand Down
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
2 changes: 1 addition & 1 deletion config/gradle/gradle_build_scan.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Only run build scan on CI builds.
if (System.getenv('CI')) {
if (gradle.ext.isCi) {
develocity {
buildScan {
termsOfUseUrl = 'https://gradle.com/terms-of-service'
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ plugins {
id "com.gradle.develocity" version "3.18.1"
}

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

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
Expand Down

0 comments on commit 79fe4cb

Please sign in to comment.