Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT

where:
buildTaskName | expectedOutputArchivePath
"buildDarwinZip" | "darwin-zip/build/distributions/elasticsearch.zip"
"buildOssDarwinZip" | "oss-darwin-zip/build/distributions/elasticsearch-oss.zip"
}

Expand Down Expand Up @@ -139,8 +138,8 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT
then: "tar task executed and target folder contains plain tar"
result.task(':buildProducerTar').outcome == TaskOutcome.SUCCESS
result.task(':consumer:copyArchive').outcome == TaskOutcome.SUCCESS
file("producer-tar/build/distributions/elasticsearch.tar.gz").exists()
file("consumer/build/archives/elasticsearch.tar.gz").exists()
file("producer-tar/build/distributions/elasticsearch-oss.tar.gz").exists()
file("consumer/build/archives/elasticsearch-oss.tar.gz").exists()

when:
result = gradleRunner("copyDir", "-Pversion=1.0").build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subprojects {
tasks.register('tar', Tar) {
from('.')
destinationDirectory.set(file('build/distributions'))
archiveBaseName.set("elasticsearch${project.name.startsWith('oss')?'-oss':''}")
archiveBaseName.set("elasticsearch-oss")
archiveVersion.set("8.0.1-SNAPSHOT")
archiveClassifier.set("darwin-x86_64")
archiveExtension.set('tar.gz')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@

include ":distribution:bwc:bugfix"
include ":distribution:bwc:minor"
include ":distribution:archives:darwin-tar"
include ":distribution:archives:oss-darwin-tar"
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider

/**
* Sets up tests for documentation.
Expand All @@ -37,9 +35,6 @@ class DocsTestPlugin implements Plugin<Project> {
project.pluginManager.apply('elasticsearch.standalone-rest-test')
project.pluginManager.apply('elasticsearch.rest-test')

String distribution = System.getProperty('tests.distribution', 'default')
// The distribution can be configured with -Dtests.distribution on the command line
project.testClusters.integTest.testDistribution = distribution.toUpperCase()
project.testClusters.integTest.nameCustomization = { it.replace("integTest", "node") }
// Docs are published separately so no need to assemble
project.tasks.assemble.enabled = false
Expand All @@ -51,7 +46,6 @@ class DocsTestPlugin implements Plugin<Project> {
'\\{version\\}': Version.fromString(VersionProperties.elasticsearch).toString(),
'\\{version_qualified\\}': VersionProperties.elasticsearch,
'\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''),
'\\{build_flavor\\}' : distribution,
'\\{build_type\\}' : OS.conditionalString().onWindows({"zip"}).onUnix({"tar"}).supply(),
]
project.tasks.register('listSnippets', SnippetsTask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,35 +193,20 @@ class ClusterFormationTasks {
}
return
}
// TEMP HACK
// The oss docs CI build overrides the distro on the command line. This hack handles backcompat until CI is updated.
if (distro.equals('oss-zip')) {
distro = 'oss'
}
if (distro.equals('zip')) {
distro = 'default'
}
// END TEMP HACK
if (['oss', 'default'].contains(distro) == false) {
throw new GradleException("Unknown distribution: ${distro} in project ${project.path}")
}
distro = 'oss'

Version version = Version.fromString(elasticsearchVersion)
String os = getOs()
String classifier = "-${os}-x86_64"
String packaging = os.equals('windows') ? 'zip' : 'tar.gz'
String artifactName = 'elasticsearch'
if (distro.equals('oss') && Version.fromString(elasticsearchVersion).onOrAfter('6.3.0')) {
artifactName += '-oss'
}
String artifactName = 'elasticsearch-oss'
Object dependency
String snapshotProject = "${os}-${os.equals('windows') ? 'zip' : 'tar'}"
if (version.before("7.0.0")) {
snapshotProject = "zip"
packaging = "zip"
}
if (distro.equals("oss")) {
snapshotProject = "oss-" + snapshotProject
}
snapshotProject = "oss-" + snapshotProject

BwcVersions.UnreleasedVersionInfo unreleasedInfo = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.gradle;

import org.elasticsearch.gradle.ElasticsearchDistribution.Flavor;
import org.elasticsearch.gradle.ElasticsearchDistribution.Platform;
import org.elasticsearch.gradle.ElasticsearchDistribution.Type;
import org.elasticsearch.gradle.docker.DockerSupportPlugin;
Expand All @@ -38,7 +37,6 @@
import org.gradle.api.provider.Provider;

import java.util.Comparator;
import static org.elasticsearch.gradle.util.Util.capitalize;

/**
* A plugin to manage getting and extracting distributions of Elasticsearch.
Expand Down Expand Up @@ -193,43 +191,8 @@ private String dependencyNotation(ElasticsearchDistribution distribution) {
} else if (distribution.getType() == Type.RPM && distroVersion.before("7.0.0")) {
classifier = "";
}
String flavor = "";
if (distribution.getFlavor() == Flavor.OSS && distroVersion.onOrAfter("6.3.0")) {
flavor = "-oss";
}

String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP;
return group + ":elasticsearch" + flavor + ":" + distribution.getVersion() + classifier + "@" + extension;
}

private static String configName(String prefix, ElasticsearchDistribution distribution) {
return String.format(
"%s_%s_%s_%s%s%s",
prefix,
distribution.getVersion(),
distribution.getType(),
distribution.getPlatform() == null ? "" : distribution.getPlatform() + "_",
distribution.getFlavor(),
distribution.getBundledJdk() ? "" : "_nojdk"
);
}

private static String extractTaskName(ElasticsearchDistribution distribution) {
String taskName = "extractElasticsearch";
if (distribution.getType() != Type.INTEG_TEST_ZIP) {
if (distribution.getFlavor() == Flavor.OSS) {
taskName += "Oss";
}
if (distribution.getBundledJdk() == false) {
taskName += "NoJdk";
}
}
if (distribution.getType() == Type.ARCHIVE) {
taskName += capitalize(distribution.getPlatform().toString());
} else if (distribution.getType() != Type.INTEG_TEST_ZIP) {
taskName += capitalize(distribution.getType().toString());
}
taskName += distribution.getVersion();
return taskName;
return group + ":elasticsearch-oss" + ":" + distribution.getVersion() + classifier + "@" + extension;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ public boolean shouldExtract() {
}
}

public enum Flavor {
OSS;

@Override
public String toString() {
return super.toString().toLowerCase(Locale.ROOT);
}
}

// package private to tests can use
public static final Platform CURRENT_PLATFORM = OS.<Platform>conditional()
.onLinux(() -> Platform.LINUX)
Expand All @@ -98,7 +89,6 @@ public String toString() {
private final Property<String> version;
private final Property<Type> type;
private final Property<Platform> platform;
private final Property<Flavor> flavor;
private final Property<Boolean> bundledJdk;
private final Property<Boolean> failIfUnavailable;
private final Configuration extracted;
Expand All @@ -118,7 +108,6 @@ public String toString() {
this.type = objectFactory.property(Type.class);
this.type.convention(Type.ARCHIVE);
this.platform = objectFactory.property(Platform.class);
this.flavor = objectFactory.property(Flavor.class);
this.bundledJdk = objectFactory.property(Boolean.class);
this.failIfUnavailable = objectFactory.property(Boolean.class).convention(true);
this.extracted = extractedConfiguration;
Expand Down Expand Up @@ -153,14 +142,6 @@ public void setType(Type type) {
this.type.set(type);
}

public Flavor getFlavor() {
return flavor.getOrNull();
}

public void setFlavor(Flavor flavor) {
this.flavor.set(flavor);
}

public boolean getBundledJdk() {
return bundledJdk.getOrElse(true);
}
Expand Down Expand Up @@ -238,11 +219,7 @@ void finalizeValues() {
"platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
);
}
if (flavor.getOrNull() != null) {
throw new IllegalArgumentException(
"flavor [" + flavor.get() + "] not allowed for elasticsearch distribution [" + name + "] of type [integ_test_zip]"
);
}

if (bundledJdk.getOrNull() != null) {
throw new IllegalArgumentException(
"bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
Expand Down Expand Up @@ -274,23 +251,19 @@ void finalizeValues() {
"bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type " + "[docker]"
);
}
if (flavor.get() == Flavor.OSS && type.get() == Type.DOCKER_UBI) {
if (type.get() == Type.DOCKER_UBI) {
throw new IllegalArgumentException("Cannot build a UBI docker image for the OSS distribution");
}
}
}

if (flavor.isPresent() == false) {
flavor.set(Flavor.OSS);
}
if (bundledJdk.isPresent() == false) {
bundledJdk.set(true);
}

version.finalizeValue();
platform.finalizeValue();
type.finalizeValue();
flavor.finalizeValue();
bundledJdk.finalizeValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void configureGeneralTaskDefaults(Project project) {
project.getTasks().withType(AbstractArchiveTask.class).configureEach(t -> {
String subdir = archiveTaskToSubprojectName(t.getName());
t.getDestinationDirectory().set(project.file(subdir + "/build/distributions"));
t.getArchiveBaseName().set(subdir.contains("oss") ? "elasticsearch-oss" : "elasticsearch");
t.getArchiveBaseName().set("elasticsearch-oss");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ private static String distributionProjectName(ElasticsearchDistribution distribu
? ""
: "-" + architecture.toString().toLowerCase();

if (distribution.getFlavor() == ElasticsearchDistribution.Flavor.OSS) {
projectName += "oss-";
}
projectName += "oss-";

if (distribution.getBundledJdk() == false) {
projectName += "no-jdk-";
Expand Down
Loading