We’re using aidl which is generating java files w/...
# caching
c
We’re using aidl which is generating java files w/ comments that have absolute paths. As far as I can see this makes the tasks un-cacheable *between different machines. Is there a way (other than modifying the aidl output and removing the comment) to get gradle to ignore comments when creating a cache key?
e
I don't think Gradle has a way to declare a normalizer for source inputs that would ignore comments, and they do affect the compiled class files (in that line numbers in debug info can be affected by comments)
https://issuetracker.google.com/issues/121251997 seems to indicate that it's fixed upstream but if it's not, I'm not sure you have a better alternative
regardless, Gradle's compile avoidance should help for everything downstream of that
v
Add a
doLast
action to the task generating the files and in there normalize the generated files. A
doLast
action is part of the task action, so snapshots and fingerprints get it. Otter than that, what @ephemient said. :-)
c
Thanks for the info. Testing this out (the comment w/ full path starts with
* Using:
Copy code
this.tasks.withType<AidlCompile>().configureEach {
    doLast {
      val outputDir = sourceOutputDir.get().asFile

      if (outputDir.exists()) {
        outputDir
            .walkTopDown()
            .filter { it.isFile && it.extension == "java" }
            .forEach { javaFile ->
              val filteredLines = javaFile.readLines().filterNot { it.contains("* Using:") }
              javaFile.writeText(filteredLines.joinToString("\n"))
            }
      }
    }
  }
v
Sounds good
c
works well, thanks for the suggestion 🙇
👌 1