Remove internal build logic from public build tool plugins (#72470)

Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
This commit is contained in:
Rene Groeschke 2021-05-06 14:02:35 +02:00 committed by GitHub
parent 73e0662f09
commit e609e07cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
222 changed files with 1183 additions and 853 deletions

View file

@ -12,7 +12,7 @@ import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
import org.apache.tools.ant.taskdefs.condition.Os import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.internal.BuildPlugin import org.elasticsearch.gradle.internal.BuildPlugin
import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.internal.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.internal.info.BuildParams import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.plugin.PluginBuildPlugin import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.gradle.plugins.ide.eclipse.model.AccessRule import org.gradle.plugins.ide.eclipse.model.AccessRule
@ -22,6 +22,9 @@ import org.gradle.util.GradleVersion
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure
import org.gradle.plugins.ide.eclipse.model.ProjectDependency import org.gradle.plugins.ide.eclipse.model.ProjectDependency
import org.elasticsearch.gradle.testclusters.TestClustersPlugin import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin
import org.elasticsearch.gradle.internal.InternalPluginBuildPlugin
import org.elasticsearch.gradle.internal.InternalTestClustersPlugin
plugins { plugins {
id 'lifecycle-base' id 'lifecycle-base'
@ -37,7 +40,7 @@ plugins {
id 'elasticsearch.formatting' id 'elasticsearch.formatting'
id 'elasticsearch.local-distribution' id 'elasticsearch.local-distribution'
id 'elasticsearch.fips' id 'elasticsearch.fips'
id 'elasticsearch.testclusters' id 'elasticsearch.internal-testclusters'
id 'elasticsearch.run' id 'elasticsearch.run'
id "com.diffplug.spotless" version "5.12.0" apply false id "com.diffplug.spotless" version "5.12.0" apply false
} }
@ -108,6 +111,19 @@ subprojects {
project.noticeFile = project.rootProject.file('NOTICE.txt') project.noticeFile = project.rootProject.file('NOTICE.txt')
} }
plugins.withType(InternalPluginBuildPlugin).whenPluginAdded {
project.dependencies {
compileOnly project(":server")
testImplementation project(":test:framework")
}
}
// Ultimately the RestTestBase Plugin should apply the InternalTestClusters Plugin itself instead of TestClusters
// but this requires major rework on the func test infrastructure.
// TODO: This will be addressed once we have https://github.com/elastic/elasticsearch/issues/71593 resolved
project.plugins.withType(RestTestBasePlugin) {
project.plugins.apply(InternalTestClustersPlugin)
}
} }
/** /**
@ -129,7 +145,6 @@ ext.testArtifact = { p, String name = "test" ->
}; };
} }
tasks.register("updateCIBwcVersions") { tasks.register("updateCIBwcVersions") {
doLast { doLast {
File yml = file(".ci/bwcVersions") File yml = file(".ci/bwcVersions")

View file

@ -36,6 +36,156 @@ gradlePlugin {
// We already configure publication and we don't need or want the one that comes // We already configure publication and we don't need or want the one that comes
// with the java-gradle-plugin // with the java-gradle-plugin
automatedPublishing = false automatedPublishing = false
plugins {
build {
id = 'elasticsearch.build'
implementationClass = 'org.elasticsearch.gradle.internal.BuildPlugin'
}
distributionDownload {
id = 'elasticsearch.distribution-download'
implementationClass = 'org.elasticsearch.gradle.DistributionDownloadPlugin'
}
distroTest {
id = 'elasticsearch.distro-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.DistroTestPlugin'
}
dockerSupport {
id = 'elasticsearch.docker-support'
implementationClass = 'org.elasticsearch.gradle.internal.docker.DockerSupportPlugin'
}
docsTest {
id = 'elasticsearch.docs-test'
implementationClass = 'org.elasticsearch.gradle.internal.doc.DocsTestPlugin'
}
esPlugin {
id = 'elasticsearch.esplugin'
implementationClass = 'org.elasticsearch.gradle.plugin.PluginBuildPlugin'
}
globalBuildInfo {
id = 'elasticsearch.global-build-info'
implementationClass = 'org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin'
}
internalAvailablePorts {
id = 'elasticsearch.internal-available-ports'
implementationClass = 'org.elasticsearch.gradle.internal.InternalAvailableTcpPortProviderPlugin'
}
internalClusterTest {
id = 'elasticsearch.internal-cluster-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.InternalClusterTestPlugin'
}
internalDistributionArchiveCheck {
id = 'elasticsearch.internal-distribution-archive-check'
implementationClass = 'org.elasticsearch.gradle.internal.InternalDistributionArchiveCheckPlugin'
}
internalDistributionArchiveSetup {
id = 'elasticsearch.internal-distribution-archive-setup'
implementationClass = 'org.elasticsearch.gradle.internal.InternalDistributionArchiveSetupPlugin'
}
internalDistributionBwcSetup {
id = 'elasticsearch.internal-distribution-bwc-setup'
implementationClass = 'org.elasticsearch.gradle.internal.InternalDistributionBwcSetupPlugin'
}
internalDistributionDownload {
id = 'elasticsearch.internal-distribution-download'
implementationClass = 'org.elasticsearch.gradle.internal.InternalDistributionDownloadPlugin'
}
internalLicenseheaders {
id = 'elasticsearch.internal-licenseheaders'
implementationClass = 'org.elasticsearch.gradle.internal.precommit.LicenseHeadersPrecommitPlugin'
}
internalPlugin {
id = 'elasticsearch.internal-es-plugin'
implementationClass = 'org.elasticsearch.gradle.internal.InternalPluginBuildPlugin'
}
internalTestArtifact {
id = 'elasticsearch.internal-test-artifact'
implementationClass = 'org.elasticsearch.gradle.internal.InternalTestArtifactPlugin'
}
internalTestArtifactBase {
id = 'elasticsearch.internal-test-artifact-base'
implementationClass = 'org.elasticsearch.gradle.internal.InternalTestArtifactBasePlugin'
}
internalTestClusters {
id = 'elasticsearch.internal-testclusters'
implementationClass = 'org.elasticsearch.gradle.internal.InternalTestClustersPlugin'
}
internalTestRerun {
id = 'elasticsearch.internal-test-rerun'
implementationClass = 'org.elasticsearch.gradle.internal.test.rerun.TestRerunPlugin'
}
java {
id = 'elasticsearch.java'
implementationClass = 'org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin'
}
javaRestTest {
id = 'elasticsearch.java-rest-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.rest.JavaRestTestPlugin'
}
jdkDownload {
id = 'elasticsearch.jdk-download'
implementationClass = 'org.elasticsearch.gradle.internal.JdkDownloadPlugin'
}
publish {
id = 'elasticsearch.publish'
implementationClass = 'org.elasticsearch.gradle.internal.PublishPlugin'
}
reaper {
id = 'elasticsearch.reaper'
implementationClass = 'org.elasticsearch.gradle.ReaperPlugin'
}
repositories {
id = 'elasticsearch.repositories'
implementationClass = 'org.elasticsearch.gradle.internal.RepositoriesSetupPlugin'
}
restResources {
id = 'elasticsearch.rest-resources'
implementationClass = 'org.elasticsearch.gradle.internal.test.rest.RestResourcesPlugin'
}
restTest {
id = 'elasticsearch.rest-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.RestTestPlugin'
}
standaloneRestTest {
id = 'elasticsearch.standalone-rest-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.StandaloneRestTestPlugin'
}
standaloneTest {
id = 'elasticsearch.standalone-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.StandaloneTestPlugin'
}
testFixtures {
id = 'elasticsearch.test.fixtures'
implementationClass = 'org.elasticsearch.gradle.internal.testfixtures.TestFixturesPlugin'
}
testBase {
id = 'elasticsearch.test-base'
implementationClass = 'org.elasticsearch.gradle.internal.ElasticsearchTestBasePlugin'
}
testWithDependencies {
id = 'elasticsearch.test-with-dependencies'
implementationClass = 'org.elasticsearch.gradle.internal.test.TestWithDependenciesPlugin'
}
testWithSsl {
id = 'elasticsearch.test-with-ssl'
implementationClass = 'org.elasticsearch.gradle.internal.test.TestWithSslPlugin'
}
testclusters {
id = 'elasticsearch.testclusters'
implementationClass = 'org.elasticsearch.gradle.testclusters.TestClustersPlugin'
}
validateRestSpec {
id = 'elasticsearch.validate-rest-spec'
implementationClass = 'org.elasticsearch.gradle.internal.precommit.ValidateRestSpecPlugin'
}
yamlRestCompatTest {
id = 'elasticsearch.yaml-rest-compat-test'
implementationClass = 'org.elasticsearch.gradle.internal.rest.compat.YamlRestCompatTestPlugin'
}
yamlRestTest {
id = 'elasticsearch.yaml-rest-test'
implementationClass = 'org.elasticsearch.gradle.internal.test.rest.YamlRestTestPlugin'
}
}
} }
def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) { def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
outputFile = "${buildDir}/version.properties" outputFile = "${buildDir}/version.properties"

View file

@ -9,7 +9,6 @@
package org.elasticsearch.gradle package org.elasticsearch.gradle
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.internal.VersionProperties
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Unroll import spock.lang.Unroll
@ -18,7 +17,7 @@ import static org.elasticsearch.gradle.fixtures.DistributionDownloadFixture.with
class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest { class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
@Unroll @Unroll
def "#distType version can be resolved"() { def "extracted #distType version can be resolved"() {
given: given:
buildFile << applyPluginAndSetupDistro(version, platform) buildFile << applyPluginAndSetupDistro(version, platform)

View file

@ -136,8 +136,6 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
description = "test module description" description = "test module description"
} }
licenseFile = file('license.txt')
noticeFile = file('notice.txt')
version = "1.0" version = "1.0"
group = 'org.acme' group = 'org.acme'
""" """

View file

@ -10,7 +10,7 @@ package org.elasticsearch.gradle.fixtures
import org.elasticsearch.gradle.Architecture import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.ElasticsearchDistribution import org.elasticsearch.gradle.ElasticsearchDistribution
import org.elasticsearch.gradle.internal.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.GradleRunner

View file

@ -8,7 +8,7 @@
package org.elasticsearch.gradle.internal package org.elasticsearch.gradle.internal
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Unroll import spock.lang.Unroll

View file

@ -9,28 +9,13 @@
package org.elasticsearch.gradle.internal package org.elasticsearch.gradle.internal
import org.elasticsearch.gradle.Architecture import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest { class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
def "plugin application fails on non internal build"() {
given:
buildFile.text = """
plugins {
id 'elasticsearch.internal-distribution-download'
}
"""
when:
def result = gradleRunner("tasks").buildAndFail()
then:
assertOutputContains(result.output, "Plugin 'elasticsearch.internal-distribution-download' is not supported. " +
"Use 'elasticsearch.distribution-download' plugin instead")
}
def "resolves current version from local build"() { def "resolves current version from local build"() {
given: given:
internalBuild() internalBuild()

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle package org.elasticsearch.gradle.internal
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
@ -57,7 +57,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
file('notice.txt') << "Notice file" file('notice.txt') << "Notice file"
buildFile << """ buildFile << """
plugins { plugins {
id 'elasticsearch.esplugin' id 'elasticsearch.internal-es-plugin'
id 'elasticsearch.publish' id 'elasticsearch.publish'
id 'com.github.johnrengelman.shadow' id 'com.github.johnrengelman.shadow'
} }
@ -115,7 +115,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
file('notice.txt') << "Notice file" file('notice.txt') << "Notice file"
buildFile << """ buildFile << """
plugins { plugins {
id 'elasticsearch.esplugin' id 'elasticsearch.internal-es-plugin'
id 'elasticsearch.publish' id 'elasticsearch.publish'
} }

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle package org.elasticsearch.gradle.internal.test.rest
import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome

View file

@ -6,14 +6,15 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle package org.elasticsearch.gradle.internal.test.rest
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SequenceWriter import com.fasterxml.jackson.databind.SequenceWriter
import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest
import org.elasticsearch.gradle.internal.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
class YamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTest { class YamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTest {
@ -29,7 +30,6 @@ class YamlRestCompatTestPluginFuncTest extends AbstractRestResourcesFuncTest {
def "yamlRestCompatTest does nothing when there are no tests"() { def "yamlRestCompatTest does nothing when there are no tests"() {
given: given:
addSubProject(":distribution:bwc:minor") << """ addSubProject(":distribution:bwc:minor") << """
configurations { checkout } configurations { checkout }
artifacts { artifacts {

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle package org.elasticsearch.gradle.internal.test.rest
import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest import org.elasticsearch.gradle.fixtures.AbstractRestResourcesFuncTest
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome

View file

@ -10,7 +10,7 @@ import org.elasticsearch.gradle.testclusters.RunTask
// gradle has an open issue of failing applying plugins in // gradle has an open issue of failing applying plugins in
// precompiled script plugins (see https://github.com/gradle/gradle/issues/17004) // precompiled script plugins (see https://github.com/gradle/gradle/issues/17004)
// apply plugin: 'elasticsearch.testclusters' // apply plugin: 'elasticsearch.internal-testclusters'
testClusters { testClusters {
runTask { runTask {

View file

@ -8,7 +8,7 @@
import org.elasticsearch.gradle.Architecture import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.OS import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.internal.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.internal.info.BuildParams import org.elasticsearch.gradle.internal.info.BuildParams
// gradle has an open issue of failing applying plugins in // gradle has an open issue of failing applying plugins in

View file

@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal
import org.apache.tools.ant.taskdefs.condition.Os import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.FixtureStop import org.elasticsearch.gradle.FixtureStop
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.internal.test.AntFixture import org.elasticsearch.gradle.internal.test.AntFixture
import org.gradle.api.file.FileSystemOperations import org.gradle.api.file.FileSystemOperations
import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Internal

View file

@ -9,7 +9,7 @@ package org.elasticsearch.gradle.internal.doc
import org.elasticsearch.gradle.OS import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.internal.VersionProperties import org.elasticsearch.gradle.VersionProperties
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.Directory import org.gradle.api.file.Directory
@ -23,7 +23,7 @@ class DocsTestPlugin implements Plugin<Project> {
@Override @Override
void apply(Project project) { void apply(Project project) {
project.pluginManager.apply('elasticsearch.testclusters') project.pluginManager.apply('elasticsearch.internal-testclusters')
project.pluginManager.apply('elasticsearch.standalone-rest-test') project.pluginManager.apply('elasticsearch.standalone-rest-test')
project.pluginManager.apply('elasticsearch.rest-test') project.pluginManager.apply('elasticsearch.rest-test')

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle;
public interface DistributionDependency { public interface DistributionDependency {
static DistributionDependency of(String dependencyNotation) { static DistributionDependency of(String dependencyNotation) {

View file

@ -8,14 +8,9 @@
package org.elasticsearch.gradle; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes;
import org.elasticsearch.gradle.ElasticsearchDistribution.Type;
import org.elasticsearch.gradle.internal.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.internal.docker.DockerSupportService;
import org.elasticsearch.gradle.internal.DistributionDependency;
import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform; import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform;
import org.elasticsearch.gradle.transform.UnzipTransform; import org.elasticsearch.gradle.transform.UnzipTransform;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -24,8 +19,11 @@ import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.artifacts.repositories.IvyArtifactRepository; import org.gradle.api.artifacts.repositories.IvyArtifactRepository;
import org.gradle.api.artifacts.type.ArtifactTypeDefinition; import org.gradle.api.artifacts.type.ArtifactTypeDefinition;
import org.gradle.api.internal.artifacts.ArtifactAttributes; import org.gradle.api.internal.artifacts.ArtifactAttributes;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import javax.inject.Inject;
import java.util.Comparator; import java.util.Comparator;
/** /**
@ -48,14 +46,19 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
private NamedDomainObjectContainer<ElasticsearchDistribution> distributionsContainer; private NamedDomainObjectContainer<ElasticsearchDistribution> distributionsContainer;
private NamedDomainObjectContainer<DistributionResolution> distributionsResolutionStrategiesContainer; private NamedDomainObjectContainer<DistributionResolution> distributionsResolutionStrategiesContainer;
private Property<Boolean> dockerAvailability;
@Inject
public DistributionDownloadPlugin(ObjectFactory objectFactory) {
this.dockerAvailability = objectFactory.property(Boolean.class).value(false);
}
public void setDockerAvailability(Provider<Boolean> dockerAvailability) {
this.dockerAvailability.set(dockerAvailability);
}
@Override @Override
public void apply(Project project) { public void apply(Project project) {
project.getRootProject().getPluginManager().apply(DockerSupportPlugin.class);
Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
project.getGradle().getSharedServices(),
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
);
project.getDependencies().registerTransform(UnzipTransform.class, transformSpec -> { project.getDependencies().registerTransform(UnzipTransform.class, transformSpec -> {
transformSpec.getFrom().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.ZIP_TYPE); transformSpec.getFrom().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.ZIP_TYPE);
transformSpec.getTo().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE); transformSpec.getTo().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
@ -68,11 +71,11 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
}); });
setupResolutionsContainer(project); setupResolutionsContainer(project);
setupDistributionContainer(project, dockerSupport); setupDistributionContainer(project, dockerAvailability);
setupDownloadServiceRepo(project); setupDownloadServiceRepo(project);
} }
private void setupDistributionContainer(Project project, Provider<DockerSupportService> dockerSupport) { private void setupDistributionContainer(Project project, Property<Boolean> dockerAvailable) {
distributionsContainer = project.container(ElasticsearchDistribution.class, name -> { distributionsContainer = project.container(ElasticsearchDistribution.class, name -> {
Configuration fileConfiguration = project.getConfigurations().create("es_distro_file_" + name); Configuration fileConfiguration = project.getConfigurations().create("es_distro_file_" + name);
Configuration extractedConfiguration = project.getConfigurations().create(DISTRO_EXTRACTED_CONFIG_PREFIX + name); Configuration extractedConfiguration = project.getConfigurations().create(DISTRO_EXTRACTED_CONFIG_PREFIX + name);
@ -80,7 +83,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
return new ElasticsearchDistribution( return new ElasticsearchDistribution(
name, name,
project.getObjects(), project.getObjects(),
dockerSupport, dockerAvailability,
fileConfiguration, fileConfiguration,
extractedConfiguration, extractedConfiguration,
(dist) -> finalizeDistributionDependencies(project, dist) (dist) -> finalizeDistributionDependencies(project, dist)
@ -160,23 +163,12 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
* coordinates that resolve to the Elastic download service through an ivy repository. * coordinates that resolve to the Elastic download service through an ivy repository.
*/ */
private String dependencyNotation(ElasticsearchDistribution distribution) { private String dependencyNotation(ElasticsearchDistribution distribution) {
if (distribution.getType() == Type.INTEG_TEST_ZIP) { if (distribution.getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP) {
return "org.elasticsearch.distribution.integ-test-zip:elasticsearch:" + distribution.getVersion() + "@zip"; return "org.elasticsearch.distribution.integ-test-zip:elasticsearch:" + distribution.getVersion() + "@zip";
} }
Version distroVersion = Version.fromString(distribution.getVersion()); Version distroVersion = Version.fromString(distribution.getVersion());
String extension = distribution.getType().toString(); String extension = distribution.getType().getExtension(distribution.getPlatform());
String classifier = ":" + Architecture.current().classifier; String classifier = distribution.getType().getClassifier(distribution.getPlatform(), distroVersion);
if (distribution.getType() == Type.ARCHIVE) {
extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz";
if (distroVersion.onOrAfter("7.0.0")) {
classifier = ":" + distribution.getPlatform() + "-" + Architecture.current().classifier;
} else {
classifier = "";
}
} else if (distribution.getType() == Type.DEB) {
classifier = ":amd64";
}
String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP; String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP;
return group + ":elasticsearch" + ":" + distribution.getVersion() + classifier + "@" + extension; return group + ":elasticsearch" + ":" + distribution.getVersion() + classifier + "@" + extension;
} }

