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

Ensure Gradle new project wizard picks up latest Gradle version #7029

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

neilcsmith-net
Copy link
Member

Ensure Gradle new project wizard picks up latest Gradle version for wrapper where intended.

This moves the triggering of project load until after the wrapper is configured. It also removes the --offline flag from wrapper initialization, which doesn't make a lot of sense, and might be why people were still seeing 8.4 rather than 8.5 or 8.6.

With this change, a new application or library project should be configured (at present) to use Gradle 8.6 and not show any JDK 21 warnings when created, even while using Gradle Tooling API 8.4.

This fix or similar should go in to NB21 whether or not the Tooling API is upgraded to 8.6 #6926 Triggering a dev build so the behaviour can be verified to work correctly before Tooling API upgrade.

@neilcsmith-net neilcsmith-net added Gradle [ci] enable "build tools" tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Feb 5, 2024
@neilcsmith-net neilcsmith-net added this to the NB21 milestone Feb 5, 2024
@neilcsmith-net
Copy link
Member Author

@lkishalmi this should also mean the JDK 21 APIs is not an issue with or without tooling upgrade -

Screenshot from 2024-02-05 11-49-06

@neilcsmith-net
Copy link
Member Author

Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

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

Just a small something, let's fix the offline mode instead of removing it.

@@ -488,7 +488,7 @@ public Set<FileObject> execute() {
args.add("--gradle-version"); //NOI18N
args.add(version);
}
pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
pconn.newBuild().forTasks(args.toArray(new String[0])).run(); //NOI18N
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably it would be better to honor GradleSettins.isOffline()

Copy link
Member Author

Choose a reason for hiding this comment

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

@lkishalmi OK, I've made both the init and wrapper tasks only add --offline if the global option is set. Please re-review.

Of course, the Tooling API isn't offline itself, and I'm not sure if it has a configuration option to fail rather than download things?

@mbien
Copy link
Member

mbien commented Feb 5, 2024

tested the dev build and it used 8.6 without warning -> great!

when I cut the network it created a 8.4 project as expected, but it worked too which is good -> still compatible with German trains

…where intended.

Trigger project load after wrapper is configured.
Only add --offline flag to init and wrapper tasks if global Offline option set.
@neilcsmith-net
Copy link
Member Author

neilcsmith-net commented Feb 6, 2024

when I cut the network it created a 8.4 project as expected,

Actually, that's slightly annoying! If you cut the network and configure offline in Gradle options, it should still give you 8.6 if you have that cached locally. That's actually why it was working for me before this fix. Without the --offline flag I guess it's bailing completely when it cannot connect to the latest version info, rather than using what was cached previously.

Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

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

Looks good now! Thank you!

As of the offline does not pick up the latest cached Gradle version.

That's for another day,

@mbien
Copy link
Member

mbien commented Feb 6, 2024

Actually, that's slightly annoying!

i mean, I am glad that it is working offline at all tbh.

@neilcsmith-net
Copy link
Member Author

neilcsmith-net commented Feb 6, 2024

As of the offline does not pick up the latest cached Gradle version.

Just to be clear, if you set the offline Gradle option while having no internet connection this works fine. So I don't think there's anything to worry about there at all, and if there is it's probably for the Gradle project to consider! 😄

Right, thanks both, merging this and the rest of the pending PRs. All being well, rc3 tomorrow!

@neilcsmith-net neilcsmith-net merged commit 94eb34f into apache:delivery Feb 6, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Gradle [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants