@@ -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
+ failMissingRequiredImplementation(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
@@ -100,9 +93,7 @@ static void failInvalidRemoteBuildCacheType(String remoteBuildCacheType, String
100
93
throw new IllegalStateException (message)
101
94
}
102
95
103
- // Included builds may not have the necessary plugin applied.
104
- // Only fail if the top-level build is missing the required extension.
105
- static void failMissingRequiredPlugin (String remoteBuildCacheType , String expDir , String docsRoot ) {
96
+ static void failMissingRequiredImplementation (String remoteBuildCacheType , String expDir , String docsRoot ) {
106
97
def errorFile = new File (expDir, ' errors.txt' )
107
98
errorFile. text = " Remote build cache connector type '${ remoteBuildCacheType} ' requested, but the required plugin is not applied."
108
99
if (remoteBuildCacheType == ' develocity' ) {
0 commit comments