Upgrade to Gradle 5.0 (#34263)
This commit is contained in:
parent
4c2e0d76f3
commit
59b0900174
|
@ -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'
|
||||
|
|
|
@ -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."
|
||||
)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -69,7 +69,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
+ '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<Project> {
|
|||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<Boolean> 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<Boolean> 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/**'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -464,9 +464,9 @@ class VagrantTestPlugin implements Plugin<Project> {
|
|||
* 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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
4.10
|
||||
5.0
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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]'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,4 @@ if (extraProjects.exists()) {
|
|||
}
|
||||
}
|
||||
|
||||
// enable in preparation for Gradle 5.0
|
||||
enableFeaturePreview('STABLE_PUBLISHING')
|
||||
|
||||
project(":libs:cli").name = 'elasticsearch-cli'
|
||||
|
|
Loading…
Reference in New Issue