Using tasks.inputs for an input configuration

Hi, im having trouble importing an old ant build script into gradle.

Basically i am importing an old ant build into gradle.
It works but now i want to add up-to-date checks for the heavy ant tasks.
I have done it for files and directories like so:

apply plugin: 'base'
ant.importBuild('src/build.xml') { "ant$it".toString() }

antcompile.inputs.dir('src/java')
antcompile.inputs.dir('src/junit')
antcompile.outputs.dir('src/build/classes')

But i dont know how to properly check the classpath for the build
I have tried two things
antcompile.inputs.property('classpath', configurations.compileClasspath)
and
antcompile.inputs.files('classpath', configurations.compileClasspath)

Either will trigger a new build from what i see when running with --info but i would like the same check as @Classpath annotation gives.

Can anybody help?

The @Classpath annotation is closest to @InputFiles with some special handling, so use inputs.files() over inputs.property(). Try using the below to more closely match the @Classpath behavior:

antcompile.inputs.files(configurations.compileClasspath)
    .withPropertyName('classpath').withNormalizer(ClasspathNormalizer)
1 Like