2222import org .elasticsearch .gradle .info .BuildParams ;
2323import org .gradle .api .Plugin ;
2424import org .gradle .api .Project ;
25+ import org .gradle .api .artifacts .Configuration ;
2526import org .gradle .api .artifacts .Dependency ;
2627import org .gradle .api .provider .Provider ;
2728
@@ -86,21 +87,31 @@ public class RestResourcesPlugin implements Plugin<Project> {
8687 public void apply (Project project ) {
8788 RestResourcesExtension extension = project .getExtensions ().create (EXTENSION_NAME , RestResourcesExtension .class );
8889
90+ // tests
91+ Configuration testConfig = project .getConfigurations ().create ("restTestConfig" );
92+ Configuration xpackTestConfig = project .getConfigurations ().create ("restXpackTest" );
93+ project .getConfigurations ().create ("restTests" );
94+ project .getConfigurations ().create ("restXpackTests" );
8995 Provider <CopyRestTestsTask > copyRestYamlTestTask = project .getTasks ()
9096 .register ("copyYamlTestsTask" , CopyRestTestsTask .class , task -> {
9197 task .includeCore .set (extension .restTests .getIncludeCore ());
9298 task .includeXpack .set (extension .restTests .getIncludeXpack ());
93- task .coreConfig = project . getConfigurations (). create ( "restTest" ) ;
99+ task .coreConfig = testConfig ;
94100 if (BuildParams .isInternal ()) {
101+ // core
95102 Dependency restTestdependency = project .getDependencies ()
96103 .project (Map .of ("path" , ":rest-api-spec" , "configuration" , "restTests" ));
97104 project .getDependencies ().add (task .coreConfig .getName (), restTestdependency );
98-
99- task .xpackConfig = project . getConfigurations (). create ( "restXpackTest" ) ;
105+ // x-pack
106+ task .xpackConfig = xpackTestConfig ;
100107 Dependency restXPackTestdependency = project .getDependencies ()
101108 .project (Map .of ("path" , ":x-pack:plugin" , "configuration" , "restXpackTests" ));
102109 project .getDependencies ().add (task .xpackConfig .getName (), restXPackTestdependency );
103110 task .dependsOn (task .xpackConfig );
111+ // watcher
112+ Dependency restWatcherTests = project .getDependencies ()
113+ .project (Map .of ("path" , ":x-pack:plugin:watcher:qa:rest" , "configuration" , "restXpackTests" ));
114+ project .getDependencies ().add (task .xpackConfig .getName (), restWatcherTests );
104115 } else {
105116 Dependency dependency = project .getDependencies ()
106117 .create ("org.elasticsearch:rest-api-spec:" + VersionProperties .getElasticsearch ());
@@ -109,18 +120,22 @@ public void apply(Project project) {
109120 task .dependsOn (task .coreConfig );
110121 });
111122
123+ // api
124+ Configuration specConfig = project .getConfigurations ().create ("restSpec" ); // name chosen for passivity
125+ Configuration xpackSpecConfig = project .getConfigurations ().create ("restXpackSpec" );
126+ project .getConfigurations ().create ("restSpecs" );
127+ project .getConfigurations ().create ("restXpackSpecs" );
112128 Provider <CopyRestApiTask > copyRestYamlSpecTask = project .getTasks ()
113129 .register ("copyRestApiSpecsTask" , CopyRestApiTask .class , task -> {
114130 task .includeCore .set (extension .restApi .getIncludeCore ());
115131 task .includeXpack .set (extension .restApi .getIncludeXpack ());
116132 task .dependsOn (copyRestYamlTestTask );
117- task .coreConfig = project . getConfigurations (). create ( "restSpec" ) ;
133+ task .coreConfig = specConfig ;
118134 if (BuildParams .isInternal ()) {
119135 Dependency restSpecDependency = project .getDependencies ()
120136 .project (Map .of ("path" , ":rest-api-spec" , "configuration" , "restSpecs" ));
121137 project .getDependencies ().add (task .coreConfig .getName (), restSpecDependency );
122-
123- task .xpackConfig = project .getConfigurations ().create ("restXpackSpec" );
138+ task .xpackConfig = xpackSpecConfig ;
124139 Dependency restXpackSpecDependency = project .getDependencies ()
125140 .project (Map .of ("path" , ":x-pack:plugin" , "configuration" , "restXpackSpecs" ));
126141 project .getDependencies ().add (task .xpackConfig .getName (), restXpackSpecDependency );
0 commit comments