MacOS vs Linux and up-to-date checking

I have a Gradle (7.5) build script that includes this task:

task eecs_transpile_to_xml(
  type: JavaExec,
  dependsOn: ["eecs_sources", "build_transpiler"],
  description: "Transpile the EECS Java to XML"
) {
  inputs.files fileTree(dir: "${buildDir}/src/eecs")
  outputs.files fileTree(dir: "${buildDir}/ee_xmlout")
  classpath = configurations.transpiler
  mainClass = "ToXml"
  args "-j:${buildDir}/src/eecs",
    "-repo:${projectDir}",
    "-xml:${buildDir}/ee_xmlout",
    "-h:${projectDir}/src/main/java",
    "-src:${projectDir}/src/main/java",
    "-ee:${saxonVersion}",
    "-icu4j:${icu4jJar}"
  doFirst {
    mkdir("${buildDir}/ee_xmlout")
  }
}

The eecs_sources task creates a bunch of files under ${buildDir}/src/eecs. The build_transpiler task compiles the ToXml class and it’s related dependencies. On a MacOS box, this works fine. The eecs_sources task runs, then the transpiler runs.

I’ve been working on some regression testing, running builds on different platforms and I’ve discovered that this doesn’t work on Linux. If I execute:

 TERM=dumb ./gradlew --info clean eecs_transpile_to_xml

I get a trace that ends like this:

> Task :eecs_sources
Watching 548 directories to track changes
Caching disabled for task ':eecs_sources' because:
  Build cache is disabled
Task ':eecs_sources' is not up-to-date because:
  Output property 'destinationDir' file /Volumes/Saxonica/src/saxonica/saxondev/build/src/eecs has been removed.
  Output property 'destinationDir' file /Volumes/Saxonica/src/saxonica/saxondev/build/src/eecs/com has been removed.
  Output property 'destinationDir' file /Volumes/Saxonica/src/saxonica/saxondev/build/src/eecs/com/saxonica has been removed.
Watching 547 directories to track changes
Watching 633 directories to track changes
:eecs_sources (Thread[Execution worker Thread 4,5,main]) completed. Took 0.489 secs.
Resolve mutations for :eecs_transpile_to_xml (Thread[Execution worker,5,main]) started.
Resolve mutations for :eecs_transpile_to_xml (Thread[Execution worker,5,main]) completed. Took 0.0 secs.
:eecs_transpile_to_xml (Thread[Execution worker Thread 4,5,main]) started.
producer locations for task group 1 (Thread[Execution worker,5,main]) started.
producer locations for task group 1 (Thread[Execution worker,5,main]) completed. Took 0.0 secs.

> Task :eecs_transpile_to_xml UP-TO-DATE
file or directory '/Volumes/Saxonica/src/saxonica/saxondev/build/ee_xmlout', not found
Watching 634 directories to track changes
Caching disabled for task ':eecs_transpile_to_xml' because:
  Build cache is disabled
Skipping task ':eecs_transpile_to_xml' as it is up-to-date.
:eecs_transpile_to_xml (Thread[Execution worker Thread 4,5,main]) completed. Took 0.001 secs.

BUILD SUCCESSFUL in 20s
19 actionable tasks: 14 executed, 5 up-to-date

Given that the output directory doesn’t exist and the input files have changed, why does Gradle report this task as up-to-date? Why is this behavior different on Linux and Mac?

I guess no one is going to make any suggestions for this issue. sad trombone

I sometimes have seen strange behavior where a task is seen as up-to-date, although the inputs were changed.
I wasn’t able yet to reliably reproduce or deeply investigate.
But it seems there is some confusion in the up-to-date information database.
For me it resolved after I deleted .gradle/ from the root project and <GRADLE_USER_HOME> contents except for the gradle.properties and init scripts in there if they exist as usually the other stuff can be recreated. I didn’t pinpoint which directory exactly I needed to delete to make it work again.
So you might try to delete those things, or subsets of it until the up-to-date check works properly again if it is the same issue you are seeing.

Okay. Thanks. I think I tried deleting .gradle but I doubt that I thought to delete ~/.gradle. I’ll see if I can reproduce it and if that fixes it.

Yes, that did seem to fix it. It took me another bit-longer-than-I’d-care-to-admit to work out WT-actual-F and see that the problem had resurfaced with a different target.