Gradle 4.3-rc-2 is now available for testing

(Lóránt Pintér) #1

Gradle 4.3 RC2 is available for testing; see the release notes.

(Lóránt Pintér) #2

(Jörn Huxhorn) #3

The issue is reported for rc-1 is fixed in rc-2, i.e. it produces a deprecation warning instead of an error.

I see the following warning in one of my builds:

Some problems were found with the configuration of task ':lilith:generatePlist'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
 - No value has been specified for property 'MacAppBundlePlugin certIdentity'.
 - No value has been specified for property 'MacAppBundlePlugin keyChain'.
 - No value has been specified for property 'MacAppBundlePlugin backgroundImage'.

It seems to be triggered by adding MacAppBundlePlugin registering a null value as a task input value.

I didn’t yet report this problem to the plugin author because this seems excessively strict to me. The values in question are entirely optional and preventing the warning by not adding the null value would just add unnecessary boilerplate code to plugins.

For example,"MacAppBundlePlugin backgroundImage", {project.macAppBundle.backgroundImage})

would change to

if(project.macAppBundle.backgroundImage)"MacAppBundlePlugin backgroundImage", {project.macAppBundle.backgroundImage})

with no obvious advantage other than not generating the warning anymore.

Wouldn’t it make way more sense to just ignore null in the method if null values are a problem for future Gradle versions?

(Lóránt Pintér) #4

The idea is that you can append optional() here to ignore null values.

(Jörn Huxhorn) #5

Yes, but that method is only available with Gradle 4.3 with the addition of TaskInputPropertyBuilder. The property(...) method used to return TaskInputs instead of TaskInputPropertyBuilder, which is the reason why I first didn’t realize what you mean.

This isn’t what plugin authors are looking for. They want to get rid of the deprecation warnings (because those cause bug reports) while staying compatible with the broadest range of previous Gradle versions possible.
See SimpleWorkResult is deprecated in gradle 4.2 and the corresponding Fix SimpleWorkResult deprecation warning in gradle 4.2 patch/discussion for an example of this problem.

In case of macAppBundle,

if(project.macAppBundle.backgroundImage)"MacAppBundlePlugin backgroundImage", {project.macAppBundle.backgroundImage})

would be the only viable way (beside code duplication) to both prevent the warning with Gradle 4.3+ and stay compatible with Gradle <4.3. This isn’t optimal.

The deprecation message could also mention the new optional(boolean) method.
Right now it says that an “invalid input” has been registered because “no value has been specified” but the problem is actually that an optional input value has not been marked as optional, which is now required while it wasn’t previously possible at all.

(Benjamin Muschko) #6