|
8 | 8 | */ |
9 | 9 |
|
10 | 10 |
|
11 | | -import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin |
12 | | -import com.avast.gradle.dockercompose.tasks.ComposePull |
13 | 11 | import com.fasterxml.jackson.databind.JsonNode |
14 | 12 | import com.fasterxml.jackson.databind.ObjectMapper |
15 | 13 |
|
16 | | -import org.elasticsearch.gradle.DistributionDownloadPlugin |
17 | 14 | import org.elasticsearch.gradle.Version |
18 | | -import org.elasticsearch.gradle.internal.BaseInternalPluginBuildPlugin |
19 | | -import org.elasticsearch.gradle.internal.ResolveAllDependencies |
20 | 15 | import org.elasticsearch.gradle.util.GradleUtils |
21 | | -import org.gradle.plugins.ide.eclipse.model.AccessRule |
22 | 16 |
|
23 | 17 | import java.nio.file.Files |
24 | 18 |
|
25 | 19 | import static java.nio.file.StandardCopyOption.REPLACE_EXISTING |
26 | | -import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure |
27 | 20 |
|
28 | 21 | buildscript { |
29 | 22 | repositories { |
@@ -225,162 +218,17 @@ tasks.register("verifyVersions") { |
225 | 218 | // longer used for that purpose, but instead a way to run only functional tests. We should |
226 | 219 | // rework the functionalTests task to be more explicit about which tasks it wants to run |
227 | 220 | // so that that this flag is no longer needed. |
228 | | -boolean bwc_tests_enabled = true |
| 221 | +boolean bwcTestsEnabled = true |
229 | 222 | if (project.gradle.startParameter.taskNames.any { it.startsWith("checkPart") || it == 'functionalTests' }) { |
230 | 223 | // Disable BWC tests for checkPart* tasks and platform support tests as it's expected that this will run on it's own check |
231 | | - bwc_tests_enabled = false |
232 | | -} |
233 | | - |
234 | | -subprojects { proj -> |
235 | | - apply plugin: 'elasticsearch.base' |
| 224 | + bwcTestsEnabled = false |
236 | 225 | } |
237 | 226 |
|
238 | 227 | allprojects { |
239 | | - // We disable this plugin for now till we shaked out the issues we see |
240 | | - // e.g. see https://github.com/elastic/elasticsearch/issues/72169 |
241 | | - // apply plugin:'elasticsearch.internal-test-rerun' |
242 | | - |
243 | | - plugins.withType(BaseInternalPluginBuildPlugin).whenPluginAdded { |
244 | | - project.dependencies { |
245 | | - compileOnly project(":server") |
246 | | - testImplementation project(":test:framework") |
247 | | - } |
248 | | - } |
249 | | - |
250 | | - ext.bwc_tests_enabled = bwc_tests_enabled |
251 | | - |
252 | | - // eclipse configuration |
253 | | - apply plugin: 'elasticsearch.eclipse' |
254 | | - |
255 | | - /* |
256 | | - * Allow accessing com/sun/net/httpserver in projects that have |
257 | | - * configured forbidden apis to allow it. |
258 | | - */ |
259 | | - plugins.withType(ForbiddenApisPlugin) { |
260 | | - eclipse.classpath.file.whenMerged { classpath -> |
261 | | - if (false == forbiddenApisTest.bundledSignatures.contains('jdk-non-portable')) { |
262 | | - classpath.entries |
263 | | - .findAll { it.kind == "con" && it.toString().contains("org.eclipse.jdt.launching.JRE_CONTAINER") } |
264 | | - .each { |
265 | | - it.accessRules.add(new AccessRule("accessible", "com/sun/net/httpserver/*")) |
266 | | - } |
267 | | - } |
268 | | - } |
269 | | - } |
270 | | - |
271 | | - tasks.register('resolveAllDependencies', ResolveAllDependencies) { |
272 | | - def ignoredPrefixes = [DistributionDownloadPlugin.ES_DISTRO_CONFIG_PREFIX, "jdbcDriver"] |
273 | | - configs = project.configurations.matching { config -> ignoredPrefixes.any { config.name.startsWith(it) } == false } |
274 | | - resolveJavaToolChain = true |
275 | | - if (project.path.contains("fixture")) { |
276 | | - dependsOn tasks.withType(ComposePull) |
277 | | - } |
278 | | - if (project.path.contains(":distribution:docker")) { |
279 | | - enabled = false |
280 | | - } |
281 | | - if (project.path.contains(":libs:cli")) { |
282 | | - // ensure we resolve p2 dependencies for the spotless eclipse formatter |
283 | | - dependsOn "spotlessJavaCheck" |
284 | | - } |
285 | | - } |
286 | | - |
287 | | - ext.withReleaseBuild = { Closure config -> |
288 | | - if(buildParams.snapshotBuild == false) { |
289 | | - config.call() |
290 | | - } |
291 | | - } |
292 | | - |
293 | | - plugins.withId('lifecycle-base') { |
294 | | - if (project.path.startsWith(":x-pack:")) { |
295 | | - if (project.path.contains("security") || project.path.contains(":ml")) { |
296 | | - tasks.register('checkPart4') { |
297 | | - dependsOn 'check' |
298 | | - withReleaseBuild { |
299 | | - dependsOn 'assemble' |
300 | | - } |
301 | | - } |
302 | | - } else if (project.path == ":x-pack:plugin" || project.path.contains("ql") || project.path.contains("smoke-test")) { |
303 | | - tasks.register('checkPart3') { |
304 | | - dependsOn 'check' |
305 | | - withReleaseBuild { |
306 | | - dependsOn 'assemble' |
307 | | - } |
308 | | - } |
309 | | - } else if (project.path.contains("multi-node")) { |
310 | | - tasks.register('checkPart5') { |
311 | | - dependsOn 'check' |
312 | | - withReleaseBuild { |
313 | | - dependsOn 'assemble' |
314 | | - } |
315 | | - } |
316 | | - } else { |
317 | | - tasks.register('checkPart2') { |
318 | | - dependsOn 'check' |
319 | | - withReleaseBuild { |
320 | | - dependsOn 'assemble' |
321 | | - } |
322 | | - } |
323 | | - } |
324 | | - } else { |
325 | | - tasks.register('checkPart1') { |
326 | | - dependsOn 'check' |
327 | | - withReleaseBuild { |
328 | | - dependsOn 'assemble' |
329 | | - } |
330 | | - } |
331 | | - } |
332 | | - tasks.register('functionalTests') { |
333 | | - dependsOn 'check' |
334 | | - withReleaseBuild { |
335 | | - dependsOn 'assemble' |
336 | | - } |
337 | | - } |
338 | | - } |
339 | | - |
340 | | - /* |
341 | | - * Remove assemble/dependenciesInfo on all qa projects because we don't |
342 | | - * need to publish artifacts for them. |
343 | | - */ |
344 | | - if (project.name.equals('qa') || project.path.contains(':qa:')) { |
345 | | - maybeConfigure(project.tasks, 'assemble') { |
346 | | - it.enabled = false |
347 | | - } |
348 | | - maybeConfigure(project.tasks, 'dependenciesInfo') { |
349 | | - it.enabled = false |
350 | | - } |
351 | | - } |
352 | | - |
353 | | - project.afterEvaluate { |
354 | | - // Ensure similar tasks in dependent projects run first. The projectsEvaluated here is |
355 | | - // important because, while dependencies.all will pickup future dependencies, |
356 | | - // it is not necessarily true that the task exists in both projects at the time |
357 | | - // the dependency is added. |
358 | | - if (project.path == ':test:framework') { |
359 | | - // :test:framework:test cannot run before and after :server:test |
360 | | - return |
361 | | - } |
362 | | - tasks.matching { it.name.equals('integTest') }.configureEach { integTestTask -> |
363 | | - integTestTask.mustRunAfter tasks.matching { it.name.equals("test") } |
364 | | - } |
365 | | - |
366 | | -/* configurations.matching { it.canBeResolved }.all { Configuration configuration -> |
367 | | - dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep -> |
368 | | - Project upstreamProject = dep.dependencyProject |
369 | | - if (project.path != upstreamProject?.path) { |
370 | | - for (String taskName : ['test', 'integTest']) { |
371 | | - project.tasks.matching { it.name == taskName }.configureEach { task -> |
372 | | - task.shouldRunAfter(upstreamProject.tasks.matching { upStreamTask -> upStreamTask.name == taskName }) |
373 | | - } |
374 | | - } |
375 | | - } |
376 | | - } |
377 | | - }*/ |
378 | | - } |
379 | | - |
380 | | - apply plugin: 'elasticsearch.formatting' |
| 228 | + // bwc_tests_enabled is a ext flag defined in 'elasticsearch.all-projects.gradle' |
| 229 | + bwc_tests_enabled = bwcTestsEnabled |
381 | 230 | } |
382 | 231 |
|
383 | | - |
384 | 232 | tasks.register("verifyBwcTestsEnabled") { |
385 | 233 | doLast { |
386 | 234 | if (bwc_tests_enabled == false) { |
@@ -412,24 +260,6 @@ tasks.named("wrapper").configure { |
412 | 260 | } |
413 | 261 | } |
414 | 262 |
|
415 | | -gradle.projectsEvaluated { |
416 | | - // Having the same group and name for distinct projects causes Gradle to consider them equal when resolving |
417 | | - // dependencies leading to hard to debug failures. Run a check across all project to prevent this from happening. |
418 | | - // see: https://github.com/gradle/gradle/issues/847 |
419 | | - Map coordsToProject = [:] |
420 | | - project.allprojects.forEach { p -> |
421 | | - String coords = "${p.group}:${p.name}" |
422 | | - if (false == coordsToProject.putIfAbsent(coords, p)) { |
423 | | - throw new GradleException( |
424 | | - "Detected that two projects: ${p.path} and ${coordsToProject[coords].path} " + |
425 | | - "have the same name and group: ${coords}. " + |
426 | | - "This doesn't currently work correctly in Gradle, see: " + |
427 | | - "https://github.com/gradle/gradle/issues/847" |
428 | | - ) |
429 | | - } |
430 | | - } |
431 | | -} |
432 | | - |
433 | 263 | tasks.named("validateChangelogs").configure { |
434 | 264 | def triggeredTaskNames = gradle.startParameter.taskNames |
435 | 265 | onlyIf { |
|
0 commit comments