@@ -81,50 +81,52 @@ public void apply(Project project) {
81
81
// tests
82
82
Configuration testConfig = project .getConfigurations ().create ("restTestConfig" );
83
83
project .getConfigurations ().create ("restTests" );
84
+
85
+ if (BuildParams .isInternal ()) {
86
+ // core
87
+ Dependency restTestdependency = project .getDependencies ().project (new HashMap <String , String >() {
88
+ {
89
+ put ("path" , ":rest-api-spec" );
90
+ put ("configuration" , "restTests" );
91
+ }
92
+ });
93
+ testConfig .withDependencies (s -> s .add (restTestdependency ));
94
+ } else {
95
+ Dependency dependency = project .getDependencies ().create ("org.opensearch:rest-api-spec:" + VersionProperties .getOpenSearch ());
96
+ testConfig .withDependencies (s -> s .add (dependency ));
97
+ }
98
+
84
99
Provider <CopyRestTestsTask > copyRestYamlTestTask = project .getTasks ()
85
100
.register ("copyYamlTestsTask" , CopyRestTestsTask .class , task -> {
86
101
task .includeCore .set (extension .restTests .getIncludeCore ());
87
102
task .coreConfig = testConfig ;
88
103
task .sourceSetName = SourceSet .TEST_SOURCE_SET_NAME ;
89
- if (BuildParams .isInternal ()) {
90
- // core
91
- Dependency restTestdependency = project .getDependencies ().project (new HashMap <String , String >() {
92
- {
93
- put ("path" , ":rest-api-spec" );
94
- put ("configuration" , "restTests" );
95
- }
96
- });
97
- project .getDependencies ().add (task .coreConfig .getName (), restTestdependency );
98
- } else {
99
- Dependency dependency = project .getDependencies ()
100
- .create ("org.opensearch:rest-api-spec:" + VersionProperties .getOpenSearch ());
101
- project .getDependencies ().add (task .coreConfig .getName (), dependency );
102
- }
103
104
task .dependsOn (task .coreConfig );
104
105
});
105
106
106
107
// api
107
108
Configuration specConfig = project .getConfigurations ().create ("restSpec" ); // name chosen for passivity
108
109
project .getConfigurations ().create ("restSpecs" );
110
+
111
+ if (BuildParams .isInternal ()) {
112
+ Dependency restSpecDependency = project .getDependencies ().project (new HashMap <String , String >() {
113
+ {
114
+ put ("path" , ":rest-api-spec" );
115
+ put ("configuration" , "restSpecs" );
116
+ }
117
+ });
118
+ specConfig .withDependencies (s -> s .add (restSpecDependency ));
119
+ } else {
120
+ Dependency dependency = project .getDependencies ().create ("org.opensearch:rest-api-spec:" + VersionProperties .getOpenSearch ());
121
+ specConfig .withDependencies (s -> s .add (dependency ));
122
+ }
123
+
109
124
Provider <CopyRestApiTask > copyRestYamlSpecTask = project .getTasks ()
110
125
.register ("copyRestApiSpecsTask" , CopyRestApiTask .class , task -> {
111
126
task .includeCore .set (extension .restApi .getIncludeCore ());
112
127
task .dependsOn (copyRestYamlTestTask );
113
128
task .coreConfig = specConfig ;
114
129
task .sourceSetName = SourceSet .TEST_SOURCE_SET_NAME ;
115
- if (BuildParams .isInternal ()) {
116
- Dependency restSpecDependency = project .getDependencies ().project (new HashMap <String , String >() {
117
- {
118
- put ("path" , ":rest-api-spec" );
119
- put ("configuration" , "restSpecs" );
120
- }
121
- });
122
- project .getDependencies ().add (task .coreConfig .getName (), restSpecDependency );
123
- } else {
124
- Dependency dependency = project .getDependencies ()
125
- .create ("org.opensearch:rest-api-spec:" + VersionProperties .getOpenSearch ());
126
- project .getDependencies ().add (task .coreConfig .getName (), dependency );
127
- }
128
130
task .dependsOn (task .coreConfig );
129
131
});
130
132
0 commit comments