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

Update build to Gradle 7.0 #68506

Merged
merged 26 commits into from
Apr 13, 2021
Merged

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Feb 4, 2021

Gradle 7.0 GA has been released. We want to stay on the latest released Gradle version for our elasticsearch builds.

This updates our build to use Gradle 7.0 and applies some required changes to make our build compatible with the latest Gradle version.

Most of the heavy lifting to support 7.0 have been merged into master already in earlier separated PRs.

As this is a bigger change I also triggered a few other CI builds to get more reassurance than usual:

@breskeby breskeby self-assigned this Feb 4, 2021
@breskeby breskeby added :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.11.1 v8.0.0 v7.12.0 and removed v7.11.1 labels Feb 4, 2021
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch from 7a76725 to b3b8b6a Compare February 9, 2021 13:07
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch 2 times, most recently from a976292 to 4c52e0d Compare February 18, 2021 14:27
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch 2 times, most recently from 2b90ae0 to d147f9d Compare February 25, 2021 09:13
@breskeby
Copy link
Contributor Author

currently blocked by gradle/gradle#15566

@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch 2 times, most recently from 7856bff to c2416a4 Compare March 3, 2021 12:48
@breskeby
Copy link
Contributor Author

breskeby commented Mar 3, 2021

currently blocked by nebula-plugins/gradle-ospackage-plugin#393

@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch 3 times, most recently from 01720b6 to 72e31ac Compare March 9, 2021 08:29
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch from 7361550 to 16bd490 Compare March 11, 2021 22:53
@breskeby
Copy link
Contributor Author

@elasticmachine test this please

@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch 3 times, most recently from 432c16e to 726bda6 Compare March 18, 2021 22:07
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch from 726bda6 to 46a92dd Compare March 27, 2021 09:25
@breskeby breskeby force-pushed the update-gradle-wrapper-7-0 branch from 2281583 to e9b7574 Compare April 7, 2021 14:48
@@ -283,7 +283,7 @@ allprojects {
}
}
boolean hasShadow = project.plugins.hasPlugin(ShadowPlugin)
project.configurations.compile.dependencies
Copy link
Contributor Author

Choose a reason for hiding this comment

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

deprecated compile has been removed.
This should have been replaced before but now ultimately caused the build to fail

@@ -30,13 +30,13 @@ class SnippetsTask extends DefaultTask {
private static final String SCHAR = /(?:\\\/|[^\/])/
private static final String SUBSTITUTION = /s\/($SCHAR+)\/($SCHAR*)\//
private static final String CATCH = /catch:\s*((?:\/[^\/]+\/)|[^ \]]+)/
private static final String SKIP = /skip:([^\]]+)/
private static final String SKIP_REGEX = /skip:([^\]]+)/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

$SKIP seems like a reserved term in Groovy 3.0 and caused trouble here. Therefore the renaming

@@ -37,20 +36,6 @@ public void apply(Project project) {
* Adds repositories used by ES projects and dependencies
*/
public static void configureRepositories(Project project) {
// ensure all repositories use secure urls
// TODO: remove this with gradle 7.0, which no longer allows insecure urls
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolving this TODO by removing the extra logic for http checks

@@ -38,14 +43,19 @@ public void apply(Project project) {
t.copy("test/ssl/test-node.jks");
t.setOutputDir(keyStoreDir);
});

project.getPlugins()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make implicit dependencies explicit

@@ -55,6 +56,13 @@ public void prepare() {
task = createDependencyLicensesTask(project);
updateShas = createUpdateShasTask(project, task);
dependency = project.getDependencies().localGroovy();
task.configure(new Action<DependencyLicensesTask>() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Groovy is shipped with different artefacts now

@@ -163,7 +163,7 @@ subprojects {
java {
// Normally this isn't necessary, but we have Java sources in
// non-standard places
target '**/*.java'
target 'src/**/*.java'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

narrow down the tasks inputs here to avoid implicit dependencies on others tasks output we do not want here (and is deprecated with gradle 7.0)

@@ -68,7 +68,9 @@ dependencies {
// Set the keytab files in the classpath so that we can access them from test code without the security manager
// freaking out.
if (isEclipse == false) {
testRuntimeOnly files(project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.elastic.co.keytab").parent)
testRuntimeOnly files(project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.elastic.co.keytab").parent) {
builtBy ":test:fixtures:krb5kdc-fixture:preProcessFixture"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

make task dependency explicit

@@ -80,7 +80,7 @@ artifacts {

tasks.register("extractNativeLicenses", Copy) {
dependsOn configurations.nativeBundle
into "${buildDir}"
into "${buildDir}/extractedNativeLicenses"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

use a dedicated output folder for extracted native licenses. This avoids not having the whole buildDir considered a task output here

@breskeby breskeby marked this pull request as ready for review April 10, 2021 09:42
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@breskeby
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@breskeby breskeby requested a review from mark-vieira April 10, 2021 22:11
@breskeby
Copy link
Contributor Author

I'll look into elasticsearch-hadoop build first before merging this to ensure elasticsearch-hadoop is ready to be updated to 7.0 too

@breskeby
Copy link
Contributor Author

Elastic-hadoop PR has been created here: elastic/elasticsearch-hadoop#1641

@breskeby breskeby requested a review from pugnascotia April 12, 2021 15:49
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

Woohoo! LGTM.

maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.github.breskeby:gradle-ospackage-plugin:ddb72a9922b934033827d48d296f7f3d470ac422"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to fork this?

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'm waiting for a release of the ospackage plugin that includes my PR that fixed a stackoverflow within the plugin: nebula-plugins/gradle-ospackage-plugin#397

@breskeby breskeby merged commit 0f40889 into elastic:master Apr 13, 2021
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Apr 13, 2021
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See gradle/gradle#16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Apr 14, 2021
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See gradle/gradle#16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3
breskeby added a commit that referenced this pull request Apr 14, 2021
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See gradle/gradle#16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3

- Disable module inference in Eclipse (#71649)

We recently upgrade to gradle 7.0 (#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Co-authored-by: Nik Everett <nik9000@gmail.com>
@breskeby breskeby deleted the update-gradle-wrapper-7-0 branch December 10, 2024 14:06
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 Team:Delivery Meta label for Delivery team >upgrade v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants