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

Prefer using plugin extensions over deprecated conventions #1618

Merged
merged 8 commits into from
Apr 5, 2023

Conversation

@Goooler Goooler force-pushed the migrate_conventions branch from dafe3c8 to 21201c6 Compare March 19, 2023 06:44
@Goooler
Copy link
Member Author

Goooler commented Mar 25, 2023

CC @nedtwigg

Comment on lines +29 to +30
static final String VER_GRADLE_min = "6.1.1";
static final String VER_GRADLE_javaPluginExtension = "7.1";
Copy link
Member Author

@Goooler Goooler Mar 28, 2023

Choose a reason for hiding this comment

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

May need to bump VER_GRADLE_min to 7.1 in the future, using conventions will start emitting deprecation warnings in Gradle 8.1, and will be removed in the later Gradle 8 versions.

Copy link
Member

Choose a reason for hiding this comment

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

Roger. If we are throwing warnings that we can't easily workaround with a version check, then I'm happy to bump the minimum.

Copy link
Member Author

@Goooler Goooler Dec 4, 2023

Choose a reason for hiding this comment

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

@nedtwigg Are you planning to move on Gradle plugin 7? If so can we bump the min Gradle requirement to 7.1 for something like this?

Copy link
Member

Choose a reason for hiding this comment

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

It thought that this

if (GradleVersion.current().compareTo(GradleVersion.version(SpotlessPlugin.VER_GRADLE_javaPluginExtension)) >= 0) {
final JavaPluginExtension javaPluginExtension = project.getExtensions().findByType(JavaPluginExtension.class);
if (javaPluginExtension == null) {
throw new GradleException(message);
}
sourceSets = javaPluginExtension.getSourceSets();
} else {
final JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
if (javaPluginConvention == null) {
throw new GradleException(message);
}
sourceSets = javaPluginConvention.getSourceSets();
}

would let us keep 6.1.1 as our min and not emit warnings. But if we are emitting warnings and its very difficult to workaround, then sure I'm okay with bumping the minimum.

Copy link
Member Author

Choose a reason for hiding this comment

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

And 682dcd6.

@Goooler Goooler force-pushed the migrate_conventions branch from e1d21aa to 1c21d12 Compare April 4, 2023 10:19
@nedtwigg nedtwigg enabled auto-merge April 5, 2023 21:33
@nedtwigg nedtwigg merged commit 02b6f60 into diffplug:main Apr 5, 2023
@nedtwigg
Copy link
Member

nedtwigg commented Apr 5, 2023

Thanks!

@Goooler Goooler deleted the migrate_conventions branch April 5, 2023 23:59
@nedtwigg
Copy link
Member

nedtwigg commented Apr 6, 2023

Published in plugin-gradle 6.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants