diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle index 0dc1565e235..a1e4d16a27c 100644 --- a/benchmarks/build.gradle +++ b/benchmarks/build.gradle @@ -33,7 +33,7 @@ dependencies { exclude group: 'net.sf.jopt-simple', module: 'jopt-simple' } compile "org.openjdk.jmh:jmh-core:$versions.jmh" - compile "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh" + annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh" // Dependencies of JMH runtime 'net.sf.jopt-simple:jopt-simple:4.6' runtime 'org.apache.commons:commons-math3:3.2' diff --git a/build.gradle b/build.gradle index 080119bfe57..7e067b89978 100644 --- a/build.gradle +++ b/build.gradle @@ -24,13 +24,16 @@ import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.VersionCollection import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.plugin.PluginBuildPlugin +import org.gradle.api.tasks.options.Option +import org.gradle.util.GradleVersion +import org.gradle.util.DistributionLocator import org.gradle.plugins.ide.eclipse.model.SourceFolder import com.carrotsearch.gradle.junit4.RandomizedTestingTask import java.util.function.Predicate plugins { - id 'com.gradle.build-scan' version '1.13.2' + id 'com.gradle.build-scan' version '2.0.2' id 'base' } if (properties.get("org.elasticsearch.acceptScanTOS", "false") == "true") { @@ -527,7 +530,7 @@ allprojects { class Run extends DefaultTask { boolean debug = false - @org.gradle.api.internal.tasks.options.Option( + @Option( option = "debug-jvm", description = "Enable debugging configuration, to allow attaching a debugger to elasticsearch." ) diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy index 7de0ac62d42..005e43b9db4 100644 --- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy +++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy @@ -125,7 +125,7 @@ class TestProgressLogger implements AggregatedEventListener { @Subscribe void onTestResult(AggregatedTestResultEvent e) throws IOException { - final String statusMessage + String statusMessage testsCompleted++ switch (e.status) { case ERROR: diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 92047aca066..7a57d7c7119 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -69,7 +69,7 @@ class BuildPlugin implements Plugin { + 'elasticsearch.standalone-rest-test, and elasticsearch.build ' + 'are mutually exclusive') } - final String minimumGradleVersion + String minimumGradleVersion = null InputStream is = getClass().getResourceAsStream("/minimumGradleVersion") try { minimumGradleVersion = IOUtils.toString(is, StandardCharsets.UTF_8.toString()) } finally { is.close() } if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion.trim())) { @@ -233,7 +233,7 @@ class BuildPlugin implements Plugin { } private static String findCompilerJavaHome() { - final String compilerJavaHome = System.getenv('JAVA_HOME') + String compilerJavaHome = System.getenv('JAVA_HOME') final String compilerJavaProperty = System.getProperty('compiler.java') if (compilerJavaProperty != null) { compilerJavaHome = findJavaHome(compilerJavaProperty) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy index bf06ac34766..9fdb1b41ec0 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy @@ -190,8 +190,7 @@ class PrecommitTasks { Task checkstyleTask = project.tasks.create('checkstyle') // Apply the checkstyle plugin to create `checkstyleMain` and `checkstyleTest`. It only // creates them if there is main or test code to check and it makes `check` depend - // on them. But we want `precommit` to depend on `checkstyle` which depends on them so - // we have to swap them. + // on them. We also want `precommit` to depend on `checkstyle`. project.pluginManager.apply('checkstyle') project.checkstyle { config = project.resources.text.fromFile(checkstyleConf, 'UTF-8') @@ -202,7 +201,6 @@ class PrecommitTasks { } project.tasks.withType(Checkstyle) { task -> - project.tasks[JavaBasePlugin.CHECK_TASK_NAME].dependsOn.remove(task) checkstyleTask.dependsOn(task) task.dependsOn(copyCheckstyleConf) task.inputs.file(checkstyleSuppressions) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index 28c212235f3..86e048e93dc 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -111,8 +111,8 @@ class ClusterFormationTasks { for (int i = 0; i < config.numNodes; i++) { // 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 - final Configuration distro - final String elasticsearchVersion + Configuration distro + String elasticsearchVersion if (i < config.numBwcNodes) { elasticsearchVersion = config.bwcVersion.toString() if (project.bwcVersions.unreleased.contains(config.bwcVersion)) { @@ -595,7 +595,7 @@ class ClusterFormationTasks { } static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, String pluginName, String prefix) { - final FileCollection pluginZip; + FileCollection pluginZip; if (node.nodeVersion != Version.fromString(VersionProperties.elasticsearch)) { pluginZip = project.configurations.getByName(pluginBwcConfigurationName(prefix, pluginName)) } else { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy index 689cf5bf2ed..c91bc57204d 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy @@ -25,12 +25,12 @@ import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.execution.TaskExecutionAdapter -import org.gradle.api.internal.tasks.options.Option import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.api.tasks.Copy import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskState +import org.gradle.api.tasks.options.Option import org.gradle.plugins.ide.idea.IdeaPlugin import java.nio.charset.StandardCharsets @@ -53,7 +53,7 @@ public class RestIntegTestTask extends DefaultTask { /** Flag indicating whether the rest tests in the rest spec should be run. */ @Input - Property includePackaged = project.objects.property(Boolean) + Boolean includePackaged = false public RestIntegTestTask() { runner = project.tasks.create("${name}Runner", RandomizedTestingTask.class) @@ -109,7 +109,7 @@ public class RestIntegTestTask extends DefaultTask { } // copy the rest spec/tests into the test resources - Task copyRestSpec = createCopyRestSpecTask(project, includePackaged) + Task copyRestSpec = createCopyRestSpecTask() runner.dependsOn(copyRestSpec) // this must run after all projects have been configured, so we know any project @@ -130,7 +130,7 @@ public class RestIntegTestTask extends DefaultTask { /** Sets the includePackaged property */ public void includePackaged(boolean include) { - includePackaged.set(include) + includePackaged = include } @Option( @@ -215,7 +215,7 @@ public class RestIntegTestTask extends DefaultTask { * @param project The project to add the copy task to * @param includePackagedTests true if the packaged tests should be copied, false otherwise */ - static Task createCopyRestSpecTask(Project project, Provider includePackagedTests) { + Task createCopyRestSpecTask() { project.configurations { restSpec } @@ -237,7 +237,7 @@ public class RestIntegTestTask extends DefaultTask { project.afterEvaluate { copyRestSpec.from({ project.zipTree(project.configurations.restSpec.singleFile) }) { include 'rest-api-spec/api/**' - if (includePackagedTests.get()) { + if (includePackaged) { include 'rest-api-spec/test/**' } } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RunTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RunTask.groovy index a88152d7865..cdadc78e9ae 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RunTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RunTask.groovy @@ -2,7 +2,7 @@ package org.elasticsearch.gradle.test import org.gradle.api.DefaultTask import org.gradle.api.Task -import org.gradle.api.internal.tasks.options.Option +import org.gradle.api.tasks.options.Option import org.gradle.util.ConfigureUtil public class RunTask extends DefaultTask { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy index 06519e4f20c..aabd0cf1192 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy @@ -464,9 +464,9 @@ class VagrantTestPlugin implements Plugin { * execution. */ final String vagrantDestroyProperty = project.getProperties().get('vagrant.destroy', 'true') - final boolean vagrantDestroy + boolean vagrantDestroy if ("true".equals(vagrantDestroyProperty)) { - vagrantDestroy = true; + vagrantDestroy = true } else if ("false".equals(vagrantDestroyProperty)) { vagrantDestroy = false } else { diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTask.java index 4af104093a5..cb771846510 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTask.java @@ -56,9 +56,8 @@ public class ExportElasticsearchBuildResourcesTask extends DefaultTask { private DirectoryProperty outputDir; public ExportElasticsearchBuildResourcesTask() { - outputDir = getProject().getLayout().directoryProperty( - getProject().getLayout().getBuildDirectory().dir("build-tools-exported") - ); + outputDir = getProject().getObjects().directoryProperty(); + outputDir.set(new File(getProject().getBuildDir(), "build-tools-exported")); } @OutputDirectory diff --git a/buildSrc/src/main/resources/minimumGradleVersion b/buildSrc/src/main/resources/minimumGradleVersion index 9add3349f9e..6e636605163 100644 --- a/buildSrc/src/main/resources/minimumGradleVersion +++ b/buildSrc/src/main/resources/minimumGradleVersion @@ -1 +1 @@ -4.10 \ No newline at end of file +5.0 \ No newline at end of file diff --git a/buildSrc/src/testKit/elasticsearch-build-resources/settings.gradle b/buildSrc/src/testKit/elasticsearch-build-resources/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buildSrc/src/testKit/elasticsearch.build/settings.gradle b/buildSrc/src/testKit/elasticsearch.build/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buildSrc/src/testKit/jarHell/settings.gradle b/buildSrc/src/testKit/jarHell/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buildSrc/src/testKit/namingConventionsSelfTest/settings.gradle b/buildSrc/src/testKit/namingConventionsSelfTest/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buildSrc/src/testKit/testclusters/settings.gradle b/buildSrc/src/testKit/testclusters/settings.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/client/rest-high-level/build.gradle b/client/rest-high-level/build.gradle index 6cfcebff290..e5dbf74cec5 100644 --- a/client/rest-high-level/build.gradle +++ b/client/rest-high-level/build.gradle @@ -36,9 +36,17 @@ publishing { } } -//we need to copy the yaml spec so we can check naming (see RestHighlevelClientTests#testApiNamingConventions) -Task copyRestSpec = RestIntegTestTask.createCopyRestSpecTask(project, Providers.FALSE) -test.dependsOn(copyRestSpec) +configurations { + restSpec +} + +idea { + module { + if (scopes.TEST != null) { + scopes.TEST.plus.add(project.configurations.restSpec) + } + } +} dependencies { /* @@ -59,6 +67,16 @@ dependencies { testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}" //this is needed to make RestHighLevelClientTests#testApiNamingConventions work from IDEs testCompile "org.elasticsearch:rest-api-spec:${version}" + + restSpec "org.elasticsearch:rest-api-spec:${version}" +} + +//we need to copy the yaml spec so we can check naming (see RestHighlevelClientTests#testApiNamingConventions) +processTestResources { + dependsOn jar // so that configurations resolve + from({ zipTree(configurations.restSpec.singleFile) }) { + include 'rest-api-spec/api/**' + } } dependencyLicenses { diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index 0269e4399ce..7ab7e671ac2 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -151,7 +151,7 @@ subprojects { } // sanity checks if archives can be extracted - final File archiveExtractionDir + File archiveExtractionDir if (project.name.contains('tar')) { archiveExtractionDir = new File(buildDir, 'tar-extracted') } else { @@ -179,7 +179,7 @@ subprojects { } } - final Closure toolExists + Closure toolExists if (project.name.contains('tar')) { toolExists = tarExists } else { @@ -192,7 +192,7 @@ subprojects { dependsOn buildDist, checkExtraction onlyIf toolExists doLast { - final String licenseFilename + String licenseFilename = null if (project.name.contains('oss-') || project.name == 'integ-test-zip') { licenseFilename = "APACHE-LICENSE-2.0.txt" } else { diff --git a/distribution/bwc/build.gradle b/distribution/bwc/build.gradle index 0b59749f953..957fc03532a 100644 --- a/distribution/bwc/build.gradle +++ b/distribution/bwc/build.gradle @@ -45,7 +45,7 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre final String remote = System.getProperty("tests.bwc.remote", "elastic") - final boolean gitFetchLatest + boolean gitFetchLatest final String gitFetchLatestProperty = System.getProperty("tests.bwc.git_fetch_latest", "true") if ("true".equals(gitFetchLatestProperty)) { gitFetchLatest = true diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index 02765fab8eb..cf858702784 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -359,7 +359,7 @@ subprojects { // sanity checks if packages can be extracted final File extractionDir = new File(buildDir, 'extracted') - final File packageExtractionDir + File packageExtractionDir if (project.name.contains('deb')) { packageExtractionDir = new File(extractionDir, 'deb-extracted') } else { @@ -406,9 +406,9 @@ subprojects { checkLicense { onlyIf dpkgExists doLast { - final Path copyrightPath - final String expectedLicense - final String licenseFilename + Path copyrightPath + String expectedLicense + String licenseFilename if (project.name.contains('oss-')) { copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch-oss/copyright") expectedLicense = "ASL-2.0" @@ -431,7 +431,7 @@ subprojects { checkLicense { onlyIf rpmExists doLast { - final String licenseFilename + String licenseFilename if (project.name.contains('oss-')) { licenseFilename = "APACHE-LICENSE-2.0.txt" } else { @@ -466,7 +466,7 @@ subprojects { exec.commandLine 'dpkg-deb', '--info', "${ -> buildDist.outputs.files.filter(debFilter).singleFile}" exec.standardOutput = output doLast { - final String expectedLicense + String expectedLicense if (project.name.contains('oss-')) { expectedLicense = "ASL-2.0" } else { @@ -502,8 +502,8 @@ subprojects { exec.commandLine 'rpm', '-qp', '--queryformat', '%{License}', "${-> buildDist.outputs.files.singleFile}" exec.standardOutput = output doLast { - final String license = output.toString('UTF-8') - final String expectedLicense + String license = output.toString('UTF-8') + String expectedLicense if (project.name.contains('oss-')) { expectedLicense = "ASL 2.0" } else { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 28861d273a5..457aad0d981 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 76d8f343e75..5333afa71b6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=fc049dcbcb245d5892bebae143bd515a78f6a5a93cec99d489b312dc0ce4aad9 +distributionSha256Sum=17847c8e12b2bcfce26a79f425f082c31d4ded822f99a66127eee2d96bf18216 diff --git a/gradlew b/gradlew index cccdd3d517f..af6708ff229 100755 --- a/gradlew +++ b/gradlew @@ -28,7 +28,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d6a2c..0f8d5937c4a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/plugins/repository-s3/build.gradle b/plugins/repository-s3/build.gradle index 3e6c7a1318d..9240e790d96 100644 --- a/plugins/repository-s3/build.gradle +++ b/plugins/repository-s3/build.gradle @@ -145,8 +145,8 @@ final String minioBinDir = "${buildDir}/minio/bin" final String minioDataDir = "${buildDir}/minio/data" final String minioAddress = "127.0.0.1" -final String minioDistribution -final String minioCheckSum +String minioDistribution +String minioCheckSum if (Os.isFamily(Os.FAMILY_MAC)) { minioDistribution = 'darwin-amd64' minioCheckSum = '96b0bcb2f590e8e65fb83d5c3e221f9bd1106b49fa6f22c6b726b80b845d7c60' diff --git a/qa/wildfly/build.gradle b/qa/wildfly/build.gradle index 4ff2cc5eeb1..2e380ce5e30 100644 --- a/qa/wildfly/build.gradle +++ b/qa/wildfly/build.gradle @@ -38,7 +38,7 @@ repositories { // the Wildfly distribution is not available via a repository, so we fake an Ivy repository on top of the download site ivy { url "http://download.jboss.org" - layout 'pattern', { + patternLayout { artifact 'wildfly/[revision]/[module]-[revision].[ext]' } } diff --git a/settings.gradle b/settings.gradle index c5acf583000..b6e57582f6d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -139,7 +139,4 @@ if (extraProjects.exists()) { } } -// enable in preparation for Gradle 5.0 -enableFeaturePreview('STABLE_PUBLISHING') - project(":libs:cli").name = 'elasticsearch-cli'