@@ -23,14 +23,12 @@ settingsEvaluated { Settings settings ->
23
23
failInvalidRemoteBuildCacheType(remoteBuildCacheType, expDir)
24
24
}
25
25
26
- if (isTopLevelBuild && missingRequiredPlugin(settings, remoteBuildCacheType)) {
27
- failMissingRequiredPlugin(remoteBuildCacheType, expDir, docsRoot)
28
- }
29
-
30
26
def remoteBuildCacheImplementation = getRemoteBuildCacheImplementation(settings, remoteBuildCacheType)
31
27
if (remoteBuildCacheImplementation) {
32
28
logger. debug(" Configuring remote build cache implementation for '${ settings.rootProject.name} ' as: ${ remoteBuildCacheImplementation} " )
33
29
remote(remoteBuildCacheImplementation)
30
+ } else if (isTopLevelBuild) {
31
+ failMissingRequiredPlugin(remoteBuildCacheType, expDir, docsRoot)
34
32
}
35
33
}
36
34
@@ -63,17 +61,12 @@ static boolean isInvalidRemoteBuildCacheType(String remoteBuildCacheType) {
63
61
return ! [' develocity' , ' gradle-enterprise' , ' http' ]. contains(remoteBuildCacheType)
64
62
}
65
63
66
- static boolean missingRequiredPlugin (Settings settings , String type ) {
67
- return type == " develocity" && ! settings. pluginManager. hasPlugin(' com.gradle.develocity' )
68
- || type == " gradle-enterprise" && ! settings. pluginManager. hasPlugin(' com.gradle.enterprise' )
69
- }
70
-
71
64
static Class<? extends BuildCache > getRemoteBuildCacheImplementation (Settings settings , String type ) {
72
- if (type == " develocity" ) {
65
+ if (type == ' develocity' && settings . pluginManager . hasPlugin( ' com.gradle.develocity ' ) ) {
73
66
return settings. develocity. buildCache
74
- } else if (type == " gradle-enterprise" ) {
67
+ } else if (type == ' gradle-enterprise' && settings . pluginManager . hasPlugin( ' com.gradle.enterprise ' ) ) {
75
68
return settings. gradleEnterprise. buildCache
76
- } else if (type == " http" ) {
69
+ } else if (type == ' http' ) {
77
70
return HttpBuildCache
78
71
}
79
72
return null
0 commit comments