-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Upgrade to Gradle Wrapper 4.8 #31271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
060e00a
26f0d17
1011582
5445055
c7338af
ab67b25
2e8cb7e
3a2e7bf
eec1f43
d0f7e94
3f5840a
e7715c5
89590fb
c406996
09c92de
e1b579d
2f71509
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} | ||
|
||
/***************************************************************************** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,7 +348,11 @@ class BuildPlugin implements Plugin<Project> { | |
// 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> { | |
} | ||
} | ||
|
||
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<Project> { | |
jarTask.manifest.attributes('Change': shortHash) | ||
} | ||
} | ||
// Force manifest entries that change by nature to a constant to be able to compare builds more effectively | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel the same way about this one too. Until we need it again it'll sit there making folks wonder "when do we set this!?" and when we finally go to use it again we'll need to make other changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is worth adding something like "when comparing builds, force manifest entries..." that way it is clear to the reader that we only do this when it is required to compare builds. |
||
if (System.properties.getProperty("build.compare_friendly", "false") == "true") { | ||
jarTask.manifest.getAttributes().clear() | ||
} | ||
} | ||
// add license/notice files | ||
project.afterEvaluate { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,14 +221,16 @@ static Policy readPolicy(URL policyFile, Map<String, URL> 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I pulled this locally and reverted the changes to this file I didn't have any trouble. We've traditionally been very weary of making changes to this file so I'd really like to make sure we need this before we do it, even if it is temporary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, wait, I just got it! Neat. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it is caused by gradle not passing any system properties to the test sometimes. We use the absence of a system property set by gradle to engage "IDE mode" when running tests which mucks with the security features a bit. If you run tests from gradle in IDE mode they won't work right. Security, at least, won't work right. If these were to happen for other tests then it'd explode in other ways. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've dug some more. This is caused by us running the tests with the built in gradle test runner rather than the randomized runner. We configure the randomized runner to run with the system properties but we don't ever configure the standard runner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And some more: this is not caused by the build compare plugin. Maybe by gradle 4.8 or maybe by one of our hacks to make 4.8 work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok - I reverted the 4.8 change locally but kept the other changes and everything looks to work. I don't think we can upgrade to 4.8 until we get to the bottom of this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for looking into this @nik9000. I'll create a feature branch. I was under the impression that we always replace the Gradle test runner with the randomized one. I wonder if for some reason that doesn't happen, or doesn't always happen for some reason. I did have a suspicion that we are not running with the randomized runner, but when I looked at it I didn't find evidence of this being the case. |
||
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()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should keep this long term. I just feel like we won't need it again for six months and when we want it again we'll have to edit all of this to make it work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth applying the plugin at all if we don't have
build.compare
set?