Skip to content

Commit 04a15ce

Browse files
committed
Fix usage of remote build cache
It turns out System.getenv().hasProperty('...') does not check that an environment property exists... at all. It probably has more to do with reflection or something? I don't know. Anyway, this code didn't work, and now it does: I checked by debugging.
1 parent 6078461 commit 04a15ce

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

gradle/gradle-develocity.gradle

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
ext {
1111
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
12-
populateRemoteBuildCache = isEnabled( "POPULATE_REMOTE_GRADLE_CACHE" )
13-
useRemoteCache = !isEnabled( "DISABLE_REMOTE_GRADLE_CACHE" )
12+
populateRemoteBuildCache = getSetting('POPULATE_REMOTE_GRADLE_CACHE').orElse('false').toBoolean()
13+
useRemoteCache = !getSetting('DISABLE_REMOTE_GRADLE_CACHE').orElse('false').toBoolean()
1414
}
1515

1616
private static boolean isJenkins() {
@@ -35,14 +35,6 @@ static java.util.Optional<String> getSetting(String name) {
3535
return java.util.Optional.ofNullable(sysProp);
3636
}
3737

38-
static boolean isEnabled(String setting) {
39-
if ( System.getenv().hasProperty( setting ) ) {
40-
return true
41-
}
42-
43-
return System.hasProperty( setting )
44-
}
45-
4638
develocity {
4739
server = 'https://develocity.commonhaus.dev'
4840

0 commit comments

Comments
 (0)