Default task, dependsOn, Up-to-date problem

(Klaus Christiansen) #1

I have a Java project and this task:
If I run this task twice it will be up-to-date the second time. This is all god.
Now if a change my Java code then the classes task is NOT up-to-date. So the code i compiled. So far so good.

The problem is that my task convertEgl2Cobol is still up-to-date. But how can this be?? The tasks it depends on is NOT up-to-date so this should not be up-to-date either.
The inputs and outputs does change in this case.

Can someone help me understand why this incremental build does not work the way I think it should.

Im using Gradlew 3.2 on Windows 7.

task convertEgl2Cobol(dependsOn: classes) {
    description 'Converts EGL to Cobol.'
    group 'convert'

        MODEL_LIST.split(',').each{ model ->
            javaexec {
                classpath = sourceSets.main.runtimeClasspath
                main = 'dk.xact.translate.TranslateXactSample'
                args model.trim()
                jvmArgs = ['-Dfile.encoding=UTF-8', '-Xms8g', '-Xmx16g']

    inputs.dir fileTree(dir: EGL_SOURCE_DIR, include: '**/*.egl')
    outputs.dir OUTPUT_PATH + '/generated'

    doFirst {
        delete OUTPUT_PATH + '/generated'

(Chris Doré) #2

Up-to-date checking does not take into account any task dependencies. Your conversion task needs to specify that the outputs of the classes task are inputs.

(Klaus Christiansen) #3

Thank you for clarifying that.
That actually make sense.