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

Use ObjectFactory.directoryProperty() if possible #71

Conversation

marcphilipp
Copy link

ProjectLayout.directoryProperty() was deprecated in Gradle 5.0 and
replaced with ObjectFactory.directoryProperty(). In order to stay
backward compatible with Gradle 4.x, the latter is now called first and
the former is used as a fallback.

Resolves #64.

ProjectLayout.directoryProperty() was deprecated in Gradle 5.0 and
replaced with ObjectFactory.directoryProperty(). In order to stay
backward compatible with Gradle 4.x, the latter is now called first and
the former is used as a fallback.

Resolves ajoberstar#64.
Copy link

@sormuras sormuras left a comment

Choose a reason for hiding this comment

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

LGTM

public static DirectoryProperty create(ProjectLayout layout, ObjectFactory objectFactory) {
try {
return objectFactory.directoryProperty();
} catch (NoSuchMethodError e) {
Copy link
Owner

Choose a reason for hiding this comment

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

We could avoid the exception by using if (GradleVersion.current() < GradleVersion.version('5.0')) or something similar, right?

Copy link
Author

Choose a reason for hiding this comment

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

Right. Would you prefer that?

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah. If you don't have time, let me know. I plan to make some updates to the plug-in later today.

ajoberstar added a commit that referenced this pull request Mar 23, 2019
Gradle 5 deprecates the one on ProjectLayout in favor of ObjectFactory.

This resolves #64 and supersedes #71.
@ajoberstar
Copy link
Owner

I have a fix released in 2.1.0-beta.1. Thanks for sending this in, nudged me to get some other fixes done.

@ajoberstar ajoberstar closed this Mar 23, 2019
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.

3 participants