[Rename] buildSrc directory, build-tools module (#182)

This PR refactors the build-tools module as part of the Elasticsearch to OpenSearch renaming effort.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
This commit is contained in:
Rabi Panda 2021-03-09 17:10:41 -08:00 committed by Nick Knize
parent 3eee5183d1
commit ad8ecf08dc
289 changed files with 1222 additions and 1237 deletions

View File

@ -26,11 +26,11 @@ plugins {
id 'java-test-fixtures'
}
group = 'org.elasticsearch.gradle'
group = 'org.opensearch.gradle'
String minimumGradleVersion = file('src/main/resources/minimumGradleVersion').text.trim()
if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion)) {
throw new GradleException("Gradle ${minimumGradleVersion}+ is required to build elasticsearch")
throw new GradleException("Gradle ${minimumGradleVersion}+ is required to build opensearch")
}
if (project == rootProject) {
@ -47,7 +47,7 @@ if (project == rootProject) {
// we write this back out below to load it in the Build.java which will be shown in rest main action
// to indicate this being a snapshot build or a release build.
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
version = props.getProperty("elasticsearch")
version = props.getProperty("opensearch")
def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
outputFile = "${buildDir}/version.properties"
@ -64,7 +64,7 @@ processResources {
*****************************************************************************/
if (JavaVersion.current() < JavaVersion.VERSION_11) {
throw new GradleException('At least Java 11 is required to build elasticsearch gradle tools')
throw new GradleException('At least Java 11 is required to build opensearch gradle tools')
}
sourceSets {
@ -142,8 +142,8 @@ if (project == rootProject) {
// this happens when included as a normal project in the build, which we do
// to enforce precommit checks like forbidden apis, as well as setup publishing
if (project != rootProject) {
apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.publish'
apply plugin: 'opensearch.build'
apply plugin: 'opensearch.publish'
allprojects {
targetCompatibility = 10
@ -159,7 +159,7 @@ if (project != rootProject) {
disableTasks('forbiddenApisMain', 'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
jarHell.enabled = false
thirdPartyAudit.enabled = false
if (org.elasticsearch.gradle.info.BuildParams.inFipsJvm) {
if (org.opensearch.gradle.info.BuildParams.inFipsJvm) {
// We don't support running gradle with a JVM that is in FIPS 140 mode, so we don't test it.
// WaitForHttpResourceTests tests would fail as they use JKS/PKCS12 keystores
test.enabled = false
@ -176,10 +176,10 @@ if (project != rootProject) {
distribution project(':distribution:archives:oss-linux-tar')
distribution project(':distribution:archives:oss-linux-aarch64-tar')
integTestRuntimeOnly(project(":libs:elasticsearch-core"))
integTestRuntimeOnly(project(":libs:opensearch-core"))
}
// for external projects we want to remove the marker file indicating we are running the Elasticsearch project
// for external projects we want to remove the marker file indicating we are running the OpenSearch project
processResources {
exclude 'buildSrc.marker'
into('META-INF') {
@ -213,10 +213,10 @@ if (project != rootProject) {
naming.clear()
naming {
Tests {
baseClass 'org.elasticsearch.gradle.test.GradleUnitTestCase'
baseClass 'org.opensearch.gradle.test.GradleUnitTestCase'
}
IT {
baseClass 'org.elasticsearch.gradle.test.GradleIntegrationTestCase'
baseClass 'org.opensearch.gradle.test.GradleIntegrationTestCase'
}
}
}
@ -224,8 +224,8 @@ if (project != rootProject) {
tasks.register("integTest", Test) {
inputs.dir(file("src/testKit")).withPropertyName("testkit dir").withPathSensitivity(PathSensitivity.RELATIVE)
systemProperty 'test.version_under_test', version
onlyIf { org.elasticsearch.gradle.info.BuildParams.inFipsJvm == false }
maxParallelForks = System.getProperty('tests.jvms', org.elasticsearch.gradle.info.BuildParams.defaultParallel.toString()) as Integer
onlyIf { org.opensearch.gradle.info.BuildParams.inFipsJvm == false }
maxParallelForks = System.getProperty('tests.jvms', org.opensearch.gradle.info.BuildParams.defaultParallel.toString()) as Integer
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath
}
@ -265,14 +265,14 @@ class VersionPropertiesLoader {
}
protected static void loadBuildSrcVersion(Properties loadedProps, Properties systemProperties) {
String elasticsearch = loadedProps.getProperty("elasticsearch")
if (elasticsearch == null) {
throw new IllegalStateException("Elasticsearch version is missing from properties.")
String opensearch = loadedProps.getProperty("opensearch")
if (opensearch == null) {
throw new IllegalStateException("OpenSearch version is missing from properties.")
}
if (elasticsearch.matches("[0-9]+\\.[0-9]+\\.[0-9]+") == false) {
if (opensearch.matches("[0-9]+\\.[0-9]+\\.[0-9]+") == false) {
throw new IllegalStateException(
"Expected elasticsearch version to be numbers only of the form X.Y.Z but it was: " +
elasticsearch
"Expected opensearch version to be numbers only of the form X.Y.Z but it was: " +
opensearch
)
}
String qualifier = systemProperties.getProperty("build.version_qualifier", "");
@ -280,12 +280,12 @@ class VersionPropertiesLoader {
if (qualifier.matches("(alpha|beta|rc)\\d+") == false) {
throw new IllegalStateException("Invalid qualifier: " + qualifier)
}
elasticsearch += "-" + qualifier
opensearch += "-" + qualifier
}
final String buildSnapshotSystemProperty = systemProperties.getProperty("build.snapshot", "true");
switch (buildSnapshotSystemProperty) {
case "true":
elasticsearch += "-SNAPSHOT"
opensearch += "-SNAPSHOT"
break;
case "false":
// do nothing
@ -294,6 +294,6 @@ class VersionPropertiesLoader {
throw new IllegalArgumentException(
"build.snapshot was set to [" + buildSnapshotSystemProperty + "] but can only be unset or [true|false]");
}
loadedProps.put("elasticsearch", elasticsearch)
loadedProps.put("opensearch", opensearch)
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="17">
<profile kind="CodeFormatterProfile" name="Elasticsearch" version="17">
<profile kind="CodeFormatterProfile" name="OpenSearch" version="17">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>

View File

@ -3,6 +3,6 @@ apply plugin: 'java'
jar {
archiveFileName = "${project.name}.jar"
manifest {
attributes 'Main-Class': 'org.elasticsearch.gradle.reaper.Reaper'
attributes 'Main-Class': 'org.opensearch.gradle.reaper.Reaper'
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.reaper;
package org.opensearch.gradle.reaper;
import java.io.Closeable;
import java.io.IOException;

View File

@ -17,14 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.transform.SymbolicLinkPreservingUntarTransform
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Unroll
import static org.elasticsearch.gradle.fixtures.DistributionDownloadFixture.withMockedDistributionDownload
import static org.opensearch.gradle.fixtures.DistributionDownloadFixture.withMockedDistributionDownload
class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
@ -44,16 +45,16 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
where:
version | platform | distType
VersionProperties.getElasticsearch() | ElasticsearchDistribution.Platform.LINUX | "current"
"8.1.0-SNAPSHOT" | ElasticsearchDistribution.Platform.LINUX | "bwc"
"7.0.0" | ElasticsearchDistribution.Platform.WINDOWS | "released"
VersionProperties.getOpenSearch() | OpenSearchDistribution.Platform.LINUX | "current"
"8.1.0-SNAPSHOT" | OpenSearchDistribution.Platform.LINUX | "bwc"
"7.0.0" | OpenSearchDistribution.Platform.WINDOWS | "released"
}
def "transformed versions are kept across builds"() {
given:
def version = VersionProperties.getElasticsearch()
def platform = ElasticsearchDistribution.Platform.LINUX
def version = VersionProperties.getOpenSearch()
def platform = OpenSearchDistribution.Platform.LINUX
buildFile << applyPluginAndSetupDistro(version, platform)
buildFile << """
@ -76,8 +77,8 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
def "transforms are reused across projects"() {
given:
def version = VersionProperties.getElasticsearch()
def platform = ElasticsearchDistribution.Platform.LINUX
def version = VersionProperties.getOpenSearch()
def platform = OpenSearchDistribution.Platform.LINUX
3.times {
settingsFile << """
@ -85,15 +86,15 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
"""
}
buildFile.text = """
import org.elasticsearch.gradle.Architecture
import org.opensearch.gradle.Architecture
plugins {
id 'elasticsearch.distribution-download'
id 'opensearch.distribution-download'
}
subprojects {
apply plugin: 'elasticsearch.distribution-download'
apply plugin: 'opensearch.distribution-download'
${setupTestDistro(version, platform)}
${setupDistroTask()}
}
@ -108,7 +109,7 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
then:
result.tasks.size() == 3
result.output.count("Unpacking elasticsearch-oss-${version}-linux-x86_64.tar.gz " +
result.output.count("Unpacking opensearch-oss-${version}-linux-x86_64.tar.gz " +
"using SymbolicLinkPreservingUntarTransform.") == 1
}
@ -116,27 +117,27 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
File distroExtracted = new File(testProjectDir.root, relativePath)
assert distroExtracted.exists()
assert distroExtracted.isDirectory()
assert new File(distroExtracted, "elasticsearch-1.2.3/bin/elasticsearch").exists()
assert new File(distroExtracted, "opensearch-1.2.3/bin/opensearch").exists()
true
}
private static String applyPluginAndSetupDistro(String version, ElasticsearchDistribution.Platform platform) {
private static String applyPluginAndSetupDistro(String version, OpenSearchDistribution.Platform platform) {
"""
import org.elasticsearch.gradle.Architecture
import org.opensearch.gradle.Architecture
plugins {
id 'elasticsearch.distribution-download'
id 'opensearch.distribution-download'
}
${setupTestDistro(version, platform)}
${setupDistroTask()}
"""
}
private static String setupTestDistro(String version, ElasticsearchDistribution.Platform platform) {
private static String setupTestDistro(String version, OpenSearchDistribution.Platform platform) {
return """
elasticsearch_distributions {
opensearch_distributions {
test_distro {
version = "$version"
type = "archive"
@ -150,7 +151,7 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest {
private static String setupDistroTask() {
return """
tasks.register("setupDistro", Sync) {
from(elasticsearch_distributions.test_distro.extracted)
from(opensearch_distributions.test_distro.extracted)
into("build/distro")
}
"""

View File

@ -17,13 +17,13 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import com.github.tomakehurst.wiremock.WireMockServer
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.elasticsearch.gradle.fixtures.WiremockFixture
import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform
import org.elasticsearch.gradle.transform.UnzipTransform
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.transform.SymbolicLinkPreservingUntarTransform
import org.opensearch.gradle.transform.UnzipTransform
import org.opensearch.gradle.fixtures.WiremockFixture
import spock.lang.Unroll
import java.nio.file.Files
@ -32,8 +32,8 @@ import java.nio.file.Paths
import java.util.regex.Matcher
import java.util.regex.Pattern
import static org.elasticsearch.gradle.JdkDownloadPlugin.VENDOR_ADOPTOPENJDK
import static org.elasticsearch.gradle.JdkDownloadPlugin.VENDOR_OPENJDK
import static JdkDownloadPlugin.VENDOR_ADOPTOPENJDK
import static JdkDownloadPlugin.VENDOR_OPENJDK
class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
@ -49,9 +49,9 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
def mockedContent = filebytes(jdkVendor, platform)
buildFile.text = """
plugins {
id 'elasticsearch.jdk-download'
id 'opensearch.jdk-download'
}
jdks {
myJdk {
vendor = '$jdkVendor'
@ -104,12 +104,12 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
}
buildFile.text = """
plugins {
id 'elasticsearch.jdk-download' apply false
id 'opensearch.jdk-download' apply false
}
subprojects {
apply plugin: 'elasticsearch.jdk-download'
apply plugin: 'opensearch.jdk-download'
jdks {
myJdk {
vendor = '$jdkVendor'
@ -149,10 +149,10 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
def mockedContent = filebytes(VENDOR_ADOPTOPENJDK, platform)
buildFile.text = """
plugins {
id 'elasticsearch.jdk-download'
id 'opensearch.jdk-download'
}
apply plugin: 'base'
apply plugin: 'elasticsearch.jdk-download'
apply plugin: 'opensearch.jdk-download'
jdks {
myJdk {
@ -162,7 +162,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
architecture = "x64"
}
}
tasks.register("getJdk") {
dependsOn jdks.myJdk
doLast {

View File

@ -17,26 +17,26 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
class ElasticsearchJavaPluginFuncTest extends AbstractGradleFuncTest {
class OpenSearchJavaPluginFuncTest extends AbstractGradleFuncTest {
def "compatibility options are resolved from from build params minimum runtime version"() {
when:
buildFile.text = """
plugins {
id 'elasticsearch.global-build-info'
id 'opensearch.global-build-info'
}
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.Architecture
import org.opensearch.gradle.info.BuildParams
BuildParams.init { it.setMinimumRuntimeVersion(JavaVersion.VERSION_1_10) }
apply plugin:'elasticsearch.java'
apply plugin:'opensearch.java'
assert compileJava.sourceCompatibility == JavaVersion.VERSION_1_10.toString()
assert compileJava.targetCompatibility == JavaVersion.VERSION_1_10.toString()
assert compileJava.sourceCompatibility == JavaVersion.VERSION_1_10.toString()
assert compileJava.targetCompatibility == JavaVersion.VERSION_1_10.toString()
"""
then:
@ -47,9 +47,9 @@ class ElasticsearchJavaPluginFuncTest extends AbstractGradleFuncTest {
when:
buildFile.text = """
plugins {
id 'elasticsearch.java'
id 'opensearch.java'
}
compileJava.targetCompatibility = "1.10"
afterEvaluate {
assert compileJava.options.release.get() == 10

View File

@ -17,19 +17,19 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
class OpenSearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
def "can configure nonInputProperties for test tasks"() {
given:
file("src/test/java/acme/SomeTests.java").text = """
public class SomeTests {
@org.junit.Test
@org.junit.Test
public void testSysInput() {
org.junit.Assert.assertEquals("bar", System.getProperty("foo"));
}
@ -39,17 +39,17 @@ class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
buildFile.text = """
plugins {
id 'java'
id 'elasticsearch.test-base'
id 'opensearch.test-base'
}
repositories {
jcenter()
}
}
dependencies {
testImplementation 'junit:junit:4.12'
}
}
tasks.named('test').configure {
nonInputProperties.systemProperty("foo", project.getProperty('foo'))
}
@ -67,4 +67,4 @@ class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
then:
result.task(':test').outcome == TaskOutcome.UP_TO_DATE
}
}
}

View File

@ -17,15 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.GradleRunner
import spock.lang.IgnoreIf
import spock.lang.Requires
import spock.util.environment.OperatingSystem
import static org.elasticsearch.gradle.fixtures.DistributionDownloadFixture.withMockedDistributionDownload
import static org.opensearch.gradle.fixtures.DistributionDownloadFixture.withMockedDistributionDownload
/**
* We do not have coverage for the test cluster startup on windows yet.
@ -36,9 +36,9 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
def setup() {
buildFile << """
import org.elasticsearch.gradle.testclusters.DefaultTestClustersTask
import org.opensearch.gradle.testclusters.DefaultTestClustersTask
plugins {
id 'elasticsearch.testclusters'
id 'opensearch.testclusters'
}
class SomeClusterAwareTask extends DefaultTestClustersTask {
@ -57,7 +57,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
testDistribution = 'default'
}
}
tasks.register('myTask', SomeClusterAwareTask) {
useCluster testClusters.myCluster
}
@ -69,8 +69,8 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
}
then:
result.output.contains("elasticsearch-keystore script executed!")
assertEsStdoutContains("myCluster", "Starting Elasticsearch process")
result.output.contains("opensearch-keystore script executed!")
assertEsStdoutContains("myCluster", "Starting OpenSearch process")
assertEsStdoutContains("myCluster", "Stopping node")
assertNoCustomDistro('myCluster')
}
@ -84,7 +84,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
extraJarFile(file('${someJar().absolutePath}'))
}
}
tasks.register('myTask', SomeClusterAwareTask) {
useCluster testClusters.myCluster
}
@ -96,8 +96,8 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
}
then:
result.output.contains("elasticsearch-keystore script executed!")
assertEsStdoutContains("myCluster", "Starting Elasticsearch process")
result.output.contains("opensearch-keystore script executed!")
assertEsStdoutContains("myCluster", "Starting OpenSearch process")
assertEsStdoutContains("myCluster", "Stopping node")
assertCustomDistro('myCluster')
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.fixtures
package org.opensearch.gradle.fixtures
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
@ -92,15 +92,15 @@ abstract class AbstractGradleFuncTest extends Specification {
File internalBuild(File buildScript = buildFile) {
buildScript << """plugins {
id 'elasticsearch.global-build-info'
id 'opensearch.global-build-info'
}
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.Architecture
import org.opensearch.gradle.info.BuildParams
BuildParams.init { it.setIsInternal(true) }
import org.elasticsearch.gradle.BwcVersions
import org.elasticsearch.gradle.Version
import org.opensearch.gradle.BwcVersions
import org.opensearch.gradle.Version
Version currentVersion = Version.fromString("9.0.0")
BwcVersions versions = new BwcVersions(new TreeSet<>(

View File

@ -17,10 +17,11 @@
* under the License.
*/
package org.elasticsearch.gradle.fixtures
package org.opensearch.gradle.fixtures
import org.elasticsearch.gradle.ElasticsearchDistribution
import org.elasticsearch.gradle.VersionProperties
import org.opensearch.gradle.OpenSearchDistribution
import org.opensearch.gradle.VersionProperties
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
@ -29,11 +30,11 @@ class DistributionDownloadFixture {
public static final String INIT_SCRIPT = "repositories-init.gradle"
static BuildResult withMockedDistributionDownload(GradleRunner gradleRunner, Closure<BuildResult> buildRunClosure) {
return withMockedDistributionDownload(VersionProperties.getElasticsearch(), ElasticsearchDistribution.CURRENT_PLATFORM,
return withMockedDistributionDownload(VersionProperties.getOpenSearch(), OpenSearchDistribution.CURRENT_PLATFORM,
gradleRunner, buildRunClosure)
}
static BuildResult withMockedDistributionDownload(String version, ElasticsearchDistribution.Platform platform,
static BuildResult withMockedDistributionDownload(String version, OpenSearchDistribution.Platform platform,
GradleRunner gradleRunner, Closure<BuildResult> buildRunClosure) {
String urlPath = urlPath(version, platform);
return WiremockFixture.withWireMock(urlPath, filebytes(urlPath)) { server ->
@ -51,14 +52,14 @@ class DistributionDownloadFixture {
}
}
private static String urlPath(String version,ElasticsearchDistribution.Platform platform) {
String fileType = ((platform == ElasticsearchDistribution.Platform.LINUX ||
platform == ElasticsearchDistribution.Platform.DARWIN)) ? "tar.gz" : "zip"
"/downloads/elasticsearch/elasticsearch-oss-${version}-${platform}-x86_64.$fileType"
private static String urlPath(String version, OpenSearchDistribution.Platform platform) {
String fileType = ((platform == OpenSearchDistribution.Platform.LINUX ||
platform == OpenSearchDistribution.Platform.DARWIN)) ? "tar.gz" : "zip"
"/downloads/opensearch/opensearch-oss-${version}-${platform}-x86_64.$fileType"
}
private static byte[] filebytes(String urlPath) throws IOException {
String suffix = urlPath.endsWith("zip") ? "zip" : "tar.gz";
return DistributionDownloadFixture.getResourceAsStream("/org/elasticsearch/gradle/fake_elasticsearch." + suffix).getBytes()
return DistributionDownloadFixture.getResourceAsStream("/org/opensearch/gradle/fake_opensearch." + suffix).getBytes()
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.fixtures
package org.opensearch.gradle.fixtures
import com.github.tomakehurst.wiremock.WireMockServer
import org.gradle.testkit.runner.BuildResult

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.gradle.internal
package org.opensearch.gradle.internal
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
class InternalBwcGitPluginFuncTest extends AbstractGradleFuncTest {
@ -32,9 +32,9 @@ class InternalBwcGitPluginFuncTest extends AbstractGradleFuncTest {
given:
internalBuild();
buildFile << """
import org.elasticsearch.gradle.Version;
apply plugin: org.elasticsearch.gradle.internal.InternalBwcGitPlugin
import org.opensearch.gradle.Version;
apply plugin: org.opensearch.gradle.internal.InternalBwcGitPlugin
bwcGitConfig {
bwcVersion = project.provider { Version.fromString("7.10.0") }
bwcBranch = project.provider { "7.x" }

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle.internal
package org.opensearch.gradle.internal
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Unroll
@ -34,7 +34,7 @@ class InternalDistributionArchiveCheckPluginFuncTest extends AbstractGradleFuncT
file("${projName}/build.gradle") << """
plugins {
id 'elasticsearch.internal-distribution-archive-check'
id 'opensearch.internal-distribution-archive-check'
}"""
}
file("SomeFile.txt") << """
@ -84,7 +84,7 @@ Copyright 2009-2018 Acme Coorp"""
buildFile << """
apply plugin:'base'
tasks.withType(AbstractArchiveTask).configureEach {
into("elasticsearch-${VersionProperties.getElasticsearch()}") {
into("opensearch-${VersionProperties.getOpenSearch()}") {
from 'LICENSE.txt'
from 'SomeFile.txt'
from 'NOTICE.txt'
@ -97,8 +97,8 @@ Copyright 2009-2018 Acme Coorp"""
then:
result.task(":darwin-tar:checkNotice").outcome == TaskOutcome.FAILED
normalizedOutput(result.output).contains("> expected line [2] in " +
"[./darwin-tar/build/tar-extracted/elasticsearch-${VersionProperties.getElasticsearch()}/NOTICE.txt] " +
"to be [Copyright 2021 OpenSearch Contributors] but was [Copyright 2009-2018 Acme Coorp]")
"[./darwin-tar/build/tar-extracted/opensearch-${VersionProperties.getOpenSearch()}/NOTICE.txt] " +
"to be [Copyright 2009-2018 Elasticsearch] but was [Copyright 2009-2018 Acme Coorp]")
}
void license(File file = file("licenses/APACHE-LICENSE-2.0.txt")) {

View File

@ -17,14 +17,14 @@
* under the License.
*/
package org.elasticsearch.gradle.internal
package org.opensearch.gradle.internal
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
import org.apache.tools.zip.ZipEntry
import org.apache.tools.zip.ZipFile
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.TaskOutcome
@ -32,10 +32,10 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT
def setup() {
buildFile << """
import org.elasticsearch.gradle.tar.SymbolicLinkPreservingTar
import org.opensearch.gradle.tar.SymbolicLinkPreservingTar
plugins {
id 'elasticsearch.internal-distribution-archive-setup'
id 'opensearch.internal-distribution-archive-setup'
}
"""
file('someFile.txt') << "some content"
@ -60,7 +60,7 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT
where:
buildTaskName | expectedOutputArchivePath
"buildOssDarwinTar" | "oss-darwin-tar/build/distributions/elasticsearch-oss.tar.gz"
"buildOssDarwinTar" | "oss-darwin-tar/build/distributions/opensearch-oss.tar.gz"
}
def "applies defaults to zip tasks"() {
@ -81,7 +81,7 @@ class InternalDistributionArchiveSetupPluginFuncTest extends AbstractGradleFuncT
where:
buildTaskName | expectedOutputArchivePath
"buildOssDarwinZip" | "oss-darwin-zip/build/distributions/elasticsearch-oss.zip"
"buildOssDarwinZip" | "oss-darwin-zip/build/distributions/opensearch-oss.zip"
}
def "registered distribution provides archives and directory variant"() {
@ -138,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-oss.tar.gz").exists()
file("consumer/build/archives/elasticsearch-oss.tar.gz").exists()
file("producer-tar/build/distributions/opensearch-oss.tar.gz").exists()
file("consumer/build/archives/opensearch-oss.tar.gz").exists()
when:
result = gradleRunner("copyDir", "-Pversion=1.0").build()

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle.internal
package org.opensearch.gradle.internal
import org.apache.commons.io.FileUtils
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
import org.junit.Rule
import org.junit.rules.TemporaryFolder
@ -39,7 +39,7 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest
File buildScript = new File(testProjectDir.root, 'remote/build.gradle')
internalBuild(buildScript)
buildScript << """
apply plugin: 'elasticsearch.internal-distribution-bwc-setup'
apply plugin: 'opensearch.internal-distribution-bwc-setup'
"""
}
@ -92,7 +92,7 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest
result.output.contains("[8.0.1] > Task :distribution:archives:oss-darwin-tar:assemble")
normalizedOutput(result.output)
.contains("distfile /distribution/bwc/bugfix/build/bwc/checkout-8.0/distribution/archives/oss-darwin-tar/" +
"build/distributions/elasticsearch-oss-8.0.1-SNAPSHOT-darwin-x86_64.tar.gz")
"build/distributions/opensearch-oss-8.0.1-SNAPSHOT-darwin-x86_64.tar.gz")
}
def "bwc expanded distribution folder can be resolved as bwc project artifact"() {

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle.internal
package org.opensearch.gradle.internal
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import org.junit.Rule
@ -34,7 +34,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
given:
buildFile.text = """
plugins {
id 'elasticsearch.internal-distribution-download'
id 'opensearch.internal-distribution-download'
}
"""
@ -42,19 +42,19 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
def result = gradleRunner("tasks").buildAndFail()
then:
assertOutputContains(result.output, "Plugin 'elasticsearch.internal-distribution-download' is not supported. " +
"Use 'elasticsearch.distribution-download' plugin instead")
assertOutputContains(result.output, "Plugin 'opensearch.internal-distribution-download' is not supported. " +
"Use 'opensearch.distribution-download' plugin instead")
}
def "resolves current version from local build"() {
given:
internalBuild()
localDistroSetup()
def distroVersion = VersionProperties.getElasticsearch()
def distroVersion = VersionProperties.getOpenSearch()
buildFile << """
apply plugin: 'elasticsearch.internal-distribution-download'
apply plugin: 'opensearch.internal-distribution-download'
elasticsearch_distributions {
opensearch_distributions {
test_distro {
version = "$distroVersion"
type = "archive"
@ -63,7 +63,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
}
}
tasks.register("setupDistro", Sync) {
from(elasticsearch_distributions.test_distro.extracted)
from(opensearch_distributions.test_distro.extracted)
into("build/distro")
}
"""
@ -82,9 +82,9 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
internalBuild()
bwcMinorProjectSetup()
buildFile << """
apply plugin: 'elasticsearch.internal-distribution-download'
apply plugin: 'opensearch.internal-distribution-download'
elasticsearch_distributions {
opensearch_distributions {
test_distro {
version = "8.1.0"
type = "archive"
@ -93,7 +93,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
}
}
tasks.register("setupDistro", Sync) {
from(elasticsearch_distributions.test_distro.extracted)
from(opensearch_distributions.test_distro.extracted)
into("build/distro")
}
"""
@ -112,9 +112,9 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
internalBuild()
bwcMinorProjectSetup()
buildFile << """
apply plugin: 'elasticsearch.internal-distribution-download'
apply plugin: 'opensearch.internal-distribution-download'
elasticsearch_distributions {
opensearch_distributions {
test_distro {
version = "8.1.0"
type = "archive"
@ -124,7 +124,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
}
}
tasks.register("createExtractedTestDistro") {
dependsOn elasticsearch_distributions.test_distro.extracted
dependsOn opensearch_distributions.test_distro.extracted
}
"""
when:
@ -142,7 +142,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
new File(bwcSubProjectFolder, 'bwc-marker.txt') << "bwc=minor"
new File(bwcSubProjectFolder, 'build.gradle') << """
apply plugin:'base'
// packed distro
configurations.create("oss-linux-tar")
tasks.register("buildBwcTask", Tar) {
@ -153,7 +153,7 @@ class InternalDistributionDownloadPluginFuncTest extends AbstractGradleFuncTest
artifacts {
it.add("oss-linux-tar", buildBwcTask)
}
// expanded distro
configurations.create("expanded-oss-linux-tar")
def expandedTask = tasks.register("buildBwcExpandedTask", Copy) {

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.Rule;
@ -37,7 +37,7 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import static org.elasticsearch.gradle.test.TestClasspathUtils.setupJarJdkClasspath;
import static org.opensearch.gradle.test.TestClasspathUtils.setupJarJdkClasspath;
public class BuildPluginIT extends GradleIntegrationTestCase {
@ -45,14 +45,14 @@ public class BuildPluginIT extends GradleIntegrationTestCase {
public TemporaryFolder tmpDir = new TemporaryFolder();
public void testPluginCanBeApplied() {
BuildResult result = getGradleRunner("elasticsearch.build").withArguments("hello", "-s").build();
BuildResult result = getGradleRunner("opensearch.build").withArguments("hello", "-s").build();
assertTaskSuccessful(result, ":hello");
assertOutputContains("build plugin can be applied");
}
public void testCheckTask() {
setupJarJdkClasspath(getProjectDir("elasticsearch.build"));
BuildResult result = getGradleRunner("elasticsearch.build").withArguments("check", "assemble", "-s").build();
setupJarJdkClasspath(getProjectDir("opensearch.build"));
BuildResult result = getGradleRunner("opensearch.build").withArguments("check", "assemble", "-s").build();
assertTaskSuccessful(result, ":check");
}
@ -87,7 +87,7 @@ public class BuildPluginIT extends GradleIntegrationTestCase {
}
private void runInsecureArtifactRepositoryTest(final String name, final String url, final List<String> lines) throws IOException {
final File projectDir = getProjectDir("elasticsearch.build");
final File projectDir = getProjectDir("opensearch.build");
final Path projectDirPath = projectDir.toPath();
FileUtils.copyDirectory(projectDir, tmpDir.getRoot(), file -> {
final Path relativePath = projectDirPath.relativize(file.toPath());
@ -113,13 +113,13 @@ public class BuildPluginIT extends GradleIntegrationTestCase {
}
public void testLicenseAndNotice() throws IOException {
BuildResult result = getGradleRunner("elasticsearch.build").withArguments("clean", "assemble").build();
BuildResult result = getGradleRunner("opensearch.build").withArguments("clean", "assemble").build();
assertTaskSuccessful(result, ":assemble");
assertBuildFileExists(result, "elasticsearch.build", "distributions/elasticsearch.build.jar");
assertBuildFileExists(result, "opensearch.build", "distributions/opensearch.build.jar");
try (ZipFile zipFile = new ZipFile(new File(getBuildDir("elasticsearch.build"), "distributions/elasticsearch.build.jar"))) {
try (ZipFile zipFile = new ZipFile(new File(getBuildDir("opensearch.build"), "distributions/opensearch.build.jar"))) {
ZipEntry licenseEntry = zipFile.getEntry("META-INF/LICENSE.txt");
ZipEntry noticeEntry = zipFile.getEntry("META-INF/NOTICE.txt");
assertNotNull("Jar does not have META-INF/LICENSE.txt", licenseEntry);

View File

@ -1,5 +1,3 @@
package org.elasticsearch.gradle;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@ -19,12 +17,14 @@ package org.elasticsearch.gradle;
* under the License.
*/
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
package org.opensearch.gradle;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
public class ExportElasticsearchBuildResourcesTaskIT extends GradleIntegrationTestCase {
public class ExportOpenSearchBuildResourcesTaskIT extends GradleIntegrationTestCase {
public static final String PROJECT_NAME = "elasticsearch-build-resources";
public static final String PROJECT_NAME = "opensearch-build-resources";
public void testUpToDateWithSourcesConfigured() {
getGradleRunner(PROJECT_NAME).withArguments("clean", "-s").build();

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.Before;

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.precommit;
package org.opensearch.gradle.precommit;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.Before;
@ -39,11 +39,11 @@ public class TestingConventionsTasksIT extends GradleIntegrationTestCase {
assertOutputContains(
result.getOutput(),
"Test classes implemented by inner classes will not run:",
" * org.elasticsearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention1",
" * org.elasticsearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention2",
" * org.elasticsearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention3",
" * org.elasticsearch.gradle.testkit.NastyInnerClasses$NamingConventionIT",
" * org.elasticsearch.gradle.testkit.NastyInnerClasses$NamingConventionTests"
" * org.opensearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention1",
" * org.opensearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention2",
" * org.opensearch.gradle.testkit.NastyInnerClasses$LooksLikeATestWithoutNamingConvention3",
" * org.opensearch.gradle.testkit.NastyInnerClasses$NamingConventionIT",
" * org.opensearch.gradle.testkit.NastyInnerClasses$NamingConventionTests"
);
}
@ -58,9 +58,9 @@ public class TestingConventionsTasksIT extends GradleIntegrationTestCase {
assertOutputContains(
result.getOutput(),
"Seem like test classes but don't match naming convention:",
" * org.elasticsearch.gradle.testkit.LooksLikeATestWithoutNamingConvention1",
" * org.elasticsearch.gradle.testkit.LooksLikeATestWithoutNamingConvention2",
" * org.elasticsearch.gradle.testkit.LooksLikeATestWithoutNamingConvention3"
" * org.opensearch.gradle.testkit.LooksLikeATestWithoutNamingConvention1",
" * org.opensearch.gradle.testkit.LooksLikeATestWithoutNamingConvention2",
" * org.opensearch.gradle.testkit.LooksLikeATestWithoutNamingConvention3"
);
assertOutputDoesNotContain(result.getOutput(), "LooksLikeTestsButAbstract");
}
@ -91,7 +91,7 @@ public class TestingConventionsTasksIT extends GradleIntegrationTestCase {
assertOutputContains(
result.getOutput(),
"Test classes are not included in any enabled task (:all_classes_in_tasks:test):",
" * org.elasticsearch.gradle.testkit.NamingConventionIT"
" * org.opensearch.gradle.testkit.NamingConventionIT"
);
}
@ -105,12 +105,12 @@ public class TestingConventionsTasksIT extends GradleIntegrationTestCase {
BuildResult result = runner.buildAndFail();
assertOutputContains(
result.getOutput(),
"Tests classes with suffix `IT` should extend org.elasticsearch.gradle.testkit.Integration but the following classes do not:",
" * org.elasticsearch.gradle.testkit.NamingConventionIT",
" * org.elasticsearch.gradle.testkit.NamingConventionMissmatchIT",
"Tests classes with suffix `Tests` should extend org.elasticsearch.gradle.testkit.Unit but the following classes do not:",
" * org.elasticsearch.gradle.testkit.NamingConventionMissmatchTests",
" * org.elasticsearch.gradle.testkit.NamingConventionTests"
"Tests classes with suffix `IT` should extend org.opensearch.gradle.testkit.Integration but the following classes do not:",
" * org.opensearch.gradle.testkit.NamingConventionIT",
" * org.opensearch.gradle.testkit.NamingConventionMissmatchIT",
"Tests classes with suffix `Tests` should extend org.opensearch.gradle.testkit.Unit but the following classes do not:",
" * org.opensearch.gradle.testkit.NamingConventionMissmatchTests",
" * org.opensearch.gradle.testkit.NamingConventionTests"
);
}

View File

@ -17,13 +17,13 @@
* under the License.
*/
package org.elasticsearch.gradle.precommit;
package org.opensearch.gradle.precommit;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
import org.junit.Before;
import static org.elasticsearch.gradle.test.TestClasspathUtils.setupJarJdkClasspath;
import static org.opensearch.gradle.test.TestClasspathUtils.setupJarJdkClasspath;
public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
@ -35,14 +35,14 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
setupJarJdkClasspath(getProjectDir("thirdPartyAudit"));
}
public void testElasticsearchIgnored() {
public void testOpenSearchIgnored() {
BuildResult result = getGradleRunner("thirdPartyAudit").withArguments(
":clean",
":empty",
"-s",
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
"-PcompileOnlyGroup=opensearch.gradle:broken-log4j",
"-PcompileOnlyVersion=0.0.1",
"-PcompileGroup=elasticsearch.gradle:dummy-io",
"-PcompileGroup=opensearch.gradle:dummy-io",
"-PcompileVersion=0.0.1"
).build();
assertTaskNoSource(result, ":empty");
@ -122,14 +122,14 @@ public class ThirdPartyAuditTaskIT extends GradleIntegrationTestCase {
assertNoDeprecationWarning(result);
}
public void testElasticsearchIgnoredWithViolations() {
public void testOpenSearchIgnoredWithViolations() {
BuildResult result = getGradleRunner("thirdPartyAudit").withArguments(
":clean",
":absurd",
"-s",
"-PcompileOnlyGroup=elasticsearch.gradle:broken-log4j",
"-PcompileOnlyGroup=opensearch.gradle:broken-log4j",
"-PcompileOnlyVersion=0.0.1",
"-PcompileGroup=elasticsearch.gradle:dummy-io",
"-PcompileGroup=opensearch.gradle:dummy-io",
"-PcompileVersion=0.0.1"
).build();
assertTaskNoSource(result, ":absurd");

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.tar;
package org.opensearch.gradle.tar;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.opensearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.api.GradleException;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.Before;

View File

@ -23,7 +23,7 @@ subprojects {
tasks.register('tar', Tar) {
from('.')
destinationDirectory.set(file('build/distributions'))
archiveBaseName.set("elasticsearch-oss")
archiveBaseName.set("opensearch-oss")
archiveVersion.set("8.0.1-SNAPSHOT")
archiveClassifier.set("darwin-x86_64")
archiveExtension.set('tar.gz')

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.apache.tools.ant.BuildListener
import org.apache.tools.ant.BuildLogger

View File

@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import groovy.transform.CompileStatic
import org.apache.commons.io.IOUtils
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.elasticsearch.gradle.test.ErrorReportingTestListener
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.testclusters.TestDistribution
import org.elasticsearch.gradle.util.GradleUtils
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.info.GlobalBuildInfoPlugin
import org.opensearch.gradle.precommit.PrecommitTasks
import org.opensearch.gradle.test.ErrorReportingTestListener
import org.opensearch.gradle.testclusters.OpenSearchCluster
import org.opensearch.gradle.testclusters.TestClustersPlugin
import org.opensearch.gradle.testclusters.TestDistribution
import org.opensearch.gradle.util.GradleUtils
import org.gradle.api.JavaVersion
import org.gradle.api.*
import org.gradle.api.artifacts.Configuration
@ -41,8 +41,8 @@ import org.gradle.api.artifacts.repositories.IvyPatternRepositoryLayout
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.credentials.HttpHeaderCredentials
import org.gradle.api.execution.TaskActionListener
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.opensearch.gradle.info.GlobalBuildInfoPlugin
import org.opensearch.gradle.precommit.PrecommitTasks
import org.gradle.api.GradleException
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
@ -52,7 +52,7 @@ import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.tasks.bundling.Jar
/**
* Encapsulates build configuration for elasticsearch projects.
* Encapsulates build configuration for opensearch projects.
*/
@CompileStatic
class BuildPlugin implements Plugin<Project> {
@ -62,14 +62,14 @@ class BuildPlugin implements Plugin<Project> {
// make sure the global build info plugin is applied to the root project
project.rootProject.pluginManager.apply(GlobalBuildInfoPlugin)
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
throw new InvalidUserDataException('elasticsearch.standalone-test, '
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
if (project.pluginManager.hasPlugin('opensearch.standalone-rest-test')) {
throw new InvalidUserDataException('opensearch.standalone-test, '
+ 'opensearch.standalone-rest-test, and opensearch.build '
+ 'are mutually exclusive')
}
project.pluginManager.apply('elasticsearch.java')
project.pluginManager.apply('opensearch.java')
configureLicenseAndNotice(project)
project.pluginManager.apply('elasticsearch.publish')
project.pluginManager.apply('opensearch.publish')
project.pluginManager.apply(DependenciesInfoPlugin)
PrecommitTasks.create(project, true)

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
import org.opensearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.opensearch.gradle.precommit.DependencyLicensesTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
import org.elasticsearch.gradle.precommit.LicenseAnalyzer
import org.opensearch.gradle.precommit.DependencyLicensesTask
import org.opensearch.gradle.precommit.LicenseAnalyzer
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.DependencySet
@ -129,7 +129,7 @@ class DependenciesInfoTask extends ConventionTask {
* <li><em>UNKNOWN</em> if LICENSE file is not present for this dependency.</li>
* <li><em>one SPDX identifier</em> if the LICENSE content matches with an SPDX license.</li>
* <li><em>Custom;URL</em> if it's not an SPDX license,
* URL is the Github URL to the LICENSE file in elasticsearch repository.</li>
* URL is the Github URL to the LICENSE file in opensearch repository.</li>
* </ul>
*
* @param group dependency group

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.file.CopySpec

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle
package org.opensearch.gradle
import org.gradle.api.DefaultTask
import org.gradle.api.file.FileCollection

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Configuration;
@ -26,7 +26,7 @@ import org.gradle.internal.deprecation.DeprecatableConfiguration;
import java.util.Collection;
import static org.elasticsearch.gradle.DistributionDownloadPlugin.DISTRO_EXTRACTED_CONFIG_PREFIX;
import static org.opensearch.gradle.DistributionDownloadPlugin.DISTRO_EXTRACTED_CONFIG_PREFIX;
public class ResolveAllDependencies extends DefaultTask {

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.doc
package org.opensearch.gradle.doc
import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.opensearch.gradle.OS
import org.opensearch.gradle.Version
import org.opensearch.gradle.VersionProperties
import org.gradle.api.Plugin
import org.gradle.api.Project
@ -31,9 +31,9 @@ class DocsTestPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.pluginManager.apply('elasticsearch.testclusters')
project.pluginManager.apply('elasticsearch.standalone-rest-test')
project.pluginManager.apply('elasticsearch.rest-test')
project.pluginManager.apply('opensearch.testclusters')
project.pluginManager.apply('opensearch.standalone-rest-test')
project.pluginManager.apply('opensearch.rest-test')
String distribution = System.getProperty('tests.distribution', 'oss')
// The distribution can be configured with -Dtests.distribution on the command line
@ -47,8 +47,8 @@ class DocsTestPlugin implements Plugin<Project> {
* the values may differ. In particular {version} needs to resolve
* to the version being built for testing but needs to resolve to
* the last released version for docs. */
'\\{version\\}': Version.fromString(VersionProperties.elasticsearch).toString(),
'\\{version_qualified\\}': VersionProperties.elasticsearch,
'\\{version\\}': Version.fromString(VersionProperties.opensearch).toString(),
'\\{version_qualified\\}': VersionProperties.opensearch,
'\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''),
'\\{build_type\\}' : OS.conditionalString().onWindows({"zip"}).onUnix({"tar"}).supply(),
]

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle.doc
package org.opensearch.gradle.doc
import groovy.transform.PackageScope
import org.elasticsearch.gradle.doc.SnippetsTask.Snippet
import org.opensearch.gradle.doc.SnippetsTask.Snippet
import org.gradle.api.InvalidUserDataException
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.doc
package org.opensearch.gradle.doc
import groovy.json.JsonException
import groovy.json.JsonParserType
@ -57,7 +57,7 @@ class SnippetsTask extends DefaultTask {
/**
* The docs to scan. Defaults to every file in the directory exception the
* build.gradle file because that is appropriate for Elasticsearch's docs
* build.gradle file because that is appropriate for OpenSearch's docs
* directory.
*/
@InputFiles
@ -111,7 +111,7 @@ class SnippetsTask extends DefaultTask {
if (snippet.language == null) {
throw new InvalidUserDataException("$snippet: "
+ "Snippet missing a language. This is required by "
+ "Elasticsearch's doc testing infrastructure so we "
+ "OpenSearch's doc testing infrastructure so we "
+ "be sure we don't accidentally forget to test a "
+ "snippet.")
}

View File

@ -16,18 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.plugin
package org.opensearch.gradle.plugin
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.NoticeTask
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.test.RestTestBasePlugin
import org.elasticsearch.gradle.testclusters.RunTask
import org.elasticsearch.gradle.util.Util
import org.opensearch.gradle.BuildPlugin
import org.opensearch.gradle.NoticeTask
import org.opensearch.gradle.Version
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.dependencies.CompileOnlyResolvePlugin
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.plugin.PluginPropertiesExtension
import org.opensearch.gradle.test.RestTestBasePlugin
import org.opensearch.gradle.testclusters.RunTask
import org.opensearch.gradle.util.Util
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
import org.gradle.api.Project
@ -43,7 +44,7 @@ import org.gradle.api.tasks.bundling.Zip
import org.gradle.jvm.tasks.Jar
/**
* Encapsulates build configuration for an Elasticsearch plugin.
* Encapsulates build configuration for an OpenSearch plugin.
*/
class PluginBuildPlugin implements Plugin<Project> {
@ -91,7 +92,7 @@ class PluginBuildPlugin implements Plugin<Project> {
'name' : extension1.name,
'description' : extension1.description,
'version' : extension1.version,
'elasticsearchVersion': Version.fromString(VersionProperties.elasticsearch).toString(),
'opensearchVersion': Version.fromString(VersionProperties.opensearch).toString(),
'javaVersion' : project.targetCompatibility as String,
'classname' : extension1.classname,
'extendedPlugins' : extension1.extendedPlugins.join(','),
@ -114,9 +115,9 @@ class PluginBuildPlugin implements Plugin<Project> {
baseClass 'org.apache.lucene.util.LuceneTestCase'
}
IT {
baseClass 'org.elasticsearch.test.ESIntegTestCase'
baseClass 'org.elasticsearch.test.rest.ESRestTestCase'
baseClass 'org.elasticsearch.test.ESSingleNodeTestCase'
baseClass 'org.opensearch.test.ESIntegTestCase'
baseClass 'org.opensearch.test.rest.ESRestTestCase'
baseClass 'org.opensearch.test.ESSingleNodeTestCase'
}
}
}
@ -139,7 +140,7 @@ class PluginBuildPlugin implements Plugin<Project> {
// always configure publishing for client jars
project.publishing.publications.nebula(MavenPublication).artifactId(extension.name + "-client")
project.tasks.withType(GenerateMavenPom.class).configureEach { GenerateMavenPom generatePOMTask ->
generatePOMTask.destination = "${project.buildDir}/distributions/${project.archivesBaseName}-client-${project.versions.elasticsearch}.pom"
generatePOMTask.destination = "${project.buildDir}/distributions/${project.archivesBaseName}-client-${project.versions.opensearch}.pom"
}
} else {
if (project.plugins.hasPlugin(MavenPublishPlugin)) {
@ -154,16 +155,16 @@ class PluginBuildPlugin implements Plugin<Project> {
compileOnly project.project(':server')
testImplementation project.project(':test:framework')
} else {
compileOnly "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}"
testImplementation "org.elasticsearch.test:framework:${project.versions.elasticsearch}"
compileOnly "org.opensearch:opensearch:${project.versions.opensearch}"
testImplementation "org.opensearch.test:framework:${project.versions.opensearch}"
}
// 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 opensearch server that includes optional deps
compileOnly "org.locationtech.spatial4j:spatial4j:${project.versions.spatial4j}"
compileOnly "org.locationtech.jts:jts-core:${project.versions.jts}"
compileOnly "org.apache.logging.log4j:log4j-api:${project.versions.log4j}"
compileOnly "org.apache.logging.log4j:log4j-core:${project.versions.log4j}"
compileOnly "org.elasticsearch:jna:${project.versions.jna}"
compileOnly "org.opensearch:jna:${project.versions.jna}"
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.precommit
package org.opensearch.gradle.precommit
import org.gradle.api.Project
import org.gradle.api.Task

View File

@ -16,12 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.precommit
package org.opensearch.gradle.precommit
import org.apache.rat.anttasks.Report
import org.apache.rat.anttasks.SubstringLicenseMatcher
import org.apache.rat.license.SimpleLicenseFamily
import org.elasticsearch.gradle.AntTask
import org.opensearch.gradle.AntTask
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.precommit
package org.opensearch.gradle.precommit
import org.gradle.api.Project

View File

@ -17,17 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.AntTask
import org.elasticsearch.gradle.LoggedExec
import org.gradle.api.GradleException
import org.gradle.api.Task
import org.gradle.api.tasks.Exec
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskProvider
import org.opensearch.gradle.AntTask
import org.opensearch.gradle.LoggedExec
/**
* A fixture for integration tests which runs in a separate process launched by Ant.
*/
@ -226,7 +224,7 @@ class AntFixture extends AntTask implements Fixture {
throw toThrow
}
/** Adds a task to kill an elasticsearch node with the given pidfile */
/** Adds a task to kill an opensearch node with the given pidfile */
private TaskProvider createStopTask() {
final AntFixture fixture = this
final Object pid = "${ -> fixture.pid }"

View File

@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import org.elasticsearch.gradle.Version
import org.opensearch.gradle.Version
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.tasks.Input
/** Configuration for an elasticsearch cluster, used for integration tests. */
/** Configuration for an opensearch cluster, used for integration tests. */
class ClusterConfiguration {
private final Project project
@ -253,8 +253,8 @@ class ClusterConfiguration {
*/
@Input
void extraConfigFile(String path, Object sourceFile) {
if (path == 'elasticsearch.yml') {
throw new GradleException('Overwriting elasticsearch.yml is not allowed, add additional settings using cluster { setting "foo", "bar" }')
if (path == 'opensearch.yml') {
throw new GradleException('Overwriting opensearch.yml is not allowed, add additional settings using cluster { setting "foo", "bar" }')
}
extraConfigFiles.put(path, sourceFile)
}

View File

@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import org.apache.tools.ant.DefaultLogger
import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.BwcVersions
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension
import org.opensearch.gradle.BuildPlugin
import org.opensearch.gradle.BwcVersions
import org.opensearch.gradle.LoggedExec
import org.opensearch.gradle.Version
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.plugin.PluginBuildPlugin
import org.opensearch.gradle.plugin.PluginPropertiesExtension
import org.gradle.api.AntBuilder
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
@ -87,13 +87,13 @@ class ClusterFormationTasks {
throw new GradleException("bwcVersion must not be null if numBwcNodes is > 0")
}
// this is our current version distribution configuration we use for all kinds of REST tests etc.
Configuration currentDistro = project.configurations.create("${prefix}_elasticsearchDistro")
Configuration bwcDistro = project.configurations.create("${prefix}_elasticsearchBwcDistro")
Configuration bwcPlugins = project.configurations.create("${prefix}_elasticsearchBwcPlugins")
Configuration currentDistro = project.configurations.create("${prefix}_opensearchDistro")
Configuration bwcDistro = project.configurations.create("${prefix}_opensearchBwcDistro")
Configuration bwcPlugins = project.configurations.create("${prefix}_opensearchBwcPlugins")
if (System.getProperty('tests.distribution', 'oss') == 'integ-test-zip') {
throw new Exception("tests.distribution=integ-test-zip is not supported")
}
configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearch)
configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.opensearch)
boolean hasBwcNodes = config.numBwcNodes > 0
if (hasBwcNodes) {
if (config.bwcVersion == null) {
@ -115,18 +115,18 @@ class ClusterFormationTasks {
// we start N nodes and out of these N nodes there might be M bwc nodes.
// for each of those nodes we might have a different configuration
Configuration distro
String elasticsearchVersion
String opensearchVersion
if (i < config.numBwcNodes) {
elasticsearchVersion = config.bwcVersion.toString()
opensearchVersion = config.bwcVersion.toString()
if (project.bwcVersions.unreleased.contains(config.bwcVersion)) {
elasticsearchVersion += "-SNAPSHOT"
opensearchVersion += "-SNAPSHOT"
}
distro = bwcDistro
} else {
elasticsearchVersion = VersionProperties.elasticsearch
opensearchVersion = VersionProperties.opensearch
distro = currentDistro
}
NodeInfo node = new NodeInfo(config, i, project, prefix, elasticsearchVersion, sharedDir)
NodeInfo node = new NodeInfo(config, i, project, prefix, opensearchVersion, sharedDir)
nodes.add(node)
Closure<Map> writeConfigSetup
Object dependsOn
@ -176,7 +176,7 @@ class ClusterFormationTasks {
}
/** Adds a dependency on the given distribution */
static void configureDistributionDependency(Project project, String distro, Configuration configuration, String elasticsearchVersion) {
static void configureDistributionDependency(Project project, String distro, Configuration configuration, String opensearchVersion) {
boolean internalBuild = project.hasProperty('bwcVersions')
if (distro.equals("integ-test-zip")) {
// short circuit integ test so it doesn't complicate the rest of the distribution setup below
@ -188,18 +188,18 @@ class ClusterFormationTasks {
} else {
project.dependencies.add(
configuration.name,
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${elasticsearchVersion}@zip"
"org.opensearch.distribution.integ-test-zip:opensearch:${opensearchVersion}@zip"
)
}
return
}
distro = 'oss'
Version version = Version.fromString(elasticsearchVersion)
Version version = Version.fromString(opensearchVersion)
String os = getOs()
String classifier = "-${os}-x86_64"
String packaging = os.equals('windows') ? 'zip' : 'tar.gz'
String artifactName = 'elasticsearch-oss'
String artifactName = 'opensearch-oss'
Object dependency
String snapshotProject = "${os}-${os.equals('windows') ? 'zip' : 'tar'}"
if (version.before("7.0.0")) {
@ -218,43 +218,43 @@ class ClusterFormationTasks {
dependency = project.dependencies.project(
path: unreleasedInfo.gradleProjectPath, configuration: snapshotProject
)
} else if (internalBuild && elasticsearchVersion.equals(VersionProperties.elasticsearch)) {
} else if (internalBuild && opensearchVersion.equals(VersionProperties.opensearch)) {
dependency = project.dependencies.project(path: ":distribution:archives:${snapshotProject}")
} else {
if (version.before('7.0.0')) {
classifier = "" // for bwc, before we had classifiers
}
// group does not matter as it is not used when we pull from the ivy repo that points to the download service
dependency = "dnm:${artifactName}:${elasticsearchVersion}${classifier}@${packaging}"
dependency = "dnm:${artifactName}:${opensearchVersion}${classifier}@${packaging}"
}
project.dependencies.add(configuration.name, dependency)
}
/** Adds a dependency on a different version of the given plugin, which will be retrieved using gradle's dependency resolution */
static void configureBwcPluginDependency(Project project, Object plugin, Configuration configuration, Version elasticsearchVersion) {
static void configureBwcPluginDependency(Project project, Object plugin, Configuration configuration, Version opensearchVersion) {
if (plugin instanceof Project) {
Project pluginProject = (Project)plugin
verifyProjectHasBuildPlugin(configuration.name, elasticsearchVersion, project, pluginProject)
verifyProjectHasBuildPlugin(configuration.name, opensearchVersion, project, pluginProject)
final String pluginName = findPluginName(pluginProject)
project.dependencies.add(configuration.name, "org.elasticsearch.plugin:${pluginName}:${elasticsearchVersion}@zip")
project.dependencies.add(configuration.name, "org.opensearch.plugin:${pluginName}:${opensearchVersion}@zip")
} else {
project.dependencies.add(configuration.name, "${plugin}@zip")
}
}
/**
* Adds dependent tasks to start an elasticsearch cluster before the given task is executed,
* Adds dependent tasks to start an opensearch cluster before the given task is executed,
* and stop it after it has finished executing.
*
* The setup of the cluster involves the following:
* <ol>
* <li>Cleanup the extraction directory</li>
* <li>Extract a fresh copy of elasticsearch</li>
* <li>Write an elasticsearch.yml config file</li>
* <li>Extract a fresh copy of opensearch</li>
* <li>Write an opensearch.yml config file</li>
* <li>Copy plugins that will be installed to a temporary dir (which contains spaces)</li>
* <li>Install plugins</li>
* <li>Run additional setup commands</li>
* <li>Start elasticsearch<li>
* <li>Start opensearch<li>
* </ol>
*
* @return a task which starts the node.
@ -282,7 +282,7 @@ class ClusterFormationTasks {
setup = configureAddKeystoreFileTasks(prefix, project, setup, node)
if (node.config.plugins.isEmpty() == false) {
if (node.nodeVersion == Version.fromString(VersionProperties.elasticsearch)) {
if (node.nodeVersion == Version.fromString(VersionProperties.opensearch)) {
setup = configureCopyPluginsTask(taskName(prefix, node, 'copyPlugins'), project, setup, node, prefix)
} else {
setup = configureCopyBwcPluginsTask(taskName(prefix, node, 'copyBwcPlugins'), project, setup, node, prefix)
@ -343,13 +343,13 @@ class ClusterFormationTasks {
return start
}
/** Adds a task to extract the elasticsearch distribution */
/** Adds a task to extract the opensearch distribution */
static Task configureExtractTask(String name, Project project, Task setup, NodeInfo node,
Configuration configuration, String distribution) {
List extractDependsOn = [configuration, setup]
/* configuration.singleFile will be an external artifact if this is being run by a plugin not living in the
elasticsearch source tree. If this is a plugin built in the elasticsearch source tree or this is a distro in
the elasticsearch source tree then this should be the version of elasticsearch built by the source tree.
opensearch source tree. If this is a plugin built in the opensearch source tree or this is a distro in
the opensearch source tree then this should be the version of opensearch built by the source tree.
If it isn't then Bad Things(TM) will happen. */
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
if (getOs().equals("windows") || distribution.equals("integ-test-zip") || node.nodeVersion.before("7.0.0")) {
@ -368,7 +368,7 @@ class ClusterFormationTasks {
return extract
}
/** Adds a task to write elasticsearch.yml for the given node configuration */
/** Adds a task to write opensearch.yml for the given node configuration */
static Task configureWriteConfigTask(String name, Project project, Task setup, NodeInfo node, Closure<Map> configFilter) {
Map esConfig = [
'cluster.name' : node.clusterName,
@ -428,7 +428,7 @@ class ClusterFormationTasks {
}
esConfig = configFilter.call(esConfig)
File configFile = new File(node.pathConf, 'elasticsearch.yml')
File configFile = new File(node.pathConf, 'opensearch.yml')
logger.info("Configuring ${configFile}")
configFile.setText(esConfig.collect { key, value -> "${key}: ${value}" }.join('\n'), 'UTF-8')
}
@ -443,7 +443,7 @@ class ClusterFormationTasks {
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to
* getting the short name requiring the path to already exist.
*/
final Object esKeystoreUtil = "${-> node.binPath().resolve('elasticsearch-keystore').toString()}"
final Object esKeystoreUtil = "${-> node.binPath().resolve('opensearch-keystore').toString()}"
return configureExecTask(name, project, setup, node, esKeystoreUtil, 'create')
}
}
@ -456,7 +456,7 @@ class ClusterFormationTasks {
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to getting
* the short name requiring the path to already exist.
*/
final Object esKeystoreUtil = "${-> node.binPath().resolve('elasticsearch-keystore').toString()}"
final Object esKeystoreUtil = "${-> node.binPath().resolve('opensearch-keystore').toString()}"
for (Map.Entry<String, String> entry in kvs) {
String key = entry.getKey()
String name = taskName(parent, node, 'addToKeystore#' + key)
@ -481,7 +481,7 @@ class ClusterFormationTasks {
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to getting
* the short name requiring the path to already exist.
*/
final Object esKeystoreUtil = "${-> node.binPath().resolve('elasticsearch-keystore').toString()}"
final Object esKeystoreUtil = "${-> node.binPath().resolve('opensearch-keystore').toString()}"
for (Map.Entry<String, Object> entry in kvs) {
String key = entry.getKey()
String name = taskName(parent, node, 'addToKeystore#' + key)
@ -593,7 +593,7 @@ class ClusterFormationTasks {
/** Configures task to copy a plugin based on a zip file resolved using dependencies for an older version */
static Task configureCopyBwcPluginsTask(String name, Project project, Task setup, NodeInfo node, String prefix) {
Configuration bwcPlugins = project.configurations.getByName("${prefix}_elasticsearchBwcPlugins")
Configuration bwcPlugins = project.configurations.getByName("${prefix}_opensearchBwcPlugins")
for (Map.Entry<String, Object> plugin : node.config.plugins.entrySet()) {
String configurationName = pluginBwcConfigurationName(prefix, plugin.key)
Configuration configuration = project.configurations.findByName(configurationName)
@ -641,7 +641,7 @@ class ClusterFormationTasks {
static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, String pluginName, String prefix) {
FileCollection pluginZip;
if (node.nodeVersion != Version.fromString(VersionProperties.elasticsearch)) {
if (node.nodeVersion != Version.fromString(VersionProperties.opensearch)) {
pluginZip = project.configurations.getByName(pluginBwcConfigurationName(prefix, pluginName))
} else {
pluginZip = project.configurations.getByName(pluginConfigurationName(prefix, pluginName))
@ -652,7 +652,7 @@ class ClusterFormationTasks {
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to getting
* the short name requiring the path to already exist.
*/
final Object esPluginUtil = "${-> node.binPath().resolve('elasticsearch-plugin').toString()}"
final Object esPluginUtil = "${-> node.binPath().resolve('opensearch-plugin').toString()}"
final Object[] args = [esPluginUtil, 'install', '--batch', file]
return configureExecTask(name, project, setup, node, args)
}
@ -701,12 +701,12 @@ class ClusterFormationTasks {
node.config.distribution == 'integ-test-zip')
}
/** Adds a task to start an elasticsearch node with the given configuration */
/** Adds a task to start an opensearch node with the given configuration */
static Task configureStartTask(String name, Project project, Task setup, NodeInfo node) {
// this closure is converted into ant nodes by groovy's AntBuilder
Closure antRunner = { AntBuilder ant ->
ant.exec(executable: node.executable, spawn: node.config.daemonize, newenvironment: true,
dir: node.cwd, taskname: 'elasticsearch') {
dir: node.cwd, taskname: 'opensearch') {
node.env.each { key, value -> env(key: key, value: value) }
if (useRuntimeJava(project, node)) {
env(key: 'JAVA_HOME', value: project.runtimeJavaHome)
@ -722,14 +722,14 @@ class ClusterFormationTasks {
}
}
// this closure is the actual code to run elasticsearch
Closure elasticsearchRunner = {
// this closure is the actual code to run opensearch
Closure opensearchRunner = {
// Due to how ant exec works with the spawn option, we lose all stdout/stderr from the
// process executed. To work around this, when spawning, we wrap the elasticsearch start
// process executed. To work around this, when spawning, we wrap the opensearch start
// command inside another shell script, which simply internally redirects the output
// of the real elasticsearch script. This allows ant to keep the streams open with the
// of the real opensearch script. This allows ant to keep the streams open with the
// dummy process, but us to have the output available if there is an error in the
// elasticsearch start script
// opensearch start script
if (node.config.daemonize) {
node.writeWrapperScript()
}
@ -749,7 +749,7 @@ class ClusterFormationTasks {
if (node.javaVersion != null) {
BuildPlugin.requireJavaHome(start, node.javaVersion)
}
start.doLast(elasticsearchRunner)
start.doLast(opensearchRunner)
start.doFirst {
// If the node runs in a FIPS 140-2 JVM, the BCFKS default keystore will be password protected
if (BuildParams.inFipsJvm) {
@ -772,7 +772,7 @@ class ClusterFormationTasks {
// we must add debug options inside the closure so the config is read at execution time, as
// gradle task options are not processed until the end of the configuration phase
if (node.config.debug) {
println 'Running elasticsearch in debug mode, suspending until connected on port 8000'
println 'Running opensearch in debug mode, suspending until connected on port 8000'
esJavaOpts.add('-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000')
}
node.env['ES_JAVA_OPTS'] = esJavaOpts.join(" ")
@ -823,18 +823,18 @@ class ClusterFormationTasks {
}
}
if (ant.properties.containsKey("failed${name}".toString())) {
waitFailed(project, nodes, logger, "Failed to start elasticsearch: timed out after ${waitSeconds} seconds")
waitFailed(project, nodes, logger, "Failed to start opensearch: timed out after ${waitSeconds} seconds")
}
boolean anyNodeFailed = false
for (NodeInfo node : nodes) {
if (node.failedMarker.exists()) {
logger.error("Failed to start elasticsearch: ${node.failedMarker.toString()} exists")
logger.error("Failed to start opensearch: ${node.failedMarker.toString()} exists")
anyNodeFailed = true
}
}
if (anyNodeFailed) {
waitFailed(project, nodes, logger, 'Failed to start elasticsearch')
waitFailed(project, nodes, logger, 'Failed to start opensearch')
}
// make sure all files exist otherwise we haven't fully started up
@ -845,7 +845,7 @@ class ClusterFormationTasks {
missingFile |= node.transportPortsFile.exists() == false
}
if (missingFile) {
waitFailed(project, nodes, logger, 'Elasticsearch did not complete startup in time allotted')
waitFailed(project, nodes, logger, 'OpenSearch did not complete startup in time allotted')
}
// go through each node checking the wait condition
@ -862,7 +862,7 @@ class ClusterFormationTasks {
}
if (success == false) {
waitFailed(project, nodes, logger, 'Elasticsearch cluster failed to pass wait condition')
waitFailed(project, nodes, logger, 'OpenSearch cluster failed to pass wait condition')
}
}
}
@ -905,7 +905,7 @@ class ClusterFormationTasks {
throw new GradleException(msg)
}
/** Adds a task to check if the process with the given pidfile is actually elasticsearch */
/** Adds a task to check if the process with the given pidfile is actually opensearch */
static Task configureCheckPreviousTask(String name, Project project, Object depends, NodeInfo node) {
return project.tasks.create(name: name, type: Exec, dependsOn: depends) {
onlyIf { node.pidFile.exists() }
@ -916,12 +916,12 @@ class ClusterFormationTasks {
standardOutput = new ByteArrayOutputStream()
doLast {
String out = standardOutput.toString()
if (out.contains("${ext.pid} org.elasticsearch.bootstrap.Elasticsearch") == false) {
if (out.contains("${ext.pid} org.opensearch.bootstrap.OpenSearch") == false) {
logger.error('jps -l')
logger.error(out)
logger.error("pid file: ${node.pidFile}")
logger.error("pid: ${ext.pid}")
throw new GradleException("jps -l did not report any process with org.elasticsearch.bootstrap.Elasticsearch\n" +
throw new GradleException("jps -l did not report any process with org.opensearch.bootstrap.OpenSearch\n" +
"Did you run gradle clean? Maybe an old pid file is still lying around.")
} else {
logger.info(out)
@ -930,7 +930,7 @@ class ClusterFormationTasks {
}
}
/** Adds a task to kill an elasticsearch node with the given pidfile */
/** Adds a task to kill an opensearch node with the given pidfile */
static Task configureStopTask(String name, Project project, Object depends, NodeInfo node) {
return project.tasks.create(name: name, type: LoggedExec, dependsOn: depends) {
onlyIf { node.pidFile.exists() }

View File

@ -17,14 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import com.sun.jna.Native
import com.sun.jna.WString
import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.opensearch.gradle.Version
import org.opensearch.gradle.VersionProperties
import org.gradle.api.Project
import org.opensearch.gradle.test.JNAKernel32Library
import java.nio.file.Files
import java.nio.file.Path
@ -54,13 +55,13 @@ class NodeInfo {
/** the pid file the node will use */
File pidFile
/** a file written by elasticsearch containing the ports of each bound address for http */
/** a file written by opensearch containing the ports of each bound address for http */
File httpPortsFile
/** a file written by elasticsearch containing the ports of each bound address for transport */
/** a file written by opensearch containing the ports of each bound address for transport */
File transportPortsFile
/** elasticsearch home dir */
/** opensearch home dir */
File homeDir
/** config directory */
@ -78,7 +79,7 @@ class NodeInfo {
/** file that if it exists, indicates the node failed to start */
File failedMarker
/** stdout/stderr log of the elasticsearch process for this node */
/** stdout/stderr log of the opensearch process for this node */
File startLog
/** directory to install plugins from */
@ -93,10 +94,10 @@ class NodeInfo {
/** arguments to start the node with */
List<String> args
/** Executable to run the bin/elasticsearch with, either cmd or sh */
/** Executable to run the bin/opensearch with, either cmd or sh */
String executable
/** Path to the elasticsearch start script */
/** Path to the opensearch start script */
private Object esScript
/** script to run when running in the background */
@ -105,7 +106,7 @@ class NodeInfo {
/** buffer for ant output when starting this node */
ByteArrayOutputStream buffer = new ByteArrayOutputStream()
/** the version of elasticsearch that this node runs */
/** the version of opensearch that this node runs */
Version nodeVersion
/** true if the node is not the current version */
@ -125,15 +126,15 @@ class NodeInfo {
baseDir = new File(project.buildDir, "cluster/${prefix} node${nodeNum}")
pidFile = new File(baseDir, 'es.pid')
this.nodeVersion = Version.fromString(nodeVersion)
this.isBwcNode = this.nodeVersion.before(VersionProperties.elasticsearch)
homeDir = new File(baseDir, "elasticsearch-${nodeVersion}")
this.isBwcNode = this.nodeVersion.before(VersionProperties.opensearch)
homeDir = new File(baseDir, "opensearch-${nodeVersion}")
pathConf = new File(homeDir, 'config')
if (config.dataDir != null) {
dataDir = "${config.dataDir(nodeNum)}"
} else {
dataDir = new File(homeDir, "data")
}
configFile = new File(pathConf, 'elasticsearch.yml')
configFile = new File(pathConf, 'opensearch.yml')
// even for rpm/deb, the logs are under home because we dont start with real services
File logsDir = new File(homeDir, 'logs')
httpPortsFile = new File(logsDir, 'http.ports')
@ -153,11 +154,11 @@ class NodeInfo {
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to
* getting the short name requiring the path to already exist.
*/
esScript = "${-> binPath().resolve('elasticsearch.bat').toString()}"
esScript = "${-> binPath().resolve('opensearch.bat').toString()}"
} else {
executable = 'bash'
wrapperScript = new File(cwd, "run")
esScript = binPath().resolve('elasticsearch')
esScript = binPath().resolve('opensearch')
}
if (config.daemonize) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
@ -256,7 +257,7 @@ class NodeInfo {
esCommandString += "|\n| [${wrapperScript.name}]\n"
wrapperScript.eachLine('UTF-8', { line -> esCommandString += " ${line}\n"})
}
esCommandString += '|\n| [elasticsearch.yml]\n'
esCommandString += '|\n| [opensearch.yml]\n'
configFile.eachLine('UTF-8', { line -> esCommandString += "| ${line}\n" })
esCommandString += "|-----------------------------------------"
return esCommandString

View File

@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import groovy.transform.CompileStatic
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.opensearch.gradle.BuildPlugin
import org.opensearch.gradle.testclusters.TestClustersPlugin
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
/**
* Adds support for starting an Elasticsearch cluster before running integration
* Adds support for starting an OpenSearch cluster before running integration
* tests. Used in conjunction with {@link StandaloneRestTestPlugin} for qa
* projects and in conjunction with {@link BuildPlugin} for testing the rest
* client.
@ -35,20 +35,20 @@ import org.gradle.api.plugins.JavaBasePlugin
@CompileStatic
class RestTestPlugin implements Plugin<Project> {
List<String> REQUIRED_PLUGINS = [
'elasticsearch.build',
'elasticsearch.standalone-rest-test']
'opensearch.build',
'opensearch.standalone-rest-test']
@Override
void apply(Project project) {
if (false == REQUIRED_PLUGINS.any { project.pluginManager.hasPlugin(it) }) {
throw new InvalidUserDataException('elasticsearch.rest-test '
+ 'requires either elasticsearch.build or '
+ 'elasticsearch.standalone-rest-test')
throw new InvalidUserDataException('opensearch.rest-test '
+ 'requires either opensearch.build or '
+ 'opensearch.standalone-rest-test')
}
project.getPlugins().apply(RestTestBasePlugin.class);
project.pluginManager.apply(TestClustersPlugin)
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
integTest.description = 'Runs rest tests against an elasticsearch cluster.'
integTest.description = 'Runs rest tests against an opensearch cluster.'
integTest.group = JavaBasePlugin.VERIFICATION_GROUP
integTest.mustRunAfter(project.tasks.named('precommit'))
project.tasks.named('check').configure { it.dependsOn(integTest) }

View File

@ -18,17 +18,16 @@
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import groovy.transform.CompileStatic
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.ElasticsearchJavaPlugin
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask
import org.elasticsearch.gradle.RepositoriesSetupPlugin
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.opensearch.gradle.OpenSearchJavaPlugin
import org.opensearch.gradle.ExportOpenSearchBuildResourcesTask
import org.opensearch.gradle.RepositoriesSetupPlugin
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.info.GlobalBuildInfoPlugin
import org.opensearch.gradle.precommit.PrecommitTasks
import org.opensearch.gradle.testclusters.TestClustersPlugin
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
import org.gradle.api.Project
@ -43,7 +42,7 @@ import org.gradle.plugins.ide.eclipse.model.EclipseModel
import org.gradle.plugins.ide.idea.model.IdeaModel
/**
* Configures the build to compile tests against Elasticsearch's test framework
* Configures the build to compile tests against OpenSearch's test framework
* and run REST tests. Use BuildPlugin if you want to build main code as well
* as tests.
*/
@ -52,9 +51,9 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
if (project.pluginManager.hasPlugin('elasticsearch.build')) {
throw new InvalidUserDataException('elasticsearch.standalone-test '
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
if (project.pluginManager.hasPlugin('opensearch.build')) {
throw new InvalidUserDataException('opensearch.standalone-test '
+ 'opensearch.standalone-rest-test, and opensearch.build '
+ 'are mutually exclusive')
}
project.rootProject.pluginManager.apply(GlobalBuildInfoPlugin)
@ -63,9 +62,9 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
project.pluginManager.apply(RepositoriesSetupPlugin)
project.pluginManager.apply(RestTestBasePlugin)
project.getTasks().register("buildResources", ExportElasticsearchBuildResourcesTask)
ElasticsearchJavaPlugin.configureInputNormalization(project)
ElasticsearchJavaPlugin.configureCompile(project)
project.getTasks().register("buildResources", ExportOpenSearchBuildResourcesTask)
OpenSearchJavaPlugin.configureInputNormalization(project)
OpenSearchJavaPlugin.configureCompile(project)
project.extensions.getByType(JavaPluginExtension).sourceCompatibility = BuildParams.minimumRuntimeVersion

View File

@ -17,19 +17,17 @@
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import groovy.transform.CompileStatic
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.ElasticsearchJavaPlugin
import org.opensearch.gradle.OpenSearchJavaPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
/**
* Configures the build to compile against Elasticsearch's test framework and
* Configures the build to compile against OpenSearch's test framework and
* run integration and unit tests. Use BuildPlugin if you want to build main
* code as well as tests. */
@CompileStatic
@ -45,7 +43,7 @@ class StandaloneTestPlugin implements Plugin<Project> {
t.mustRunAfter(project.tasks.getByName('precommit'))
}
ElasticsearchJavaPlugin.configureCompile(project)
OpenSearchJavaPlugin.configureCompile(project)
project.tasks.named('check').configure { it.dependsOn(project.tasks.named('test')) }
}
}

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.gradle.test
package org.opensearch.gradle.test
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.opensearch.gradle.plugin.PluginBuildPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency

View File

@ -17,14 +17,14 @@
* under the License.
*/
package org.elasticsearch.gradle.test;
package org.opensearch.gradle.test;
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask;
import org.elasticsearch.gradle.precommit.ForbiddenPatternsTask;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.TestClustersAware;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.Util;
import org.opensearch.gradle.ExportOpenSearchBuildResourcesTask;
import org.opensearch.gradle.precommit.ForbiddenPatternsTask;
import org.opensearch.gradle.testclusters.OpenSearchCluster;
import org.opensearch.gradle.testclusters.TestClustersAware;
import org.opensearch.gradle.testclusters.TestClustersPlugin;
import org.opensearch.gradle.util.Util;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
@ -38,8 +38,8 @@ public class TestWithSslPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
File keyStoreDir = new File(project.getBuildDir(), "keystore");
TaskProvider<ExportElasticsearchBuildResourcesTask> exportKeyStore = project.getTasks()
.register("copyTestCertificates", ExportElasticsearchBuildResourcesTask.class, (t) -> {
TaskProvider<ExportOpenSearchBuildResourcesTask> exportKeyStore = project.getTasks()
.register("copyTestCertificates", ExportOpenSearchBuildResourcesTask.class, (t) -> {
t.copy("test/ssl/test-client.crt");
t.copy("test/ssl/test-client.jks");
t.copy("test/ssl/test-node.crt");
@ -64,7 +64,7 @@ public class TestWithSslPlugin implements Plugin<Project> {
File keystoreDir = new File(project.getBuildDir(), "keystore/test/ssl");
File nodeKeystore = new File(keystoreDir, "test-node.jks");
File clientKeyStore = new File(keystoreDir, "test-client.jks");
NamedDomainObjectContainer<ElasticsearchCluster> clusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
NamedDomainObjectContainer<OpenSearchCluster> clusters = (NamedDomainObjectContainer<OpenSearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
clusters.all(c -> {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.util.List;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
public enum Architecture {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.util.ArrayList;
import java.util.Collection;
@ -38,7 +38,7 @@ import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
/**
* A container for elasticsearch supported version information used in BWC testing.
* A container for opensearch supported version information used in BWC testing.
*
* Parse the Java source file containing the versions declarations and use the known rules to figure out which are all
* the version the current one is wire and index compatible with.
@ -105,7 +105,7 @@ public class BwcVersions {
}
public BwcVersions(List<String> versionLines) {
this(versionLines, Version.fromString(VersionProperties.getElasticsearch()));
this(versionLines, Version.fromString(VersionProperties.getOpenSearch()));
}
protected BwcVersions(List<String> versionLines, Version currentVersionProperty) {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.File;
import java.io.IOException;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
public interface DistributionDependency {
static DistributionDependency of(String dependencyNotation) {

View File

@ -17,15 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.ElasticsearchDistribution.Platform;
import org.elasticsearch.gradle.ElasticsearchDistribution.Type;
import org.elasticsearch.gradle.docker.DockerSupportPlugin;
import org.elasticsearch.gradle.docker.DockerSupportService;
import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform;
import org.elasticsearch.gradle.transform.UnzipTransform;
import org.elasticsearch.gradle.util.GradleUtils;
import org.opensearch.gradle.OpenSearchDistribution.Platform;
import org.opensearch.gradle.OpenSearchDistribution.Type;
import org.opensearch.gradle.docker.DockerSupportPlugin;
import org.opensearch.gradle.docker.DockerSupportService;
import org.opensearch.gradle.transform.SymbolicLinkPreservingUntarTransform;
import org.opensearch.gradle.transform.UnzipTransform;
import org.opensearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
@ -39,7 +39,7 @@ import org.gradle.api.provider.Provider;
import java.util.Comparator;
/**
* A plugin to manage getting and extracting distributions of Elasticsearch.
* A plugin to manage getting and extracting distributions of OpenSearch.
* <p>
* The plugin provides hooks to register custom distribution resolutions.
* This plugin resolves distributions from the Elastic downloads service if
@ -47,15 +47,15 @@ import java.util.Comparator;
*/
public class DistributionDownloadPlugin implements Plugin<Project> {
static final String RESOLUTION_CONTAINER_NAME = "elasticsearch_distributions_resolutions";
private static final String CONTAINER_NAME = "elasticsearch_distributions";
private static final String FAKE_IVY_GROUP = "elasticsearch-distribution";
private static final String FAKE_SNAPSHOT_IVY_GROUP = "elasticsearch-distribution-snapshot";
private static final String DOWNLOAD_REPO_NAME = "elasticsearch-downloads";
private static final String SNAPSHOT_REPO_NAME = "elasticsearch-snapshots";
static final String RESOLUTION_CONTAINER_NAME = "opensearch_distributions_resolutions";
private static final String CONTAINER_NAME = "opensearch_distributions";
private static final String FAKE_IVY_GROUP = "opensearch-distribution";
private static final String FAKE_SNAPSHOT_IVY_GROUP = "opensearch-distribution-snapshot";
private static final String DOWNLOAD_REPO_NAME = "opensearch-downloads";
private static final String SNAPSHOT_REPO_NAME = "opensearch-snapshots";
public static final String DISTRO_EXTRACTED_CONFIG_PREFIX = "es_distro_extracted_";
private NamedDomainObjectContainer<ElasticsearchDistribution> distributionsContainer;
private NamedDomainObjectContainer<OpenSearchDistribution> distributionsContainer;
private NamedDomainObjectContainer<DistributionResolution> distributionsResolutionStrategiesContainer;
@Override
@ -84,11 +84,11 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
}
private void setupDistributionContainer(Project project, Provider<DockerSupportService> dockerSupport) {
distributionsContainer = project.container(ElasticsearchDistribution.class, name -> {
distributionsContainer = project.container(OpenSearchDistribution.class, name -> {
Configuration fileConfiguration = project.getConfigurations().create("es_distro_file_" + name);
Configuration extractedConfiguration = project.getConfigurations().create(DISTRO_EXTRACTED_CONFIG_PREFIX + name);
extractedConfiguration.getAttributes().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
return new ElasticsearchDistribution(name, project.getObjects(), dockerSupport, fileConfiguration, extractedConfiguration);
return new OpenSearchDistribution(name, project.getObjects(), dockerSupport, fileConfiguration, extractedConfiguration);
});
project.getExtensions().add(CONTAINER_NAME, distributionsContainer);
}
@ -103,8 +103,8 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
}
@SuppressWarnings("unchecked")
public static NamedDomainObjectContainer<ElasticsearchDistribution> getContainer(Project project) {
return (NamedDomainObjectContainer<ElasticsearchDistribution>) project.getExtensions().getByName(CONTAINER_NAME);
public static NamedDomainObjectContainer<OpenSearchDistribution> getContainer(Project project) {
return (NamedDomainObjectContainer<OpenSearchDistribution>) project.getExtensions().getByName(CONTAINER_NAME);
}
@SuppressWarnings("unchecked")
@ -114,7 +114,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
// pkg private for tests
void setupDistributions(Project project) {
for (ElasticsearchDistribution distribution : distributionsContainer) {
for (OpenSearchDistribution distribution : distributionsContainer) {
distribution.finalizeValues();
DependencyHandler dependencies = project.getDependencies();
// for the distribution as a file, just depend on the artifact directly
@ -129,7 +129,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
}
}
private DistributionDependency resolveDependencyNotation(Project p, ElasticsearchDistribution distribution) {
private DistributionDependency resolveDependencyNotation(Project p, OpenSearchDistribution distribution) {
return distributionsResolutionStrategiesContainer.stream()
.sorted(Comparator.comparingInt(DistributionResolution::getPriority))
.map(r -> r.getResolver().resolve(p, distribution))
@ -143,7 +143,7 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
repo.setName(name);
repo.setUrl(url);
repo.metadataSources(IvyArtifactRepository.MetadataSources::artifact);
repo.patternLayout(layout -> layout.artifact("/downloads/elasticsearch/[module]-[revision](-[classifier]).[ext]"));
repo.patternLayout(layout -> layout.artifact("/downloads/opensearch/[module]-[revision](-[classifier]).[ext]"));
});
project.getRepositories().exclusiveContent(exclusiveContentRepository -> {
exclusiveContentRepository.filter(config -> config.includeGroup(group));
@ -167,9 +167,9 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
* Maven coordinates point to either the integ-test-zip coordinates on maven central, or a set of artificial
* coordinates that resolve to the Elastic download service through an ivy repository.
*/
private String dependencyNotation(ElasticsearchDistribution distribution) {
private String dependencyNotation(OpenSearchDistribution distribution) {
if (distribution.getType() == Type.INTEG_TEST_ZIP) {
return "org.elasticsearch.distribution.integ-test-zip:elasticsearch:" + distribution.getVersion() + "@zip";
return "org.opensearch.distribution.integ-test-zip:opensearch:" + distribution.getVersion() + "@zip";
}
Version distroVersion = Version.fromString(distribution.getVersion());
@ -193,6 +193,6 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
}
String group = distribution.getVersion().endsWith("-SNAPSHOT") ? FAKE_SNAPSHOT_IVY_GROUP : FAKE_IVY_GROUP;
return group + ":elasticsearch-oss" + ":" + distribution.getVersion() + classifier + "@" + extension;
return group + ":opensearch-oss" + ":" + distribution.getVersion() + classifier + "@" + extension;
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.Project;
@ -51,6 +51,6 @@ public class DistributionResolution {
}
public interface Resolver {
DistributionDependency resolve(Project project, ElasticsearchDistribution distribution);
DistributionDependency resolve(Project project, OpenSearchDistribution distribution);
}
}

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
/**
* This class models the different Docker base images that are used to build Docker distributions of Elasticsearch.
* This class models the different Docker base images that are used to build Docker distributions of OpenSearch.
*/
public enum DockerBase {
CENTOS("centos:8");

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.File;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
@ -40,21 +40,21 @@ import java.util.HashSet;
import java.util.Set;
/**
* Export Elasticsearch build resources to configurable paths
* Export OpenSearch build resources to configurable paths
* <p>
* Wil overwrite existing files and create missing directories.
* Useful for resources that that need to be passed to other processes trough the filesystem or otherwise can't be
* consumed from the classpath.
*/
public class ExportElasticsearchBuildResourcesTask extends DefaultTask {
public class ExportOpenSearchBuildResourcesTask extends DefaultTask {
private final Logger logger = Logging.getLogger(ExportElasticsearchBuildResourcesTask.class);
private final Logger logger = Logging.getLogger(ExportOpenSearchBuildResourcesTask.class);
private final Set<String> resources = new HashSet<>();
private DirectoryProperty outputDir;
public ExportElasticsearchBuildResourcesTask() {
public ExportOpenSearchBuildResourcesTask() {
outputDir = getProject().getObjects().directoryProperty();
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.File;
import java.util.function.Supplier;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.tasks.WorkResult;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.Buildable;
import org.gradle.api.artifacts.Configuration;

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.transform.SymbolicLinkPreservingUntarTransform;
import org.elasticsearch.gradle.transform.UnzipTransform;
import org.opensearch.gradle.transform.SymbolicLinkPreservingUntarTransform;
import org.opensearch.gradle.transform.UnzipTransform;
import org.gradle.api.GradleException;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.tasks.Input;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.Named;
import org.gradle.api.tasks.Input;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.Action;
import org.gradle.api.GradleException;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.util.Arrays;
import java.util.HashMap;

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.docker.DockerSupportService;
import org.opensearch.gradle.docker.DockerSupportService;
import org.gradle.api.Buildable;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.model.ObjectFactory;
@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.Locale;
public class ElasticsearchDistribution implements Buildable, Iterable<File> {
public class OpenSearchDistribution implements Buildable, Iterable<File> {
public enum Platform {
LINUX,
@ -90,7 +90,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
private final Property<Boolean> failIfUnavailable;
private final Configuration extracted;
ElasticsearchDistribution(
OpenSearchDistribution(
String name,
ObjectFactory objectFactory,
Provider<DockerSupportService> dockerSupport,
@ -101,7 +101,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
this.dockerSupport = dockerSupport;
this.configuration = fileConfiguration;
this.architecture = objectFactory.property(Architecture.class);
this.version = objectFactory.property(String.class).convention(VersionProperties.getElasticsearch());
this.version = objectFactory.property(String.class).convention(VersionProperties.getOpenSearch());
this.type = objectFactory.property(Type.class);
this.type.convention(Type.ARCHIVE);
this.platform = objectFactory.property(Platform.class);
@ -183,7 +183,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
case DOCKER:
case RPM:
throw new UnsupportedOperationException(
"distribution type [" + getType() + "] for " + "elasticsearch distribution [" + name + "] cannot be extracted"
"distribution type [" + getType() + "] for " + "opensearch distribution [" + name + "] cannot be extracted"
);
default:
@ -212,13 +212,13 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
if (getType() == Type.INTEG_TEST_ZIP) {
if (platform.getOrNull() != null) {
throw new IllegalArgumentException(
"platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
"platform cannot be set on opensearch 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]"
"bundledJdk cannot be set on opensearch distribution [" + name + "] of type [integ_test_zip]"
);
}
return;
@ -226,7 +226,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
if (isDocker() == false && failIfUnavailable.get() == false) {
throw new IllegalArgumentException(
"failIfUnavailable cannot be 'false' on elasticsearch distribution [" + name + "] of type [" + getType() + "]"
"failIfUnavailable cannot be 'false' on opensearch distribution [" + name + "] of type [" + getType() + "]"
);
}
@ -238,13 +238,13 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
} else { // rpm, deb or docker
if (platform.isPresent()) {
throw new IllegalArgumentException(
"platform cannot be set on elasticsearch distribution [" + name + "] of type [" + getType() + "]"
"platform cannot be set on opensearch distribution [" + name + "] of type [" + getType() + "]"
);
}
if (isDocker()) {
if (bundledJdk.isPresent()) {
throw new IllegalArgumentException(
"bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type " + "[docker]"
"bundledJdk cannot be set on opensearch distribution [" + name + "] of type " + "[docker]"
);
}
}

View File

@ -17,14 +17,14 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
import nebula.plugin.info.InfoBrokerPlugin;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.precommit.PrecommitTaskPlugin;
import org.elasticsearch.gradle.util.Util;
import org.opensearch.gradle.info.BuildParams;
import org.opensearch.gradle.info.GlobalBuildInfoPlugin;
import org.opensearch.gradle.precommit.PrecommitTaskPlugin;
import org.opensearch.gradle.util.Util;
import org.gradle.api.Action;
import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin;
@ -54,12 +54,12 @@ import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import static org.elasticsearch.gradle.util.Util.toStringable;
import static org.opensearch.gradle.util.Util.toStringable;
/**
* A wrapper around Gradle's Java plugin that applies our common configuration.
*/
public class ElasticsearchJavaPlugin implements Plugin<Project> {
public class OpenSearchJavaPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
// make sure the global build info plugin is applied to the root project
@ -67,7 +67,7 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
// common repositories setup
project.getPluginManager().apply(RepositoriesSetupPlugin.class);
project.getPluginManager().apply(JavaLibraryPlugin.class);
project.getPluginManager().apply(ElasticsearchTestBasePlugin.class);
project.getPluginManager().apply(OpenSearchTestBasePlugin.class);
project.getPluginManager().apply(PrecommitTaskPlugin.class);
configureConfigurations(project);
@ -122,7 +122,7 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
config.getDependencies().all(dep -> {
if (dep instanceof ModuleDependency
&& dep instanceof ProjectDependency == false
&& dep.getGroup().startsWith("org.elasticsearch") == false) {
&& dep.getGroup().startsWith("org.opensearch") == false) {
((ModuleDependency) dep).setTransitive(false);
}
});
@ -258,11 +258,11 @@ public class ElasticsearchJavaPlugin implements Plugin<Project> {
project.getPlugins().withType(InfoBrokerPlugin.class).whenPluginAdded(manifestPlugin -> {
manifestPlugin.add("Module-Origin", toStringable(BuildParams::getGitOrigin));
manifestPlugin.add("Change", toStringable(BuildParams::getGitRevision));
manifestPlugin.add("X-Compile-Elasticsearch-Version", toStringable(VersionProperties::getElasticsearch));
manifestPlugin.add("X-Compile-OpenSearch-Version", toStringable(VersionProperties::getOpenSearch));
manifestPlugin.add("X-Compile-Lucene-Version", toStringable(VersionProperties::getLucene));
manifestPlugin.add(
"X-Compile-Elasticsearch-Snapshot",
toStringable(() -> Boolean.toString(VersionProperties.isElasticsearchSnapshot()))
"X-Compile-OpenSearch-Snapshot",
toStringable(() -> Boolean.toString(VersionProperties.isOpenSearchSnapshot()))
);
});

View File

@ -17,13 +17,13 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.test.ErrorReportingTestListener;
import org.elasticsearch.gradle.util.Util;
import org.opensearch.gradle.info.BuildParams;
import org.opensearch.gradle.info.GlobalBuildInfoPlugin;
import org.opensearch.gradle.test.ErrorReportingTestListener;
import org.opensearch.gradle.util.Util;
import org.gradle.api.Action;
import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin;
@ -38,13 +38,13 @@ import org.gradle.api.tasks.testing.Test;
import java.io.File;
import java.util.Map;
import static org.elasticsearch.gradle.util.FileUtils.mkdirs;
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure;
import static org.opensearch.gradle.util.FileUtils.mkdirs;
import static org.opensearch.gradle.util.GradleUtils.maybeConfigure;
/**
* Applies commonly used settings to all Test tasks in the project
*/
public class ElasticsearchTestBasePlugin implements Plugin<Project> {
public class OpenSearchTestBasePlugin implements Plugin<Project> {
@Override
public void apply(Project project) {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
public enum PropertyNormalization {
/**

View File

@ -17,15 +17,15 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin;
import com.github.jengelman.gradle.plugins.shadow.ShadowExtension;
import groovy.util.Node;
import groovy.util.NodeList;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.precommit.PomValidationPrecommitPlugin;
import org.elasticsearch.gradle.util.Util;
import org.opensearch.gradle.info.BuildParams;
import org.opensearch.gradle.precommit.PomValidationPrecommitPlugin;
import org.opensearch.gradle.util.Util;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
@ -44,7 +44,7 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin;
import java.util.concurrent.Callable;
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure;
import static org.opensearch.gradle.util.GradleUtils.maybeConfigure;
public class PublishPlugin implements Plugin<Project> {
@ -131,7 +131,7 @@ public class PublishPlugin implements Plugin<Project> {
/** Adds a javadocJar task to generate a jar containing javadocs. */
private static void configureJavadocJar(Project project) {
project.getPlugins().withId("elasticsearch.java", p -> {
project.getPlugins().withId("opensearch.java", p -> {
TaskProvider<Jar> javadocJarTask = project.getTasks().register("javadocJar", Jar.class);
javadocJarTask.configure(jar -> {
jar.getArchiveClassifier().set("javadoc");
@ -144,7 +144,7 @@ public class PublishPlugin implements Plugin<Project> {
}
static void configureSourcesJar(Project project) {
project.getPlugins().withId("elasticsearch.java", p -> {
project.getPlugins().withId("opensearch.java", p -> {
TaskProvider<Jar> sourcesJarTask = project.getTasks().register("sourcesJar", Jar.class);
sourcesJarTask.configure(jar -> {
jar.getArchiveClassifier().set("sources");

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.opensearch.gradle.info.GlobalBuildInfoPlugin;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.elasticsearch.gradle.info.BuildParams;
import org.opensearch.gradle.info.BuildParams;
import org.gradle.api.GradleException;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
@ -39,7 +39,7 @@ import java.util.regex.Pattern;
public class ReaperService {
private static final String REAPER_CLASS = "org/elasticsearch/gradle/reaper/Reaper.class";
private static final String REAPER_CLASS = "org/opensearch/gradle/reaper/Reaper.class";
private static final Pattern REAPER_JAR_PATH_PATTERN = Pattern.compile("file:(.*)!/" + REAPER_CLASS);
private final Logger logger;
private final boolean isInternal;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.process.CommandLineArgumentProvider;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import org.gradle.api.tasks.Input;
import org.gradle.process.CommandLineArgumentProvider;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.util.Objects;
import java.util.regex.Matcher;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle;
package org.opensearch.gradle;
import java.io.IOException;
import java.io.InputStream;
@ -25,16 +25,16 @@ import java.util.Map;
import java.util.Properties;
/**
* Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions.
* Accessor for shared dependency versions used by opensearch, namely the opensearch and lucene versions.
*/
public class VersionProperties {
public static String getElasticsearch() {
return elasticsearch;
public static String getOpenSearch() {
return opensearch;
}
public static Version getElasticsearchVersion() {
return Version.fromString(elasticsearch);
public static Version getOpenSearchVersion() {
return Version.fromString(opensearch);
}
public static String getLucene() {
@ -63,7 +63,7 @@ public class VersionProperties {
return versions;
}
private static final String elasticsearch;
private static final String opensearch;
private static final String lucene;
private static final String bundledJdkDarwin;
private static final String bundledJdkLinux;
@ -73,7 +73,7 @@ public class VersionProperties {
static {
Properties props = getVersionProperties();
elasticsearch = props.getProperty("elasticsearch");
opensearch = props.getProperty("opensearch");
lucene = props.getProperty("lucene");
bundledJdkVendor = props.getProperty("bundled_jdk_vendor");
final String bundledJdk = props.getProperty("bundled_jdk");
@ -100,7 +100,7 @@ public class VersionProperties {
return props;
}
public static boolean isElasticsearchSnapshot() {
return elasticsearch.endsWith("-SNAPSHOT");
public static boolean isOpenSearchSnapshot() {
return opensearch.endsWith("-SNAPSHOT");
}
}

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.checkstyle;
package org.opensearch.gradle.checkstyle;
import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.gradle.dependencies;
package org.opensearch.gradle.dependencies;
import org.gradle.api.NamedDomainObjectProvider;
import org.gradle.api.Plugin;

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.docker;
package org.opensearch.gradle.docker;
import org.elasticsearch.gradle.LoggedExec;
import org.opensearch.gradle.LoggedExec;
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.file.DirectoryProperty;

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.docker;
package org.opensearch.gradle.docker;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
@ -29,7 +29,7 @@ import java.util.stream.Collectors;
/**
* Plugin providing {@link DockerSupportService} for detecting Docker installations and determining requirements for Docker-based
* Elasticsearch build tasks.
* OpenSearch build tasks.
*/
public class DockerSupportPlugin implements Plugin<Project> {
public static final String DOCKER_SUPPORT_SERVICE_NAME = "dockerSupportService";

View File

@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.gradle.docker;
package org.opensearch.gradle.docker;
import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.info.BuildParams;
import org.opensearch.gradle.Version;
import org.opensearch.gradle.info.BuildParams;
import org.gradle.api.GradleException;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
@ -44,7 +44,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
/**
* Build service for detecting available Docker installation and checking for compatibility with Elasticsearch Docker image build
* Build service for detecting available Docker installation and checking for compatibility with OpenSearch Docker image build
* requirements. This includes a minimum version requirement, as well as the ability to run privileged commands.
*/
public abstract class DockerSupportService implements BuildService<DockerSupportService.Parameters> {

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