diff --git a/build.gradle b/build.gradle index 9bb08cf29dbbc..dc67294f3d140 100644 --- a/build.gradle +++ b/build.gradle @@ -575,3 +575,29 @@ gradle.projectsEvaluated { } } } + +apply plugin: 'compare-gradle-builds' + +if (System.properties.get("build.compare") != null) { + compareGradleBuilds { + ext.referenceProject = System.properties.get("build.compare") + doFirst { + if (file(referenceProject).exists() == false) { + throw new GradleException( + "Use git worktree to check out a version to compare against to ../elasticsearch_build_reference" + ) + } + } + sourceBuild { + gradleVersion = "4.7" // does not default to gradle weapper of project dir, but current version + projectDir = referenceProject + tasks = ["clean", "assemble"] + arguments = ["-Dbuild.compare_friendly=true"] + } + targetBuild { + tasks = ["clean", "assemble"] + // use -Dorg.gradle.java.home= to alter jdk versions + arguments = ["-Dbuild.compare_friendly=true"] + } + } +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 5256968b6ca3e..9c139eee2152a 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -106,7 +106,6 @@ GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3' dependencies { compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}" - compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1 } /***************************************************************************** diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index eb3cd1dc8c6da..e69fc3821a768 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -348,7 +348,11 @@ class BuildPlugin implements Plugin { // just a self contained test-fixture configuration, likely transitive and hellacious return } - configuration.resolutionStrategy.failOnVersionConflict() + configuration.resolutionStrategy { + failOnVersionConflict() + // work around https://github.com/gradle/gradle/issues/5692 + preferProjectModules() + } }) // force all dependencies added directly to compile/testCompile to be non-transitive, except for ES itself @@ -475,13 +479,17 @@ class BuildPlugin implements Plugin { } } - project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t -> - // place the pom next to the jar it is for - t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom") - // build poms with assemble (if the assemble task exists) - Task assemble = project.tasks.findByName('assemble') - if (assemble) { - assemble.dependsOn(t) + // Work around Gradle 4.8 issue until we `enableFeaturePreview('STABLE_PUBLISHING')` + // https://github.com/gradle/gradle/issues/5696#issuecomment-396965185 + project.getGradle().getTaskGraph().whenReady { + project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t -> + // place the pom next to the jar it is for + t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom") + // build poms with assemble (if the assemble task exists) + Task assemble = project.tasks.findByName('assemble') + if (assemble) { + assemble.dependsOn(t) + } } } } @@ -625,6 +633,10 @@ class BuildPlugin implements Plugin { jarTask.manifest.attributes('Change': shortHash) } } + // Force manifest entries that change by nature to a constant to be able to compare builds more effectively + if (System.properties.getProperty("build.compare_friendly", "false") == "true") { + jarTask.manifest.getAttributes().clear() + } } // add license/notice files project.afterEvaluate { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a5fe1cb94b9ee..f5a7e5e1fcf56 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 7962563f742fe..dc0be816f0f97 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip zipStoreBase=GRADLE_USER_HOME -distributionSha256Sum=203f4537da8b8075e38c036a6d14cb71b1149de5bf0a8f6db32ac2833a1d1294 +zipStorePath=wrapper/dists +distributionSha256Sum=da9600da2a28a43f5f77364deecbb9b01c1ddb7d3ecafe1d5c93bcd8a8059ab1 diff --git a/server/src/main/java/org/elasticsearch/bootstrap/Security.java b/server/src/main/java/org/elasticsearch/bootstrap/Security.java index 734b15d509877..ca2a0ca3ed810 100644 --- a/server/src/main/java/org/elasticsearch/bootstrap/Security.java +++ b/server/src/main/java/org/elasticsearch/bootstrap/Security.java @@ -221,14 +221,16 @@ static Policy readPolicy(URL policyFile, Map codebases) { if (aliasProperty.equals(property) == false) { propertiesSet.add(aliasProperty); String previous = System.setProperty(aliasProperty, url.toString()); - if (previous != null) { + // allow to re-set to what was previously there. https://github.com/elastic/elasticsearch/issues/31324 + if (previous != null && url.toString().equals(previous) == false) { throw new IllegalStateException("codebase property already set: " + aliasProperty + " -> " + previous + ", cannot set to " + url.toString()); } } propertiesSet.add(property); String previous = System.setProperty(property, url.toString()); - if (previous != null) { + // allow to re-set to what was previously there. https://github.com/elastic/elasticsearch/issues/31324 + if (previous != null && url.toString().equals(previous) == false) { throw new IllegalStateException("codebase property already set: " + property + " -> " + previous + ", cannot set to " + url.toString()); }