Skip to content

Commit 5c9da44

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 0c1090c commit 5c9da44

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
@@ -11,8 +11,8 @@
1111

1212
ext {
1313
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
14-
populateRemoteBuildCache = isEnabled( "POPULATE_REMOTE_GRADLE_CACHE" )
15-
useRemoteCache = !isEnabled( "DISABLE_REMOTE_GRADLE_CACHE" )
14+
populateRemoteBuildCache = getSetting('POPULATE_REMOTE_GRADLE_CACHE').orElse('false').toBoolean()
15+
useRemoteCache = !getSetting('DISABLE_REMOTE_GRADLE_CACHE').orElse('false').toBoolean()
1616
}
1717

1818
private static boolean isJenkins() {
@@ -37,14 +37,6 @@ static java.util.Optional<String> getSetting(String name) {
3737
return java.util.Optional.ofNullable(sysProp);
3838
}
3939

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

0 commit comments

Comments
 (0)