View file

@ -8,7 +8,6 @@
package org.elasticsearch.gradle; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.internal.DistributionDependency;
import org.gradle.api.Project; import org.gradle.api.Project;
public class DistributionResolution { public class DistributionResolution {

View file

@ -8,14 +8,12 @@
package org.elasticsearch.gradle; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes;
import org.elasticsearch.gradle.internal.docker.DockerSupportService;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.Buildable; import org.gradle.api.Buildable;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.model.ObjectFactory; import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property; import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.TaskDependency; import org.gradle.api.tasks.TaskDependency;
import java.io.File; import java.io.File;
@ -36,49 +34,6 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
} }
} }
public enum Type {
INTEG_TEST_ZIP,
ARCHIVE,
RPM,
DEB,
DOCKER,
// This is a different flavour of Docker image
DOCKER_UBI,
// Like UBI, but a little different.
DOCKER_IRON_BANK;
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ROOT);
}
public boolean shouldExtract() {
switch (this) {
case DEB:
case DOCKER:
case DOCKER_UBI:
case DOCKER_IRON_BANK:
case RPM:
return false;
default:
return true;
}
}
public boolean isDocker() {
switch (this) {
case DOCKER:
case DOCKER_UBI:
case DOCKER_IRON_BANK:
return true;
default:
return false;
}
}
}
// package private to tests can use // package private to tests can use
public static final Platform CURRENT_PLATFORM = OS.<Platform>conditional() public static final Platform CURRENT_PLATFORM = OS.<Platform>conditional()
.onLinux(() -> Platform.LINUX) .onLinux(() -> Platform.LINUX)
@ -87,13 +42,13 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
.supply(); .supply();
private final String name; private final String name;
private final Provider<DockerSupportService> dockerSupport; private final Property<Boolean> dockerAvailability;
// pkg private so plugin can configure // pkg private so plugin can configure
final Configuration configuration; final Configuration configuration;
private final Property<Architecture> architecture; private final Property<Architecture> architecture;
private final Property<String> version; private final Property<String> version;
private final Property<Type> type; private final Property<ElasticsearchDistributionType> type;
private final Property<Platform> platform; private final Property<Platform> platform;
private final Property<Boolean> bundledJdk; private final Property<Boolean> bundledJdk;
private final Property<Boolean> failIfUnavailable; private final Property<Boolean> failIfUnavailable;
@ -104,18 +59,18 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
ElasticsearchDistribution( ElasticsearchDistribution(
String name, String name,
ObjectFactory objectFactory, ObjectFactory objectFactory,
Provider<DockerSupportService> dockerSupport, Property<Boolean> dockerAvailability,
Configuration fileConfiguration, Configuration fileConfiguration,
Configuration extractedConfiguration, Configuration extractedConfiguration,
Action<ElasticsearchDistribution> distributionFinalizer Action<ElasticsearchDistribution> distributionFinalizer
) { ) {
this.name = name; this.name = name;
this.dockerSupport = dockerSupport; this.dockerAvailability = dockerAvailability;
this.configuration = fileConfiguration; this.configuration = fileConfiguration;
this.architecture = objectFactory.property(Architecture.class); this.architecture = objectFactory.property(Architecture.class);
this.version = objectFactory.property(String.class).convention(VersionProperties.getElasticsearch()); this.version = objectFactory.property(String.class).convention(VersionProperties.getElasticsearch());
this.type = objectFactory.property(Type.class); this.type = objectFactory.property(ElasticsearchDistributionType.class);
this.type.convention(Type.ARCHIVE); this.type.convention(ElasticsearchDistributionTypes.ARCHIVE);
this.platform = objectFactory.property(Platform.class); this.platform = objectFactory.property(Platform.class);
this.bundledJdk = objectFactory.property(Boolean.class); this.bundledJdk = objectFactory.property(Boolean.class);
this.failIfUnavailable = objectFactory.property(Boolean.class).convention(true); this.failIfUnavailable = objectFactory.property(Boolean.class).convention(true);
@ -144,14 +99,27 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
this.platform.set(platform); this.platform.set(platform);
} }
public Type getType() { public ElasticsearchDistributionType getType() {
return type.get(); return type.get();
} }
public void setType(Type type) { public void setType(ElasticsearchDistributionType type) {
this.type.set(type); this.type.set(type);
} }
/**
* For simplicity only public distribution types are supported here
* */
public void setType(String type) {
if (type.equals(ElasticsearchDistributionTypes.ARCHIVE.getName())) {
this.type.set(ElasticsearchDistributionTypes.ARCHIVE);
} else if (type.equals(ElasticsearchDistributionTypes.INTEG_TEST_ZIP.getName())) {
this.type.set(ElasticsearchDistributionTypes.INTEG_TEST_ZIP);
} else {
throw new IllegalArgumentException("Cannot set Elasticsearch Distribution type to " + type + ". Type unknown.");
}
}
public boolean getBundledJdk() { public boolean getBundledJdk() {
return bundledJdk.getOrElse(true); return bundledJdk.getOrElse(true);
} }
@ -205,19 +173,12 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
} }
public Configuration getExtracted() { public Configuration getExtracted() {
switch (getType()) { if (getType().shouldExtract() == false) {
case DEB: throw new UnsupportedOperationException(
case DOCKER: "distribution type [" + getType().getName() + "] for " + "elasticsearch distribution [" + name + "] cannot be extracted"
case DOCKER_UBI: );
case DOCKER_IRON_BANK:
case RPM:
throw new UnsupportedOperationException(
"distribution type [" + getType() + "] for " + "elasticsearch distribution [" + name + "] cannot be extracted"
);
default:
return extracted;
} }
return extracted;
} }
@Override @Override
@ -231,7 +192,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
} }
private boolean skippingDockerDistributionBuild() { private boolean skippingDockerDistributionBuild() {
return isDocker() && getFailIfUnavailable() == false && dockerSupport.get().getDockerAvailability().isAvailable == false; return isDocker() && getFailIfUnavailable() == false && dockerAvailability.get() == false;
} }
@Override @Override
@ -242,7 +203,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
// internal, make this distribution's configuration unmodifiable // internal, make this distribution's configuration unmodifiable
void finalizeValues() { void finalizeValues() {
if (getType() == Type.INTEG_TEST_ZIP) { if (getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP) {
if (platform.getOrNull() != null) { if (platform.getOrNull() != null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]" "platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
@ -262,7 +223,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
); );
} }
if (getType() == Type.ARCHIVE) { if (getType() == ElasticsearchDistributionTypes.ARCHIVE) {
// defaults for archive, set here instead of via convention so integ-test-zip can verify they are not set // defaults for archive, set here instead of via convention so integ-test-zip can verify they are not set
if (platform.isPresent() == false) { if (platform.isPresent() == false) {
platform.set(CURRENT_PLATFORM); platform.set(CURRENT_PLATFORM);

View file

@ -0,0 +1,30 @@
/*
* 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.
*/
package org.elasticsearch.gradle;
public interface ElasticsearchDistributionType {
String getName();
default boolean isDocker() {
return false;
};
default boolean shouldExtract() {
return false;
};
default String getExtension(ElasticsearchDistribution.Platform platform) {
return getName();
}
default String getClassifier(ElasticsearchDistribution.Platform platform, Version version) {
return ":" + Architecture.current().classifier;
}
}

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;

View file

@ -5,9 +5,8 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server * in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.FileSystemOperationsAware;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.Task; import org.gradle.api.Task;

View file

@ -8,8 +8,6 @@
package org.elasticsearch.gradle; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.ProjectLayout;
@ -32,20 +30,24 @@ public class ReaperPlugin implements Plugin<Project> {
@Override @Override
public void apply(Project project) { public void apply(Project project) {
registerReaperService(project, projectLayout, false);
}
public static void registerReaperService(Project project, ProjectLayout projectLayout, boolean internal) {
if (project != project.getRootProject()) { if (project != project.getRootProject()) {
throw new IllegalArgumentException("ReaperPlugin can only be applied to the root project of a build"); throw new IllegalArgumentException("ReaperPlugin can only be applied to the root project of a build");
} }
project.getPlugins().apply(GlobalBuildInfoPlugin.class);
File inputDir = projectLayout.getProjectDirectory() File inputDir = projectLayout.getProjectDirectory()
.dir(".gradle") .dir(".gradle")
.dir("reaper") .dir("reaper")
.dir("build-" + ProcessHandle.current().pid()) .dir("build-" + ProcessHandle.current().pid())
.getAsFile(); .getAsFile();
project.getGradle().getSharedServices().registerIfAbsent(REAPER_SERVICE_NAME, ReaperService.class, spec -> { project.getGradle().getSharedServices().registerIfAbsent(REAPER_SERVICE_NAME, ReaperService.class, spec -> {
// Provide some parameters // Provide some parameters
spec.getParameters().getInputDir().set(inputDir); spec.getParameters().getInputDir().set(inputDir);
spec.getParameters().getBuildDir().set(projectLayout.getBuildDirectory()); spec.getParameters().getBuildDir().set(projectLayout.getBuildDirectory());
spec.getParameters().setInternal(BuildParams.isInternal()); spec.getParameters().setInternal(internal);
}); });
} }

View file

@ -170,7 +170,7 @@ public abstract class ReaperService implements BuildService<ReaperService.Params
shutdown(); shutdown();
} }
interface Params extends BuildServiceParameters { public interface Params extends BuildServiceParameters {
Boolean getInternal(); Boolean getInternal();
void setInternal(Boolean internal); void setInternal(Boolean internal);

View file

@ -5,9 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server * in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle;
import org.elasticsearch.gradle.Version;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View file

@ -0,0 +1,40 @@
/*
* 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.
*/
package org.elasticsearch.gradle.distribution;
import org.elasticsearch.gradle.Architecture;
import org.elasticsearch.gradle.ElasticsearchDistribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
import org.elasticsearch.gradle.Version;
public class ArchiveElasticsearchDistributionType implements ElasticsearchDistributionType {
ArchiveElasticsearchDistributionType() {}
@Override
public String getName() {
return "archive";
}
@Override
public String getExtension(ElasticsearchDistribution.Platform platform) {
return platform == ElasticsearchDistribution.Platform.WINDOWS ? "zip" : "tar.gz";
}
@Override
public String getClassifier(ElasticsearchDistribution.Platform platform, Version version) {
return version.onOrAfter("7.0.0") ? ":" + platform + "-" + Architecture.current().classifier : "";
}
@Override
public boolean shouldExtract() {
return true;
}
}

View file

@ -0,0 +1,16 @@
/*
* 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.
*/
package org.elasticsearch.gradle.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class ElasticsearchDistributionTypes {
public static ElasticsearchDistributionType ARCHIVE = new ArchiveElasticsearchDistributionType();
public static ElasticsearchDistributionType INTEG_TEST_ZIP = new IntegTestZipElasticsearchDistributionType();
}

View file

@ -0,0 +1,26 @@
/*
* 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.
*/
package org.elasticsearch.gradle.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class IntegTestZipElasticsearchDistributionType implements ElasticsearchDistributionType {
IntegTestZipElasticsearchDistributionType() {}
@Override
public String getName() {
return "integ-test-zip";
}
@Override
public boolean shouldExtract() {
return true;
}
}

View file

@ -9,10 +9,8 @@
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle.internal;
import org.codehaus.groovy.runtime.DefaultGroovyMethods; import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin; import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.internal.precommit.InternalPrecommitTasks; import org.elasticsearch.gradle.internal.precommit.InternalPrecommitTasks;
import org.elasticsearch.gradle.precommit.PrecommitTasks;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.InvalidUserDataException; import org.gradle.api.InvalidUserDataException;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
@ -30,7 +28,6 @@ public class BuildPlugin implements Plugin<Project> {
public void apply(final Project project) { public void apply(final Project project) {
// make sure the global build info plugin is applied to the root project // make sure the global build info plugin is applied to the root project
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class); project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
checkExternalInternalPluginUsages(project);
if (project.getPluginManager().hasPlugin("elasticsearch.standalone-rest-test")) { if (project.getPluginManager().hasPlugin("elasticsearch.standalone-rest-test")) {
throw new InvalidUserDataException( throw new InvalidUserDataException(
@ -44,18 +41,7 @@ public class BuildPlugin implements Plugin<Project> {
project.getPluginManager().apply(DependenciesInfoPlugin.class); project.getPluginManager().apply(DependenciesInfoPlugin.class);
project.getPluginManager().apply(DependenciesGraphPlugin.class); project.getPluginManager().apply(DependenciesGraphPlugin.class);
BuildParams.withInternalBuild(() -> InternalPrecommitTasks.create(project, true)).orElse(() -> PrecommitTasks.create(project)); InternalPrecommitTasks.create(project, true);
}
private static void checkExternalInternalPluginUsages(Project project) {
if (BuildParams.isInternal().equals(false)) {
project.getPlugins()
.withType(
InternalPlugin.class,
internalPlugin -> { throw new GradleException(internalPlugin.getExternalUseErrorMessage()); }
);
}
} }
public static void configureLicenseAndNotice(final Project project) { public static void configureLicenseAndNotice(final Project project) {

View file

@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.elasticsearch.gradle.LoggedExec;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.Project; import org.gradle.api.Project;

View file

@ -9,6 +9,7 @@ package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.Architecture; import org.elasticsearch.gradle.Architecture;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.VersionProperties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View file

@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal;
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar; import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
import nebula.plugin.info.InfoBrokerPlugin; import nebula.plugin.info.InfoBrokerPlugin;
import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin; import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.precommit.PrecommitTaskPlugin; import org.elasticsearch.gradle.precommit.PrecommitTaskPlugin;

View file

@ -8,6 +8,7 @@
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.LoggedExec;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin; import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;

View file

@ -8,6 +8,7 @@
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.VersionProperties;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.Project; import org.gradle.api.Project;

View file

@ -9,16 +9,24 @@
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.Architecture; import org.elasticsearch.gradle.Architecture;
import org.elasticsearch.gradle.DistributionDependency;
import org.elasticsearch.gradle.DistributionDownloadPlugin; import org.elasticsearch.gradle.DistributionDownloadPlugin;
import org.elasticsearch.gradle.DistributionResolution; import org.elasticsearch.gradle.DistributionResolution;
import org.elasticsearch.gradle.ElasticsearchDistribution; import org.elasticsearch.gradle.ElasticsearchDistribution;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes;
import org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes;
import org.elasticsearch.gradle.internal.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.internal.docker.DockerSupportService;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin; import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.Dependency;
import org.gradle.api.provider.Provider;
import java.util.function.Function; import java.util.function.Function;
@ -37,11 +45,15 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
public void apply(Project project) { public void apply(Project project) {
// this is needed for isInternal // this is needed for isInternal
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class); project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
// might be used without the general build plugin so we keep this check for now. project.getRootProject().getPluginManager().apply(DockerSupportPlugin.class);
if (BuildParams.isInternal() == false) { DistributionDownloadPlugin distributionDownloadPlugin = project.getPlugins().apply(DistributionDownloadPlugin.class);
throw new GradleException(getExternalUseErrorMessage()); Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
} project.getGradle().getSharedServices(),
project.getPluginManager().apply(DistributionDownloadPlugin.class); DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
);
distributionDownloadPlugin.setDockerAvailability(
dockerSupport.map(dockerSupportService -> dockerSupportService.getDockerAvailability().isAvailable)
);
this.bwcVersions = BuildParams.getBwcVersions(); this.bwcVersions = BuildParams.getBwcVersions();
registerInternalDistributionResolutions(DistributionDownloadPlugin.getRegistrationsContainer(project)); registerInternalDistributionResolutions(DistributionDownloadPlugin.getRegistrationsContainer(project));
} }
@ -55,7 +67,6 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
* BWC versions are resolved as project to projects under `:distribution:bwc`. * BWC versions are resolved as project to projects under `:distribution:bwc`.
*/ */
private void registerInternalDistributionResolutions(NamedDomainObjectContainer<DistributionResolution> resolutions) { private void registerInternalDistributionResolutions(NamedDomainObjectContainer<DistributionResolution> resolutions) {
resolutions.register("localBuild", distributionResolution -> distributionResolution.setResolver((project, distribution) -> { resolutions.register("localBuild", distributionResolution -> distributionResolution.setResolver((project, distribution) -> {
if (VersionProperties.getElasticsearch().equals(distribution.getVersion())) { if (VersionProperties.getElasticsearch().equals(distribution.getVersion())) {
// non-external project, so depend on local build // non-external project, so depend on local build
@ -97,29 +108,20 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
: "expanded-" + distributionProjectName; : "expanded-" + distributionProjectName;
} else { } else {
return distributionProjectName; return distributionProjectName;
} }
} }
private static String distributionProjectPath(ElasticsearchDistribution distribution) { private static String distributionProjectPath(ElasticsearchDistribution distribution) {
String projectPath = ":distribution"; String projectPath = ":distribution";
switch (distribution.getType()) { if (distribution.getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP) {
case INTEG_TEST_ZIP: projectPath += ":archives:integ-test-zip";
projectPath += ":archives:integ-test-zip"; } else if (distribution.getType().isDocker()) {
break; projectPath += ":docker:";
projectPath += distributionProjectName(distribution);
case DOCKER: } else {
case DOCKER_UBI: projectPath += distribution.getType() == ElasticsearchDistributionTypes.ARCHIVE ? ":archives:" : ":packages:";
case DOCKER_IRON_BANK: projectPath += distributionProjectName(distribution);
projectPath += ":docker:";
projectPath += distributionProjectName(distribution);
break;
default:
projectPath += distribution.getType() == ElasticsearchDistribution.Type.ARCHIVE ? ":archives:" : ":packages:";
projectPath += distributionProjectName(distribution);
break;
} }
return projectPath; return projectPath;
} }
@ -149,24 +151,21 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
projectName += "no-jdk-"; projectName += "no-jdk-";
} }
switch (distribution.getType()) { if (distribution.getType() == ElasticsearchDistributionTypes.ARCHIVE) {
case ARCHIVE: return projectName + platform.toString() + archString + (platform == ElasticsearchDistribution.Platform.WINDOWS
return projectName + platform.toString() + archString + (platform == ElasticsearchDistribution.Platform.WINDOWS ? "-zip"
? "-zip" : "-tar");
: "-tar");
case DOCKER:
return projectName + "docker" + archString + "-export";
case DOCKER_UBI:
return projectName + "ubi-docker" + archString + "-export";
case DOCKER_IRON_BANK:
return projectName + "ironbank-docker" + archString + "-export";
default:
return projectName + distribution.getType();
} }
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER) {
return projectName + "docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_UBI) {
return projectName + "ubi-docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_IRONBANK) {
return projectName + "ironbank-docker" + archString + "-export";
}
return projectName + distribution.getType().getName();
} }
private static class ProjectBasedDistributionDependency implements DistributionDependency { private static class ProjectBasedDistributionDependency implements DistributionDependency {

View file

@ -0,0 +1,105 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal;
import groovy.lang.Closure;
import org.elasticsearch.gradle.internal.precommit.TestingConventionsTasks;
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin;
import org.elasticsearch.gradle.internal.util.Util;
import org.elasticsearch.gradle.plugin.PluginBuildPlugin;
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Project;
import org.gradle.api.tasks.bundling.Zip;
import java.util.Optional;
public class InternalPluginBuildPlugin implements InternalPlugin {
@Override
public void apply(Project project) {
project.getPluginManager().apply(BuildPlugin.class);
project.getPluginManager().apply(PluginBuildPlugin.class);
// Clear default dependencies added by public PluginBuildPlugin as we add our
// own project dependencies for internal builds
// TODO remove once we removed default dependencies from PluginBuildPlugin
project.getConfigurations().getByName("compileOnly").getDependencies().clear();
project.getConfigurations().getByName("testImplementation").getDependencies().clear();
project.getPluginManager().apply(RestTestBasePlugin.class);
var extension = project.getExtensions().getByType(PluginPropertiesExtension.class);
// We've ported this from multiple build scripts where we see this pattern into
// an extension method as a first step of consolidation.
// We might want to port this into a general pattern later on.
project.getExtensions()
.getExtraProperties()
.set("addQaCheckDependencies", new Closure<Object>(InternalPluginBuildPlugin.this, InternalPluginBuildPlugin.this) {
public void doCall(Object it) {
project.afterEvaluate(project1 -> {
// let check depend on check tasks of qa sub-projects
final var checkTaskProvider = project1.getTasks().named("check");
Optional<Project> qaSubproject = project1.getSubprojects()
.stream()
.filter(p -> p.getPath().equals(project1.getPath() + ":qa"))
.findFirst();
qaSubproject.ifPresent(
qa -> qa.getSubprojects()
.forEach(p -> checkTaskProvider.configure(task -> task.dependsOn(p.getPath() + ":check")))
);
});
}
public void doCall() {
doCall(null);
}
});
project.getTasks().withType(TestingConventionsTasks.class).named("testingConventions").configure(t -> {
t.getNaming().clear();
t.getNaming()
.create("Tests", testingConventionRule -> testingConventionRule.baseClass("org.apache.lucene.util.LuceneTestCase"));
t.getNaming().create("IT", testingConventionRule -> {
testingConventionRule.baseClass("org.elasticsearch.test.ESIntegTestCase");
testingConventionRule.baseClass("org.elasticsearch.test.rest.ESRestTestCase");
testingConventionRule.baseClass("org.elasticsearch.test.ESSingleNodeTestCase");
});
});
project.afterEvaluate(p -> {
boolean isModule = GradleUtils.isModuleProject(p.getPath());
boolean isXPackModule = isModule && p.getPath().startsWith(":x-pack");
if (isModule == false || isXPackModule) {
addNoticeGeneration(p, extension);
}
});
}
/**
* Configure the pom for the main jar of this plugin
*/
protected static void addNoticeGeneration(final Project project, PluginPropertiesExtension extension) {
final var licenseFile = extension.getLicenseFile();
var tasks = project.getTasks();
if (licenseFile != null) {
tasks.withType(Zip.class).named("bundlePlugin").configure(zip -> zip.from(licenseFile.getParentFile(), copySpec -> {
copySpec.include(licenseFile.getName());
copySpec.rename(s -> "LICENSE.txt");
}));
}
final var noticeFile = extension.getNoticeFile();
if (noticeFile != null) {
final var generateNotice = tasks.register("generateNotice", NoticeTask.class, noticeTask -> {
noticeTask.setInputFile(noticeFile);
noticeTask.source(Util.getJavaMainSourceSet(project).get().getAllJava());
});
tasks.withType(Zip.class).named("bundlePlugin").configure(task -> task.from(generateNotice));
}
}
}

View file

@ -0,0 +1,31 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.file.ProjectLayout;
import javax.inject.Inject;
import static org.elasticsearch.gradle.ReaperPlugin.registerReaperService;
public class InternalReaperPlugin implements Plugin<Project> {
private final ProjectLayout projectLayout;
@Inject
public InternalReaperPlugin(ProjectLayout projectLayout) {
this.projectLayout = projectLayout;
}
@Override
public void apply(Project project) {
registerReaperService(project, projectLayout, true);
}
}

View file

@ -0,0 +1,36 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.provider.ProviderFactory;
import javax.inject.Inject;
public class InternalTestClustersPlugin implements Plugin<Project> {
private ProviderFactory providerFactory;
@Inject
public InternalTestClustersPlugin(ProviderFactory providerFactory) {
this.providerFactory = providerFactory;
}
@Override
public void apply(Project project) {
project.getPlugins().apply(InternalDistributionDownloadPlugin.class);
project.getRootProject().getPluginManager().apply(InternalReaperPlugin.class);
TestClustersPlugin testClustersPlugin = project.getPlugins().apply(TestClustersPlugin.class);
testClustersPlugin.setRuntimeJava(providerFactory.provider(() -> BuildParams.getRuntimeJavaHome()));
}
}

View file

@ -6,7 +6,7 @@
* Side Public License, v 1. * Side Public License, v 1.
*/ */
package org.elasticsearch.gradle; package org.elasticsearch.gradle.internal;
import org.codehaus.groovy.runtime.StringGroovyMethods; import org.codehaus.groovy.runtime.StringGroovyMethods;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;

View file

@ -8,6 +8,7 @@
package org.elasticsearch.gradle.internal; package org.elasticsearch.gradle.internal;
import org.elasticsearch.gradle.VersionProperties;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;

View file

@ -0,0 +1,29 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
import org.elasticsearch.gradle.Version;
public class DebElasticsearchDistributionType implements ElasticsearchDistributionType {
DebElasticsearchDistributionType() {}
@Override
public String getName() {
return "deb";
}
@Override
public String getClassifier(ElasticsearchDistribution.Platform platform, Version version) {
return ":amd64";
}
}

View file

@ -0,0 +1,26 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class DockerElasticsearchDistributionType implements ElasticsearchDistributionType {
DockerElasticsearchDistributionType() {}
@Override
public String getName() {
return "docker";
}
@Override
public boolean isDocker() {
return true;
}
}

View file

@ -0,0 +1,26 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class DockerIronBankElasticsearchDistributionType implements ElasticsearchDistributionType {
DockerIronBankElasticsearchDistributionType() {}
@Override
public String getName() {
return "dockerIronBank";
}
@Override
public boolean isDocker() {
return true;
}
}

View file

@ -0,0 +1,26 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class DockerUbiElasticsearchDistributionType implements ElasticsearchDistributionType {
DockerUbiElasticsearchDistributionType() {}
@Override
public String getName() {
return "dockerUbi";
}
@Override
public boolean isDocker() {
return true;
}
}

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
import java.util.List;
public class InternalElasticsearchDistributionTypes {
public static ElasticsearchDistributionType DEB = new DebElasticsearchDistributionType();
public static ElasticsearchDistributionType RPM = new RpmElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER = new DockerElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_UBI = new DockerUbiElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_IRONBANK = new DockerIronBankElasticsearchDistributionType();
public static List<ElasticsearchDistributionType> ALL_INTERNAL = List.of(DEB, RPM, DOCKER, DOCKER_UBI, DOCKER_IRONBANK);
}

View file

@ -0,0 +1,31 @@
/*
* 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.
*/
package org.elasticsearch.gradle.internal.distribution;
import org.elasticsearch.gradle.ElasticsearchDistributionType;
public class RpmElasticsearchDistributionType implements ElasticsearchDistributionType {
RpmElasticsearchDistributionType() {}
@Override
public String getName() {
return "rpm";
}
@Override
public boolean shouldExtract() {
return false;
}
@Override
public boolean isDocker() {
return false;
}
}

View file

@ -7,7 +7,7 @@
*/ */
package org.elasticsearch.gradle.internal.docker; package org.elasticsearch.gradle.internal.docker;
import org.elasticsearch.gradle.internal.LoggedExec; import org.elasticsearch.gradle.LoggedExec;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.file.DirectoryProperty; import org.gradle.api.file.DirectoryProperty;

View file

@ -8,7 +8,7 @@
package org.elasticsearch.gradle.internal.precommit; package org.elasticsearch.gradle.internal.precommit;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.InternalPlugin; import org.elasticsearch.gradle.internal.InternalPlugin;
import org.elasticsearch.gradle.precommit.PrecommitPlugin; import org.elasticsearch.gradle.precommit.PrecommitPlugin;
import org.elasticsearch.gradle.internal.util.Util; import org.elasticsearch.gradle.internal.util.Util;

View file

@ -8,6 +8,7 @@
package org.elasticsearch.gradle.internal.precommit; package org.elasticsearch.gradle.internal.precommit;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.precommit.PrecommitTasks; import org.elasticsearch.gradle.precommit.PrecommitTasks;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -21,7 +22,12 @@ public class InternalPrecommitTasks {
*/ */
public static void create(Project project, boolean includeDependencyLicenses) { public static void create(Project project, boolean includeDependencyLicenses) {
PrecommitTasks.create(project); PrecommitTasks.create(project);
if (BuildParams.isInternal() && project.getPath().equals(":libs:elasticsearch-core") == false) {
// ideally we would configure this as a default dependency. But Default dependencies do not work correctly
// with gradle project dependencies as they're resolved to late in the build and don't setup according task
// dependencies properly
project.getDependencies().add("jarHell", project.project(":libs:elasticsearch-core"));
}
project.getPluginManager().apply(ThirdPartyAuditPrecommitPlugin.class); project.getPluginManager().apply(ThirdPartyAuditPrecommitPlugin.class);
project.getPluginManager().apply(CheckstylePrecommitPlugin.class); project.getPluginManager().apply(CheckstylePrecommitPlugin.class);
project.getPluginManager().apply(ForbiddenApisPrecommitPlugin.class); project.getPluginManager().apply(ForbiddenApisPrecommitPlugin.class);

View file

@ -19,7 +19,11 @@ public class LoggerUsagePrecommitPlugin extends PrecommitPlugin implements Inter
@Override @Override
public TaskProvider<? extends Task> createTask(Project project) { public TaskProvider<? extends Task> createTask(Project project) {
Configuration loggerUsageConfig = project.getConfigurations().create("loggerUsagePlugin"); Configuration loggerUsageConfig = project.getConfigurations().create("loggerUsagePlugin");
project.getDependencies().add("loggerUsagePlugin", project.project(":test:logger-usage")); // this makes it easier to test by not requiring this project to be always available in our
// test sample projects
if (project.findProject(":test:logger-usage") != null) {
project.getDependencies().add("loggerUsagePlugin", project.project(":test:logger-usage"));
}
TaskProvider<LoggerUsageTask> loggerUsage = project.getTasks().register("loggerUsageCheck", LoggerUsageTask.class); TaskProvider<LoggerUsageTask> loggerUsage = project.getTasks().register("loggerUsageCheck", LoggerUsageTask.class);
loggerUsage.configure(t -> t.setClasspath(loggerUsageConfig)); loggerUsage.configure(t -> t.setClasspath(loggerUsageConfig));
return loggerUsage; return loggerUsage;

View file

@ -8,7 +8,7 @@
package org.elasticsearch.gradle.internal.precommit; package org.elasticsearch.gradle.internal.precommit;
import org.elasticsearch.gradle.internal.LoggedExec; import org.elasticsearch.gradle.LoggedExec;
import org.elasticsearch.gradle.precommit.PrecommitTask; import org.elasticsearch.gradle.precommit.PrecommitTask;
import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.JavaPluginConvention;

View file

@ -18,7 +18,7 @@ import com.fasterxml.jackson.databind.node.TextNode;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLParser; import com.fasterxml.jackson.dataformat.yaml.YAMLParser;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform; import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformer; import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformer;
import org.elasticsearch.gradle.internal.test.rest.transform.headers.InjectHeaders; import org.elasticsearch.gradle.internal.test.rest.transform.headers.InjectHeaders;

View file

@ -10,7 +10,7 @@ package org.elasticsearch.gradle.internal.rest.compat;
import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin; import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.test.RestIntegTestTask; import org.elasticsearch.gradle.internal.test.RestIntegTestTask;
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin; import org.elasticsearch.gradle.internal.test.RestTestBasePlugin;
import org.elasticsearch.gradle.internal.test.rest.CopyRestApiTask; import org.elasticsearch.gradle.internal.test.rest.CopyRestApiTask;

View file

@ -12,11 +12,11 @@ import org.elasticsearch.gradle.Architecture;
import org.elasticsearch.gradle.DistributionDownloadPlugin; import org.elasticsearch.gradle.DistributionDownloadPlugin;
import org.elasticsearch.gradle.ElasticsearchDistribution; import org.elasticsearch.gradle.ElasticsearchDistribution;
import org.elasticsearch.gradle.ElasticsearchDistribution.Platform; import org.elasticsearch.gradle.ElasticsearchDistribution.Platform;
import org.elasticsearch.gradle.ElasticsearchDistribution.Type; import org.elasticsearch.gradle.ElasticsearchDistributionType;
import org.elasticsearch.gradle.internal.Jdk; import org.elasticsearch.gradle.internal.Jdk;
import org.elasticsearch.gradle.internal.JdkDownloadPlugin; import org.elasticsearch.gradle.internal.JdkDownloadPlugin;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.docker.DockerSupportPlugin; import org.elasticsearch.gradle.internal.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.internal.docker.DockerSupportService; import org.elasticsearch.gradle.internal.docker.DockerSupportService;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
@ -49,6 +49,13 @@ import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Stream; import java.util.stream.Stream;
import static org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes.ARCHIVE;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.ALL_INTERNAL;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DEB;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_IRONBANK;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.DOCKER_UBI;
import static org.elasticsearch.gradle.internal.distribution.InternalElasticsearchDistributionTypes.RPM;
import static org.elasticsearch.gradle.internal.vagrant.VagrantMachine.convertLinuxPath; import static org.elasticsearch.gradle.internal.vagrant.VagrantMachine.convertLinuxPath;
import static org.elasticsearch.gradle.internal.vagrant.VagrantMachine.convertWindowsPath; import static org.elasticsearch.gradle.internal.vagrant.VagrantMachine.convertWindowsPath;
@ -88,7 +95,7 @@ public class DistroTestPlugin implements Plugin<Project> {
NamedDomainObjectContainer<ElasticsearchDistribution> allDistributions = DistributionDownloadPlugin.getContainer(project); NamedDomainObjectContainer<ElasticsearchDistribution> allDistributions = DistributionDownloadPlugin.getContainer(project);
List<ElasticsearchDistribution> testDistributions = configureDistributions(project); List<ElasticsearchDistribution> testDistributions = configureDistributions(project);
Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecycleTasks = lifecycleTasks(project, "destructiveDistroTest"); Map<ElasticsearchDistributionType, TaskProvider<?>> lifecycleTasks = lifecycleTasks(project, "destructiveDistroTest");
Map<String, TaskProvider<?>> versionTasks = versionTasks(project, "destructiveDistroUpgradeTest"); Map<String, TaskProvider<?>> versionTasks = versionTasks(project, "destructiveDistroUpgradeTest");
TaskProvider<Task> destructiveDistroTest = project.getTasks().register("destructiveDistroTest"); TaskProvider<Task> destructiveDistroTest = project.getTasks().register("destructiveDistroTest");
@ -96,7 +103,7 @@ public class DistroTestPlugin implements Plugin<Project> {
Configuration quotaAwareFsPlugin = configureQuotaAwareFsPlugin(project); Configuration quotaAwareFsPlugin = configureQuotaAwareFsPlugin(project);
List<TaskProvider<Test>> windowsTestTasks = new ArrayList<>(); List<TaskProvider<Test>> windowsTestTasks = new ArrayList<>();
Map<Type, List<TaskProvider<Test>>> linuxTestTasks = new HashMap<>(); Map<ElasticsearchDistributionType, List<TaskProvider<Test>>> linuxTestTasks = new HashMap<>();
Map<String, List<TaskProvider<Test>>> upgradeTestTasks = new HashMap<>(); Map<String, List<TaskProvider<Test>>> upgradeTestTasks = new HashMap<>();
Map<String, TaskProvider<?>> depsTasks = new HashMap<>(); Map<String, TaskProvider<?>> depsTasks = new HashMap<>();
@ -122,7 +129,7 @@ public class DistroTestPlugin implements Plugin<Project> {
destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask)); destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask));
lifecycleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask)); lifecycleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask));
if ((distribution.getType() == Type.DEB || distribution.getType() == Type.RPM) && distribution.getBundledJdk()) { if ((distribution.getType() == DEB || distribution.getType() == RPM) && distribution.getBundledJdk()) {
for (Version version : BuildParams.getBwcVersions().getIndexCompatible()) { for (Version version : BuildParams.getBwcVersions().getIndexCompatible()) {
final ElasticsearchDistribution bwcDistro; final ElasticsearchDistribution bwcDistro;
if (version.equals(Version.fromString(distribution.getVersion()))) { if (version.equals(Version.fromString(distribution.getVersion()))) {
@ -171,7 +178,7 @@ public class DistroTestPlugin implements Plugin<Project> {
project.getConfigurations().getByName("testRuntimeClasspath") project.getConfigurations().getByName("testRuntimeClasspath")
); );
Map<ElasticsearchDistribution.Type, TaskProvider<?>> vmLifecyleTasks = lifecycleTasks(vmProject, "distroTest"); Map<ElasticsearchDistributionType, TaskProvider<?>> vmLifecyleTasks = lifecycleTasks(vmProject, "distroTest");
Map<String, TaskProvider<?>> vmVersionTasks = versionTasks(vmProject, "distroUpgradeTest"); Map<String, TaskProvider<?>> vmVersionTasks = versionTasks(vmProject, "distroUpgradeTest");
TaskProvider<Task> distroTest = vmProject.getTasks().register("distroTest"); TaskProvider<Task> distroTest = vmProject.getTasks().register("distroTest");
@ -181,12 +188,12 @@ public class DistroTestPlugin implements Plugin<Project> {
vmProject, vmProject,
windowsTestTasks, windowsTestTasks,
depsTasks, depsTasks,
wrapperTask -> { vmLifecyleTasks.get(Type.ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); }, wrapperTask -> { vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); },
vmDependencies vmDependencies
); );
} else { } else {
for (var entry : linuxTestTasks.entrySet()) { for (var entry : linuxTestTasks.entrySet()) {
Type type = entry.getKey(); ElasticsearchDistributionType type = entry.getKey();
TaskProvider<?> vmLifecycleTask = vmLifecyleTasks.get(type); TaskProvider<?> vmLifecycleTask = vmLifecyleTasks.get(type);
configureVMWrapperTasks(vmProject, entry.getValue(), depsTasks, wrapperTask -> { configureVMWrapperTasks(vmProject, entry.getValue(), depsTasks, wrapperTask -> {
vmLifecycleTask.configure(t -> t.dependsOn(wrapperTask)); vmLifecycleTask.configure(t -> t.dependsOn(wrapperTask));
@ -222,14 +229,14 @@ public class DistroTestPlugin implements Plugin<Project> {
}); });
} }
private static Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecycleTasks(Project project, String taskPrefix) { private static Map<ElasticsearchDistributionType, TaskProvider<?>> lifecycleTasks(Project project, String taskPrefix) {
Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecyleTasks = new HashMap<>(); Map<ElasticsearchDistributionType, TaskProvider<?>> lifecyleTasks = new HashMap<>();
lifecyleTasks.put(Type.DOCKER, project.getTasks().register(taskPrefix + ".docker")); lifecyleTasks.put(DOCKER, project.getTasks().register(taskPrefix + ".docker"));
lifecyleTasks.put(Type.DOCKER_UBI, project.getTasks().register(taskPrefix + ".docker-ubi")); lifecyleTasks.put(DOCKER_UBI, project.getTasks().register(taskPrefix + ".docker-ubi"));
lifecyleTasks.put(Type.DOCKER_IRON_BANK, project.getTasks().register(taskPrefix + ".docker-ironbank")); lifecyleTasks.put(DOCKER_IRONBANK, project.getTasks().register(taskPrefix + ".docker-ironbank"));
lifecyleTasks.put(Type.ARCHIVE, project.getTasks().register(taskPrefix + ".archives")); lifecyleTasks.put(ARCHIVE, project.getTasks().register(taskPrefix + ".archives"));
lifecyleTasks.put(Type.DEB, project.getTasks().register(taskPrefix + ".packages")); lifecyleTasks.put(DEB, project.getTasks().register(taskPrefix + ".packages"));
lifecyleTasks.put(Type.RPM, lifecyleTasks.get(Type.DEB)); lifecyleTasks.put(RPM, lifecyleTasks.get(DEB));
return lifecyleTasks; return lifecyleTasks;
} }
@ -364,7 +371,7 @@ public class DistroTestPlugin implements Plugin<Project> {
List<ElasticsearchDistribution> currentDistros = new ArrayList<>(); List<ElasticsearchDistribution> currentDistros = new ArrayList<>();
for (Architecture architecture : Architecture.values()) { for (Architecture architecture : Architecture.values()) {
Arrays.stream(Type.values()).filter(t -> t != Type.INTEG_TEST_ZIP && t != Type.ARCHIVE).forEach(type -> { ALL_INTERNAL.stream().forEach(type -> {
for (boolean bundledJdk : Arrays.asList(true, false)) { for (boolean bundledJdk : Arrays.asList(true, false)) {
if (bundledJdk == false) { if (bundledJdk == false) {
// We'll never publish an ARM (aarch64) build without a bundled JDK. // We'll never publish an ARM (aarch64) build without a bundled JDK.
@ -393,7 +400,7 @@ public class DistroTestPlugin implements Plugin<Project> {
} }
currentDistros.add( currentDistros.add(
createDistro(distributions, architecture, Type.ARCHIVE, platform, bundledJdk, VersionProperties.getElasticsearch()) createDistro(distributions, architecture, ARCHIVE, platform, bundledJdk, VersionProperties.getElasticsearch())
); );
} }
} }
@ -405,7 +412,7 @@ public class DistroTestPlugin implements Plugin<Project> {
private static ElasticsearchDistribution createDistro( private static ElasticsearchDistribution createDistro(
NamedDomainObjectContainer<ElasticsearchDistribution> distributions, NamedDomainObjectContainer<ElasticsearchDistribution> distributions,
Architecture architecture, Architecture architecture,
Type type, ElasticsearchDistributionType type,
Platform platform, Platform platform,
boolean bundledJdk, boolean bundledJdk,
String version String version
@ -415,7 +422,7 @@ public class DistroTestPlugin implements Plugin<Project> {
ElasticsearchDistribution distro = distributions.create(name, d -> { ElasticsearchDistribution distro = distributions.create(name, d -> {
d.setArchitecture(architecture); d.setArchitecture(architecture);
d.setType(type); d.setType(type);
if (type == Type.ARCHIVE) { if (type == ARCHIVE) {
d.setPlatform(platform); d.setPlatform(platform);
} }
if (isDocker == false) { if (isDocker == false) {
@ -438,21 +445,21 @@ public class DistroTestPlugin implements Plugin<Project> {
return project.getName().contains("windows"); return project.getName().contains("windows");
} }
private static String distroId(Type type, Platform platform, boolean bundledJdk, Architecture architecture) { private static String distroId(ElasticsearchDistributionType type, Platform platform, boolean bundledJdk, Architecture architecture) {
return "default-" return "default-"
+ (type == Type.ARCHIVE ? platform + "-" : "") + (type == ARCHIVE ? platform + "-" : "")
+ type + type.getName()
+ (bundledJdk ? "" : "-no-jdk") + (bundledJdk ? "" : "-no-jdk")
+ (architecture == Architecture.X64 ? "" : "-" + architecture.toString().toLowerCase()); + (architecture == Architecture.X64 ? "" : "-" + architecture.toString().toLowerCase());
} }
private static String destructiveDistroTestTaskName(ElasticsearchDistribution distro) { private static String destructiveDistroTestTaskName(ElasticsearchDistribution distro) {
Type type = distro.getType(); ElasticsearchDistributionType type = distro.getType();
return "destructiveDistroTest." + distroId(type, distro.getPlatform(), distro.getBundledJdk(), distro.getArchitecture()); return "destructiveDistroTest." + distroId(type, distro.getPlatform(), distro.getBundledJdk(), distro.getArchitecture());
} }
private static String destructiveDistroUpgradeTestTaskName(ElasticsearchDistribution distro, String bwcVersion) { private static String destructiveDistroUpgradeTestTaskName(ElasticsearchDistribution distro, String bwcVersion) {
Type type = distro.getType(); ElasticsearchDistributionType type = distro.getType();
return "destructiveDistroUpgradeTest.v" return "destructiveDistroUpgradeTest.v"
+ bwcVersion + bwcVersion
+ "." + "."

View file

@ -9,12 +9,10 @@
package org.elasticsearch.gradle.internal.test; package org.elasticsearch.gradle.internal.test;
import org.elasticsearch.gradle.internal.BuildPlugin; import org.elasticsearch.gradle.internal.BuildPlugin;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin; import org.elasticsearch.gradle.internal.InternalTestClustersPlugin;
import org.gradle.api.Action;
import org.gradle.api.InvalidUserDataException; import org.gradle.api.InvalidUserDataException;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.plugins.JavaBasePlugin; import org.gradle.api.plugins.JavaBasePlugin;
import java.util.Arrays; import java.util.Arrays;
@ -37,17 +35,12 @@ public class RestTestPlugin implements Plugin<Project> {
); );
} }
project.getPlugins().apply(RestTestBasePlugin.class); project.getPlugins().apply(RestTestBasePlugin.class);
project.getPluginManager().apply(TestClustersPlugin.class); project.getPluginManager().apply(InternalTestClustersPlugin.class);
final var integTest = project.getTasks().register("integTest", RestIntegTestTask.class, task -> { final var integTest = project.getTasks().register("integTest", RestIntegTestTask.class, task -> {
task.setDescription("Runs rest tests against an elasticsearch cluster."); task.setDescription("Runs rest tests against an elasticsearch cluster.");
task.setGroup(JavaBasePlugin.VERIFICATION_GROUP); task.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
task.mustRunAfter(project.getTasks().named("precommit")); task.mustRunAfter(project.getTasks().named("precommit"));
}); });
project.getTasks().named("check").configure(new Action<Task>() { project.getTasks().named("check").configure(task -> task.dependsOn(integTest));
@Override
public void execute(Task task) {
task.dependsOn(integTest);
}
});
} }
} }

View file

@ -7,7 +7,7 @@
*/ */
package org.elasticsearch.gradle.internal.test.rest; package org.elasticsearch.gradle.internal.test.rest;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.file.ArchiveOperations; import org.gradle.api.file.ArchiveOperations;

View file

@ -7,7 +7,7 @@
*/ */
package org.elasticsearch.gradle.internal.test.rest; package org.elasticsearch.gradle.internal.test.rest;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.file.ArchiveOperations; import org.gradle.api.file.ArchiveOperations;

View file

@ -9,9 +9,9 @@
package org.elasticsearch.gradle.internal.test.rest; package org.elasticsearch.gradle.internal.test.rest;
import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin; import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin;
import org.elasticsearch.gradle.internal.InternalTestClustersPlugin;
import org.elasticsearch.gradle.internal.test.RestIntegTestTask; import org.elasticsearch.gradle.internal.test.RestIntegTestTask;
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin; import org.elasticsearch.gradle.internal.test.RestTestBasePlugin;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.GradleUtils; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -33,10 +33,9 @@ public class JavaRestTestPlugin implements Plugin<Project> {
@Override @Override
public void apply(Project project) { public void apply(Project project) {
project.getPluginManager().apply(ElasticsearchJavaPlugin.class); project.getPluginManager().apply(ElasticsearchJavaPlugin.class);
project.getPluginManager().apply(RestTestBasePlugin.class); project.getPluginManager().apply(RestTestBasePlugin.class);
project.getPluginManager().apply(TestClustersPlugin.class); project.getPluginManager().apply(InternalTestClustersPlugin.class);
// create source set // create source set
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class); SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);

View file

@ -7,7 +7,7 @@
*/ */
package org.elasticsearch.gradle.internal.test.rest; package org.elasticsearch.gradle.internal.test.rest;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;

View file

@ -8,7 +8,7 @@
package org.elasticsearch.gradle.internal.test.rest; package org.elasticsearch.gradle.internal.test.rest;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.test.RestIntegTestTask; import org.elasticsearch.gradle.internal.test.RestIntegTestTask;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster; import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
@ -51,7 +51,7 @@ public class RestTestUtil {
testTask.setTestClassesDirs(sourceSet.getOutput().getClassesDirs()); testTask.setTestClassesDirs(sourceSet.getOutput().getClassesDirs());
testTask.setClasspath(sourceSet.getRuntimeClasspath()); testTask.setClasspath(sourceSet.getRuntimeClasspath());
// if this a module or plugin, it may have an associated zip file with it's contents, add that to the test cluster // if this a module or plugin, it may have an associated zip file with it's contents, add that to the test cluster
project.getPluginManager().withPlugin("elasticsearch.esplugin", plugin -> { project.getPluginManager().withPlugin("elasticsearch.internal-es-plugin", plugin -> {
TaskProvider<Zip> bundle = project.getTasks().withType(Zip.class).named("bundlePlugin"); TaskProvider<Zip> bundle = project.getTasks().withType(Zip.class).named("bundlePlugin");
testTask.dependsOn(bundle); testTask.dependsOn(bundle);
if (GradleUtils.isModuleProject(project.getPath())) { if (GradleUtils.isModuleProject(project.getPath())) {

View file

@ -9,6 +9,7 @@
package org.elasticsearch.gradle.internal.vagrant; package org.elasticsearch.gradle.internal.vagrant;
import org.elasticsearch.gradle.ReaperPlugin; import org.elasticsearch.gradle.ReaperPlugin;
import org.elasticsearch.gradle.internal.InternalReaperPlugin;
import org.elasticsearch.gradle.util.GradleUtils; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -33,7 +34,7 @@ public class VagrantBasePlugin implements Plugin<Project> {
public void apply(Project project) { public void apply(Project project) {
project.getRootProject().getPluginManager().apply(VagrantSetupCheckerPlugin.class); project.getRootProject().getPluginManager().apply(VagrantSetupCheckerPlugin.class);
project.getRootProject().getPluginManager().apply(VagrantManagerPlugin.class); project.getRootProject().getPluginManager().apply(VagrantManagerPlugin.class);
project.getRootProject().getPluginManager().apply(ReaperPlugin.class); project.getRootProject().getPluginManager().apply(InternalReaperPlugin.class);
var reaperServiceProvider = GradleUtils.getBuildService(project.getGradle().getSharedServices(), ReaperPlugin.REAPER_SERVICE_NAME); var reaperServiceProvider = GradleUtils.getBuildService(project.getGradle().getSharedServices(), ReaperPlugin.REAPER_SERVICE_NAME);
var extension = project.getExtensions().create("vagrant", VagrantExtension.class, project); var extension = project.getExtensions().create("vagrant", VagrantExtension.class, project);

View file

@ -9,7 +9,7 @@
package org.elasticsearch.gradle.internal.vagrant; package org.elasticsearch.gradle.internal.vagrant;
import org.apache.commons.io.output.TeeOutputStream; import org.apache.commons.io.output.TeeOutputStream;
import org.elasticsearch.gradle.internal.LoggedExec; import org.elasticsearch.gradle.LoggedExec;
import org.elasticsearch.gradle.internal.LoggingOutputStream; import org.elasticsearch.gradle.internal.LoggingOutputStream;
import org.elasticsearch.gradle.ReaperService; import org.elasticsearch.gradle.ReaperService;
import org.elasticsearch.gradle.internal.util.Util; import org.elasticsearch.gradle.internal.util.Util;

View file

@ -12,19 +12,14 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin;
import groovy.lang.Closure; import groovy.lang.Closure;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.elasticsearch.gradle.internal.BuildPlugin;
import org.elasticsearch.gradle.NoticeTask;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin; import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin;
import org.elasticsearch.gradle.internal.info.BuildParams; import org.elasticsearch.gradle.precommit.PrecommitTasks;
import org.elasticsearch.gradle.internal.precommit.TestingConventionsTasks;
import org.elasticsearch.gradle.internal.test.RestTestBasePlugin;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster; import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.RunTask; import org.elasticsearch.gradle.testclusters.RunTask;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin; import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.GradleUtils; import org.elasticsearch.gradle.util.GradleUtils;
import org.elasticsearch.gradle.internal.util.Util;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.InvalidUserDataException; import org.gradle.api.InvalidUserDataException;
@ -35,6 +30,7 @@ import org.gradle.api.Task;
import org.gradle.api.Transformer; import org.gradle.api.Transformer;
import org.gradle.api.file.RegularFile; import org.gradle.api.file.RegularFile;
import org.gradle.api.plugins.BasePlugin; import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import org.gradle.api.publish.PublishingExtension; import org.gradle.api.publish.PublishingExtension;
@ -51,7 +47,6 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -60,15 +55,15 @@ import java.util.stream.Collectors;
public class PluginBuildPlugin implements Plugin<Project> { public class PluginBuildPlugin implements Plugin<Project> {
@Override @Override
public void apply(final Project project) { public void apply(final Project project) {
project.getPluginManager().apply(BuildPlugin.class); PrecommitTasks.create(project);
project.getPluginManager().apply(RestTestBasePlugin.class); project.getPluginManager().apply(JavaPlugin.class);
project.getPluginManager().apply(TestClustersPlugin.class);
project.getPluginManager().apply(CompileOnlyResolvePlugin.class); project.getPluginManager().apply(CompileOnlyResolvePlugin.class);
var extension = project.getExtensions().create(PLUGIN_EXTENSION_NAME, PluginPropertiesExtension.class, project); var extension = project.getExtensions().create(PLUGIN_EXTENSION_NAME, PluginPropertiesExtension.class, project);
configureDependencies(project); configureDependencies(project);
final var bundleTask = createBundleTasks(project, extension); final var bundleTask = createBundleTasks(project, extension);
project.afterEvaluate(project1 -> { project.afterEvaluate(project1 -> {
project1.getExtensions().getByType(PluginPropertiesExtension.class).getExtendedPlugins().forEach(pluginName -> { project1.getExtensions().getByType(PluginPropertiesExtension.class).getExtendedPlugins().forEach(pluginName -> {
// Auto add dependent modules to the test cluster // Auto add dependent modules to the test cluster
@ -112,54 +107,7 @@ public class PluginBuildPlugin implements Plugin<Project> {
copy.expand(map); copy.expand(map);
copy.getInputs().properties(map); copy.getInputs().properties(map);
}); });
BuildParams.withInternalBuild(() -> {
boolean isModule = GradleUtils.isModuleProject(project1.getPath());
boolean isXPackModule = isModule && project1.getPath().startsWith(":x-pack");
if (isModule == false || isXPackModule) {
addNoticeGeneration(project1, extension1);
}
});
}); });
BuildParams.withInternalBuild(() -> {
// We've ported this from multiple build scripts where we see this pattern into
// an extension method as a first step of consolidation.
// We might want to port this into a general pattern later on.
project.getExtensions()
.getExtraProperties()
.set("addQaCheckDependencies", new Closure<Object>(PluginBuildPlugin.this, PluginBuildPlugin.this) {
public void doCall(Object it) {
project.afterEvaluate(project1 -> {
// let check depend on check tasks of qa sub-projects
final var checkTaskProvider = project1.getTasks().named("check");
Optional<Project> qaSubproject = project1.getSubprojects()
.stream()
.filter(p -> p.getPath().equals(project1.getPath() + ":qa"))
.findFirst();
qaSubproject.ifPresent(
qa -> qa.getSubprojects()
.forEach(p -> checkTaskProvider.configure(task -> task.dependsOn(p.getPath() + ":check")))
);
});
}
public void doCall() {
doCall(null);
}
});
project.getTasks().withType(TestingConventionsTasks.class).named("testingConventions").configure(t -> {
t.getNaming().clear();
t.getNaming()
.create("Tests", testingConventionRule -> testingConventionRule.baseClass("org.apache.lucene.util.LuceneTestCase"));
t.getNaming().create("IT", testingConventionRule -> {
testingConventionRule.baseClass("org.elasticsearch.test.ESIntegTestCase");
testingConventionRule.baseClass("org.elasticsearch.test.rest.ESRestTestCase");
testingConventionRule.baseClass("org.elasticsearch.test.ESSingleNodeTestCase");
});
});
});
project.getConfigurations().getByName("default").extendsFrom(project.getConfigurations().getByName("runtimeClasspath")); project.getConfigurations().getByName("default").extendsFrom(project.getConfigurations().getByName("runtimeClasspath"));
// allow running ES with this plugin in the foreground of a build // allow running ES with this plugin in the foreground of a build
@ -193,13 +141,8 @@ public class PluginBuildPlugin implements Plugin<Project> {
private static void configureDependencies(final Project project) { private static void configureDependencies(final Project project) {
var dependencies = project.getDependencies(); var dependencies = project.getDependencies();
if (BuildParams.isInternal()) { dependencies.add("compileOnly", "org.elasticsearch:elasticsearch:" + VersionProperties.getElasticsearch());
dependencies.add("compileOnly", dependencies.project(Map.of("path", ":server"))); dependencies.add("testImplementation", "org.elasticsearch.test:framework:" + VersionProperties.getElasticsearch());
dependencies.add("testImplementation", dependencies.project(Map.of("path", ":test:framework")));
} else {
dependencies.add("compileOnly", "org.elasticsearch:elasticsearch:" + VersionProperties.getElasticsearch());
dependencies.add("testImplementation", "org.elasticsearch.test:framework:" + VersionProperties.getElasticsearch());
}
// we "upgrade" these optional deps to provided for plugins, since they will run // we "upgrade" these optional deps to provided for plugins, since they will run
// with a full elasticsearch server that includes optional deps // with a full elasticsearch server that includes optional deps
@ -296,28 +239,5 @@ public class PluginBuildPlugin implements Plugin<Project> {
return bundle; return bundle;
} }
/**
* Configure the pom for the main jar of this plugin
*/
protected static void addNoticeGeneration(final Project project, PluginPropertiesExtension extension) {
final var licenseFile = extension.getLicenseFile();
var tasks = project.getTasks();
if (licenseFile != null) {
tasks.withType(Zip.class).named("bundlePlugin").configure(zip -> zip.from(licenseFile.getParentFile(), copySpec -> {
copySpec.include(licenseFile.getName());
copySpec.rename(s -> "LICENSE.txt");
}));
}
final var noticeFile = extension.getNoticeFile();
if (noticeFile != null) {
final var generateNotice = tasks.register("generateNotice", NoticeTask.class, noticeTask -> {
noticeTask.setInputFile(noticeFile);
noticeTask.source(Util.getJavaMainSourceSet(project).get().getAllJava());
});
tasks.withType(Zip.class).named("bundlePlugin").configure(task -> task.from(generateNotice));
}
}
public static final String PLUGIN_EXTENSION_NAME = "esplugin"; public static final String PLUGIN_EXTENSION_NAME = "esplugin";
} }

View file

@ -8,7 +8,6 @@
package org.elasticsearch.gradle.precommit; package org.elasticsearch.gradle.precommit;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.util.Util; import org.elasticsearch.gradle.internal.util.Util;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.Task; import org.gradle.api.Task;
@ -20,12 +19,6 @@ public class JarHellPrecommitPlugin extends PrecommitPlugin {
@Override @Override
public TaskProvider<? extends Task> createTask(Project project) { public TaskProvider<? extends Task> createTask(Project project) {
Configuration jarHellConfig = project.getConfigurations().create("jarHell"); Configuration jarHellConfig = project.getConfigurations().create("jarHell");
if (BuildParams.isInternal() && project.getPath().equals(":libs:elasticsearch-core") == false) {
// ideally we would configure this as a default dependency. But Default dependencies do not work correctly
// with gradle project dependencies as they're resolved to late in the build and don't setup according task
// dependencies properly
project.getDependencies().add("jarHell", project.project(":libs:elasticsearch-core"));
}
TaskProvider<JarHellTask> jarHell = project.getTasks().register("jarHell", JarHellTask.class); TaskProvider<JarHellTask> jarHell = project.getTasks().register("jarHell", JarHellTask.class);
jarHell.configure(t -> { jarHell.configure(t -> {
SourceSet testSourceSet = Util.getJavaTestSourceSet(project).get(); SourceSet testSourceSet = Util.getJavaTestSourceSet(project).get();

View file

@ -8,7 +8,7 @@
package org.elasticsearch.gradle.precommit; package org.elasticsearch.gradle.precommit;
import org.elasticsearch.gradle.internal.LoggedExec; import org.elasticsearch.gradle.LoggedExec;
import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.CacheableTask; import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Classpath; import org.gradle.api.tasks.Classpath;

View file

@ -57,6 +57,7 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
private final FileSystemOperations fileSystemOperations; private final FileSystemOperations fileSystemOperations;
private final ArchiveOperations archiveOperations; private final ArchiveOperations archiveOperations;
private final ExecOperations execOperations; private final ExecOperations execOperations;
private final Provider<File> runtimeJava;
private int nodeIndex = 0; private int nodeIndex = 0;
public ElasticsearchCluster( public ElasticsearchCluster(
@ -67,7 +68,8 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
FileSystemOperations fileSystemOperations, FileSystemOperations fileSystemOperations,
ArchiveOperations archiveOperations, ArchiveOperations archiveOperations,
ExecOperations execOperations, ExecOperations execOperations,
File workingDirBase File workingDirBase,
Provider<File> runtimeJava
) { ) {
this.path = path; this.path = path;
this.clusterName = clusterName; this.clusterName = clusterName;
@ -77,6 +79,7 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
this.archiveOperations = archiveOperations; this.archiveOperations = archiveOperations;
this.execOperations = execOperations; this.execOperations = execOperations;
this.workingDirBase = workingDirBase; this.workingDirBase = workingDirBase;
this.runtimeJava = runtimeJava;
this.nodes = project.container(ElasticsearchNode.class); this.nodes = project.container(ElasticsearchNode.class);
this.nodes.add( this.nodes.add(
new ElasticsearchNode( new ElasticsearchNode(
@ -88,7 +91,8 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
fileSystemOperations, fileSystemOperations,
archiveOperations, archiveOperations,
execOperations, execOperations,
workingDirBase workingDirBase,
runtimeJava
) )
); );
@ -119,7 +123,8 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
fileSystemOperations, fileSystemOperations,
archiveOperations, archiveOperations,
execOperations, execOperations,
workingDirBase workingDirBase,
runtimeJava
) )
); );
} }

View file

@ -14,13 +14,13 @@ import org.elasticsearch.gradle.ElasticsearchDistribution;
import org.elasticsearch.gradle.FileSupplier; import org.elasticsearch.gradle.FileSupplier;
import org.elasticsearch.gradle.LazyPropertyList; import org.elasticsearch.gradle.LazyPropertyList;
import org.elasticsearch.gradle.LazyPropertyMap; import org.elasticsearch.gradle.LazyPropertyMap;
import org.elasticsearch.gradle.internal.LoggedExec; import org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes;
import org.elasticsearch.gradle.LoggedExec;
import org.elasticsearch.gradle.OS; import org.elasticsearch.gradle.OS;
import org.elasticsearch.gradle.PropertyNormalization; import org.elasticsearch.gradle.PropertyNormalization;
import org.elasticsearch.gradle.ReaperService; import org.elasticsearch.gradle.ReaperService;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.VersionProperties; import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.transform.UnzipTransform; import org.elasticsearch.gradle.transform.UnzipTransform;
import org.elasticsearch.gradle.util.Pair; import org.elasticsearch.gradle.util.Pair;
import org.gradle.api.Action; import org.gradle.api.Action;
@ -152,6 +152,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
private final Path esLogFile; private final Path esLogFile;
private final Path esStdinFile; private final Path esStdinFile;
private final Path tmpDir; private final Path tmpDir;
private final Provider<File> runtimeJava;
private int currentDistro = 0; private int currentDistro = 0;
private TestDistribution testDistribution; private TestDistribution testDistribution;
@ -176,7 +177,8 @@ public class ElasticsearchNode implements TestClusterConfiguration {
FileSystemOperations fileSystemOperations, FileSystemOperations fileSystemOperations,
ArchiveOperations archiveOperations, ArchiveOperations archiveOperations,
ExecOperations execOperations, ExecOperations execOperations,
File workingDirBase File workingDirBase,
Provider<File> runtimeJava
) { ) {
this.clusterName = clusterName; this.clusterName = clusterName;
this.path = path; this.path = path;
@ -186,6 +188,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
this.fileSystemOperations = fileSystemOperations; this.fileSystemOperations = fileSystemOperations;
this.archiveOperations = archiveOperations; this.archiveOperations = archiveOperations;
this.execOperations = execOperations; this.execOperations = execOperations;
this.runtimeJava = runtimeJava;
workingDir = workingDirBase.toPath().resolve(safeName(name)).toAbsolutePath(); workingDir = workingDirBase.toPath().resolve(safeName(name)).toAbsolutePath();
confPathRepo = workingDir.resolve("repo"); confPathRepo = workingDir.resolve("repo");
configFile = workingDir.resolve("config/elasticsearch.yml"); configFile = workingDir.resolve("config/elasticsearch.yml");
@ -269,12 +272,12 @@ public class ElasticsearchNode implements TestClusterConfiguration {
private void setDistributionType(ElasticsearchDistribution distribution, TestDistribution testDistribution) { private void setDistributionType(ElasticsearchDistribution distribution, TestDistribution testDistribution) {
if (testDistribution == TestDistribution.INTEG_TEST) { if (testDistribution == TestDistribution.INTEG_TEST) {
distribution.setType(ElasticsearchDistribution.Type.INTEG_TEST_ZIP); distribution.setType(ElasticsearchDistributionTypes.INTEG_TEST_ZIP);
// we change the underlying distribution when changing the test distribution of the cluster. // we change the underlying distribution when changing the test distribution of the cluster.
distribution.setPlatform(null); distribution.setPlatform(null);
distribution.setBundledJdk(null); distribution.setBundledJdk(null);
} else { } else {
distribution.setType(ElasticsearchDistribution.Type.ARCHIVE); distribution.setType(ElasticsearchDistributionTypes.ARCHIVE);
} }
} }
@ -762,7 +765,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
Map<String, String> defaultEnv = new HashMap<>(); Map<String, String> defaultEnv = new HashMap<>();
// If we are testing the current version of Elasticsearch, use the configured runtime Java, otherwise use the bundled JDK // If we are testing the current version of Elasticsearch, use the configured runtime Java, otherwise use the bundled JDK
if (getTestDistribution() == TestDistribution.INTEG_TEST || getVersion().equals(VersionProperties.getElasticsearchVersion())) { if (getTestDistribution() == TestDistribution.INTEG_TEST || getVersion().equals(VersionProperties.getElasticsearchVersion())) {
defaultEnv.put("ES_JAVA_HOME", BuildParams.getRuntimeJavaHome().getAbsolutePath()); defaultEnv.put("ES_JAVA_HOME", runtimeJava.get().getAbsolutePath());
} }
defaultEnv.put("ES_PATH_CONF", configFile.getParent().toString()); defaultEnv.put("ES_PATH_CONF", configFile.getParent().toString());
String systemPropertiesString = ""; String systemPropertiesString = "";

View file

@ -10,9 +10,6 @@ package org.elasticsearch.gradle.testclusters;
import org.elasticsearch.gradle.DistributionDownloadPlugin; import org.elasticsearch.gradle.DistributionDownloadPlugin;
import org.elasticsearch.gradle.ReaperPlugin; import org.elasticsearch.gradle.ReaperPlugin;
import org.elasticsearch.gradle.ReaperService; import org.elasticsearch.gradle.ReaperService;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.internal.InternalDistributionDownloadPlugin;
import org.elasticsearch.gradle.util.GradleUtils; import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
@ -26,7 +23,9 @@ import org.gradle.api.invocation.Gradle;
import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging; import org.gradle.api.logging.Logging;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.api.tasks.TaskState; import org.gradle.api.tasks.TaskState;
import org.gradle.internal.jvm.Jvm;
import org.gradle.process.ExecOperations; import org.gradle.process.ExecOperations;
import javax.inject.Inject; import javax.inject.Inject;
@ -42,6 +41,8 @@ public class TestClustersPlugin implements Plugin<Project> {
private static final String LIST_TASK_NAME = "listTestClusters"; private static final String LIST_TASK_NAME = "listTestClusters";
private static final String REGISTRY_SERVICE_NAME = "testClustersRegistry"; private static final String REGISTRY_SERVICE_NAME = "testClustersRegistry";
private static final Logger logger = Logging.getLogger(TestClustersPlugin.class); private static final Logger logger = Logging.getLogger(TestClustersPlugin.class);
private final ProviderFactory providerFactory;
private Provider<File> runtimeJavaProvider;
@Inject @Inject
protected FileSystemOperations getFileSystemOperations() { protected FileSystemOperations getFileSystemOperations() {
@ -58,16 +59,26 @@ public class TestClustersPlugin implements Plugin<Project> {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Inject
public TestClustersPlugin(ProviderFactory providerFactory) {
this.providerFactory = providerFactory;
}
public void setRuntimeJava(Provider<File> runtimeJava) {
this.runtimeJavaProvider = runtimeJava;
}
@Override @Override
public void apply(Project project) { public void apply(Project project) {
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class); project.getPlugins().apply(DistributionDownloadPlugin.class);
BuildParams.withInternalBuild(() -> project.getPlugins().apply(InternalDistributionDownloadPlugin.class))
.orElse(() -> project.getPlugins().apply(DistributionDownloadPlugin.class));
project.getRootProject().getPluginManager().apply(ReaperPlugin.class); project.getRootProject().getPluginManager().apply(ReaperPlugin.class);
Provider<ReaperService> reaperServiceProvider = GradleUtils.getBuildService( Provider<ReaperService> reaperServiceProvider = GradleUtils.getBuildService(
project.getGradle().getSharedServices(), project.getGradle().getSharedServices(),
ReaperPlugin.REAPER_SERVICE_NAME ReaperPlugin.REAPER_SERVICE_NAME
); );
runtimeJavaProvider = providerFactory.provider(
() -> System.getenv("RUNTIME_JAVA_HOME") == null ? Jvm.current().getJavaHome() : new File(System.getenv("RUNTIME_JAVA_HOME"))
);
// enable the DSL to describe clusters // enable the DSL to describe clusters
NamedDomainObjectContainer<ElasticsearchCluster> container = createTestClustersContainerExtension(project, reaperServiceProvider); NamedDomainObjectContainer<ElasticsearchCluster> container = createTestClustersContainerExtension(project, reaperServiceProvider);
@ -95,9 +106,8 @@ public class TestClustersPlugin implements Plugin<Project> {
Provider<ReaperService> reaper Provider<ReaperService> reaper
) { ) {
// Create an extensions that allows describing clusters // Create an extensions that allows describing clusters
NamedDomainObjectContainer<ElasticsearchCluster> container = project.container( NamedDomainObjectContainer<ElasticsearchCluster> container = project.container(ElasticsearchCluster.class, name -> {
ElasticsearchCluster.class, return new ElasticsearchCluster(
name -> new ElasticsearchCluster(
project.getPath(), project.getPath(),
name, name,
project, project,
@ -105,9 +115,10 @@ public class TestClustersPlugin implements Plugin<Project> {
getFileSystemOperations(), getFileSystemOperations(),
getArchiveOperations(), getArchiveOperations(),
getExecOperations(), getExecOperations(),
new File(project.getBuildDir(), "testclusters") new File(project.getBuildDir(), "testclusters"),
) runtimeJavaProvider
); );
});
project.getExtensions().add(EXTENSION_NAME, container); project.getExtensions().add(EXTENSION_NAME, container);
return container; return container;
} }

View file

@ -13,5 +13,4 @@ package org.elasticsearch.gradle.testclusters;
public enum TestDistribution { public enum TestDistribution {
INTEG_TEST, INTEG_TEST,
DEFAULT, DEFAULT,
OSS
} }

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.BuildPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.DistributionDownloadPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.DistroTestPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.docker.DockerSupportPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.doc.DocsTestPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.plugin.PluginBuildPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin

View file

@ -1,10 +0,0 @@
#
# 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.
#
# needed for testkit testing
implementation-class=org.elasticsearch.gradle.internal.InternalAvailableTcpPortProviderPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.InternalClusterTestPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalDistributionArchiveCheckPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalDistributionArchiveSetupPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalDistributionBwcSetupPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalDistributionDownloadPlugin

View file

@ -1,10 +0,0 @@
#
# 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.
#
# needed for testkit testing
implementation-class=org.elasticsearch.gradle.internal.precommit.LicenseHeadersPrecommitPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalTestArtifactBasePlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.InternalTestArtifactPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.test.rerun.TestRerunPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.rest.JavaRestTestPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.JdkDownloadPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.PublishPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.ReaperPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.RepositoriesSetupPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.rest.RestResourcesPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.test.RestTestPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.StandaloneRestTestPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.StandaloneTestPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.ElasticsearchTestBasePlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.TestWithDependenciesPlugin

View file

@ -1,9 +0,0 @@
#
# 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.
#
implementation-class=org.elasticsearch.gradle.internal.test.TestWithSslPlugin

View file

@ -1 +0,0 @@
implementation-class=org.elasticsearch.gradle.internal.testfixtures.TestFixturesPlugin

Some files were not shown because too many files have changed in this diff Show more