Port gradle script plugins to precompiled script plugins (#72361)

Script plugins cannot apply plugins and therefore wont work with porting
buildSrc to an included build as we plan. Therefore we take advantage
of moving our script plugins into precompiled script plugins.

As a limitation of this we ran into problems applying binary plugins
from script plugins and for now moved this out of those scripts.
This commit is contained in:
Rene Groeschke 2021-04-29 09:33:28 +02:00 committed by GitHub
parent 3da72d46f4
commit 17da1038fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 97 additions and 30 deletions

View File

@ -27,18 +27,21 @@ plugins {
id 'lifecycle-base'
id 'elasticsearch.docker-support'
id 'elasticsearch.global-build-info'
id 'elasticsearch.build-scan'
id 'elasticsearch.build-complete'
id 'elasticsearch.jdk-download'
id 'elasticsearch.internal-distribution-download'
id 'elasticsearch.runtime-jdk-provision'
id 'elasticsearch.ide'
id 'elasticsearch.forbidden-dependencies'
id 'elasticsearch.formatting'
id 'elasticsearch.local-distribution'
id 'elasticsearch.fips'
id 'elasticsearch.testclusters'
id 'elasticsearch.run'
id "com.diffplug.spotless" version "5.12.0" apply false
}
apply from: 'gradle/build-scan.gradle'
apply from: 'gradle/build-complete.gradle'
apply from: 'gradle/runtime-jdk-provision.gradle'
apply from: 'gradle/ide.gradle'
apply from: 'gradle/forbidden-dependencies.gradle'
apply from: 'gradle/formatting.gradle'
apply from: 'gradle/local-distribution.gradle'
apply from: 'gradle/fips.gradle'
apply from: 'gradle/run.gradle'
// common maven publishing configuration
allprojects {

View File

@ -93,6 +93,8 @@ dependencies {
api 'org.apache.rat:apache-rat:0.11'
api "org.elasticsearch:jna:5.7.0-1"
api 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
// for our ide tweaking
api 'gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.7'
// When upgrading forbidden apis, ensure dependency version is bumped in ThirdPartyPrecommitPlugin as well
api 'de.thetaphi:forbiddenapis:3.1'
api 'com.avast.gradle:gradle-docker-compose-plugin:0.14.0'
@ -138,6 +140,8 @@ dependencies {
*****************************************************************************/
// this will only happen when buildSrc is built on its own during build init
if (project == rootProject) {
apply plugin: 'groovy-gradle-plugin'
repositories {
if (System.getProperty("repos.mavenLocal") != null) {
mavenLocal()

View File

@ -1,3 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import java.nio.file.Files
String buildNumber = System.getenv('BUILD_NUMBER')

View File

@ -1,3 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.internal.info.BuildParams

View File

@ -1,3 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.internal.info.BuildParams
@ -25,8 +33,6 @@ tasks.withType(Test).configureEach {
nonInputProperties.systemProperty 'tests.bwc', 'true'
}
tasks.named("check").configure {
dependsOn(bwcTestSnapshots)
}
tasks.matching { it.name.equals("check") }.configureEach {dependsOn(bwcTestSnapshots) }
tasks.matching{ it.name.equals("test") }.configureEach {enabled = false}
tasks.matching { it.name.equals("test") }.configureEach {enabled = false}

View File

@ -1,3 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.internal.ExportElasticsearchBuildResourcesTask
import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.testclusters.TestDistribution

View File

@ -1,3 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
// we do not want any of these dependencies on the compilation classpath
// because they could then be used within Elasticsearch

View File

@ -1,3 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.internal.info.BuildParams
import org.jetbrains.gradle.ext.JUnit

View File

@ -14,7 +14,9 @@
* */
import org.elasticsearch.gradle.Architecture
apply plugin:'elasticsearch.internal-distribution-download'
// gradle has an open issue of failing applying plugins in
// precompiled script plugins (see https://github.com/gradle/gradle/issues/17004)
// apply plugin:'elasticsearch.internal-distribution-download'
elasticsearch_distributions {
local {

View File

@ -5,9 +5,12 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.testclusters.RunTask
apply plugin: 'elasticsearch.testclusters'
// gradle has an open issue of failing applying plugins in
// precompiled script plugins (see https://github.com/gradle/gradle/issues/17004)
// apply plugin: 'elasticsearch.testclusters'
testClusters {
runTask {

View File

@ -1,9 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.internal.VersionProperties
import org.elasticsearch.gradle.internal.info.BuildParams
apply plugin: 'elasticsearch.jdk-download'
// gradle has an open issue of failing applying plugins in
// precompiled script plugins (see https://github.com/gradle/gradle/issues/17004)
// apply plugin: 'elasticsearch.jdk-download'
jdks {
provisioned_runtime {

View File

@ -12,7 +12,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from: "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-resources'
dependencies {

View File

@ -14,7 +14,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.internal-test-artifact'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
String baseName = "v${bwcVersion}"

View File

@ -13,7 +13,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-resources'
restResources {

View File

@ -14,7 +14,7 @@ apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.internal-test-artifact'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
dependencies {
testImplementation project(':client:rest-high-level')

View File

@ -12,7 +12,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-resources'
for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {

View File

@ -13,7 +13,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
String baseName = "v${bwcVersion}"

View File

@ -1,6 +1,6 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-test'
import org.elasticsearch.gradle.Version

View File

@ -30,7 +30,7 @@ subprojects {
if (subprojects.isEmpty()) {
// leaf project
apply plugin: 'elasticsearch.standalone-rest-test'
apply from: "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
} else {
apply plugin: 'elasticsearch.java'
}

View File

@ -1,6 +1,6 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-test'
import org.elasticsearch.gradle.Version

View File

@ -4,7 +4,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
dependencies {
// TODO: Remove core dependency and change tests to not use builders that are part of xpack-core.

View File

@ -1,6 +1,6 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-test'
import org.elasticsearch.gradle.Version

View File

@ -4,7 +4,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
dependencies {
testImplementation project(':x-pack:qa')

View File

@ -4,7 +4,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
dependencies {
testImplementation project(':x-pack:qa')

View File

@ -4,7 +4,7 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.bwc-test'
apply plugin: 'elasticsearch.rest-resources'
dependencies {