Skip to content
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

Upgrade to Gradle 5.0 #34263

Merged
merged 33 commits into from
Dec 5, 2018
Merged

Upgrade to Gradle 5.0 #34263

merged 33 commits into from
Dec 5, 2018

Conversation

alpar-t
Copy link
Contributor

@alpar-t alpar-t commented Oct 3, 2018

  • Upgrade to Greadle 5.0
  • updates to comply with breaking changes in Groovy.
    It seems like the latest version brought along by Gradle changes how the final keyword is interpreted,
    unfortunately it can't see past branches so it doesn't work like ti would in java.

This is a work in progress to get the tests running. Will only merge when Gradle 5.0 is GA.

Release Notes: https://github.com/gradle/gradle/releases/tag/v5.0.0

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one question, but I also don't think we should upgrade to a milestone release. This is like upgrading to a beta.

@@ -563,7 +563,7 @@ class ClusterFormationTasks {
}

static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, String pluginName, String prefix) {
final FileCollection pluginZip;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is final removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not merge the PR until there is a GA, just wanted to start running in CI.

Gradle bumps the Groovy version, which now complains that the final variable is changed.
It doesn't see past branches the same way java does. One more reason to switch to java.

@alpar-t
Copy link
Contributor Author

alpar-t commented Oct 18, 2018

@elasticmachine test this please

@alpar-t
Copy link
Contributor Author

alpar-t commented Oct 19, 2018

@elasticmachine test this please

@colings86 colings86 added v6.6.0 and removed v6.5.0 labels Oct 25, 2018
@alpar-t alpar-t changed the title Upgrade to Gradle 5.0 Milestone 1 Upgrade to Gradle 5.0 RC 1 Nov 2, 2018
@@ -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() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static method was called with the value of includePackagedTests in what happened to be the right order so that changes to the property were picked up in time and the right value was passed into the project.afterEvaluate ( which had no use, since the value was already picked up anyhow ).
This can't be static to make changes to the property reflected as they should. Gradle 5 seems to have changed the order in which some operations are executed. I wish they would have an option to randomize ordering of otherwise undefined sequences.

@alpar-t alpar-t removed the WIP label Dec 3, 2018
@alpar-t
Copy link
Contributor Author

alpar-t commented Dec 3, 2018

@rjernst Gradle 5.0 is GA and this is ready for review and merge now.

@droberts195
Copy link
Contributor

One thing to note is that in release manager Gradle will run with ml-cpp and found-elasticsearch-plugin in the elasticsearch-extra directory. Were there any particular things that needed changing as part of this PR that are also likely to need changing in the build.gradle files in those repos before Gradle 5 will work with them? I'm happy to make the ml-cpp changes if any are required, but it would be good to consider this before merging this PR because otherwise the unified snapshot will be broken in the meantime.

@alpar-t
Copy link
Contributor Author

alpar-t commented Dec 3, 2018

@droberts195 The best thing is to run with a build scan and look at deprecation messages.
The finally keyword changed how it works and I had to remove it from a bunch of places.
Other than that this was not special from minor version updates where things are ran in different order and this uncovers some explicit ordering that is missing. I'm also glad to help making those changes. I think the hadoop plugin is also affected ( /cc @jbaiera )

droberts195 added a commit to droberts195/ml-cpp that referenced this pull request Dec 3, 2018
Needs to be merged before elastic/elasticsearch#34263 to
prevent builds with ml-cpp in elasticsearch-extra from
failing.

Defining a custom wrapper task was incompatible with
Gradle 5, so this is replaced with a modification to the
built in wrapper task.

The Gradle Wrapper is also upgraded to the latest version.
droberts195 added a commit to elastic/ml-cpp that referenced this pull request Dec 4, 2018
Needs to be merged before elastic/elasticsearch#34263 to
prevent builds with ml-cpp in elasticsearch-extra from
failing.

Defining a custom wrapper task was incompatible with
Gradle 5, so this is replaced with a modification to the
built in wrapper task.

The Gradle Wrapper is also upgraded to the latest version.
droberts195 added a commit to droberts195/ml-cpp that referenced this pull request Dec 4, 2018
Needs to be merged before elastic/elasticsearch#34263 to
prevent builds with ml-cpp in elasticsearch-extra from
failing.

Defining a custom wrapper task was incompatible with
Gradle 5, so this is replaced with a modification to the
built in wrapper task.

The Gradle Wrapper is also upgraded to the latest version.
droberts195 added a commit to elastic/ml-cpp that referenced this pull request Dec 4, 2018
Needs to be merged before elastic/elasticsearch#34263 to
prevent builds with ml-cpp in elasticsearch-extra from
failing.

Defining a custom wrapper task was incompatible with
Gradle 5, so this is replaced with a modification to the
built in wrapper task.

The Gradle Wrapper is also upgraded to the latest version.

Backport of #325
@droberts195
Copy link
Contributor

I can confirm that ml-cpp now works with Gradle 5

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -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()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reversion of using Property works here, because we are in an afterEvaluate. However, the original intention was to configure the copy spec outside of afterEvalute, so the Property would be needed. The reason the afterEvaluate still exists is because, for some reason I could not explain, the zipTree seems to always be evaluated when copyRestSpec.from is called, even though we pass a closure. I bring this up because I see a similar copy.from added below with a similar lazily evaluated zip, which I assume works, so maybe this afterEvaluate could be removed (in a followup), but then this would need to be a Property again.

@alpar-t
Copy link
Contributor Author

alpar-t commented Dec 5, 2018

gradlew in the found plugin actually uses the one from the ES repo. I checked to make sure Gradle 5 doesn't cause any issues there.

@alpar-t alpar-t merged commit 59b0900 into elastic:master Dec 5, 2018
@alpar-t alpar-t deleted the upgrade-gradle-5 branch December 5, 2018 12:10
alpar-t added a commit that referenced this pull request Dec 5, 2018
tlrx added a commit that referenced this pull request Dec 6, 2018
This pull request fixes the build.gradle file so that it
works with the Gradle 5.0 update (#34263).

It also makes use of the ignore: 404 header in REST tests
so that previous snapshots are deleted as part of the test
set up. This way each new test run with an external service
should start with a fresh repository even if the previous
test run failed and left snapshots in the repo. (This is a
best effort as it does not fix a corrupted repository)
tlrx added a commit that referenced this pull request Dec 6, 2018
This pull request fixes the build.gradle file so that it
works with the Gradle 5.0 update (#34263).

It also makes use of the ignore: 404 header in REST tests
so that previous snapshots are deleted as part of the test
set up. This way each new test run with an external service
should start with a fresh repository even if the previous
test run failed and left snapshots in the repo. (This is a
best effort as it does not fix a corrupted repository)
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team >upgrade v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants