-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use ObjectFactory.directoryProperty() if possible #71
Conversation
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.
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
I have a fix released in 2.1.0-beta.1. Thanks for sending this in, nudged me to get some other fixes done. |
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.