Does Gradle's Bndrun.bundles property need any "normalization"?

Hi,

I have been deep-diving into Bnd’s Gradle tasks recently as I try to execute them from IntelliJ, and I have noticed this code in the FileSetRepositoryConvention:

// need to programmatically add to inputs since @InputFiles in a convention is not processed
task.inputs.files(bundleCollection).withPropertyName('bundles')

I understand what these lines are doing, but Gradle usually asks that file properties be “normalized” somehow too. More specifically, it moans that

property ‘blah’ is declared without normalization specified. Properties of cacheable work must declare their normalization via @PathSensitive, @Classpath or @CompileClasspath. Defaulting to PathSensitivity.ABSOLUTE.

And so I was wondering - could this programmatic property also need normalization, if only for the sake of the task’s up-to-date checks? Perhaps:

task.inputs.files(bundleCollection)
        .withNormalizer(ClasspathNormalizer)
        .withPropertyName('bundles')

I’m just wondering here - I routinely apply a normalization to my “file” task properties, regardless of whether or not I have declared its task as a @CacheableTask, on the basis that a “stricter” execution of Gradle’s ValidatePlugins task is presumably trying to tell me something worth knowing :slight_smile:(?)

Cheers,
Chris

Classpath normalization “Normalizes file input that represents a Java runtime classpath”. In this case the bundleCollection is not a classpath. It is a collection of bundles where order is not relevant. The bundles represent an indexed repository. Since the set of bundles in the repository can change, we add the file collection as an input to the task. But it is just an unordered collection of files and not a classpath.

What I can do is add .withPathSensitivity(RELATIVE) which makes sense and should quiet the warning.

Heh, Gradle only warns for annotated inputs and not for programmatic ones :wink:. I’m just wondering if this file input could do with normalizing anyway.

Cheers,
Chris

I will add .withPathSensitivity(RELATIVE). I had already gone through all the other inputs regarding this but missed the one in FileSetRepositoryConvention.

Thanks for finding this.