I’ve got the moeNatJGen
task coupled to one of my gradle source code compile tasks (using dependsOn
), with the natjgen output pointing to somewhere in the build
dir, because I do not want to trigger the natjgen manually all the time and don’t consider it part of my source code.
This works perfectly fine, however, it does make the app building time slower, which is ok if there is a change in the objc code. But if there’s no change, I would like gradle to cache the task using gradle’s input output comparison, and show, like all the other tasks, UP-TO-DATE
in the logs whenever it was cached.
I was thinking something like this:
moeNatJGen {
def nbcFile = file('objc.nbc')
def nbc = new groovy.json.JsonSlurper().parseText(nbcFile.text)
def nbcInput = nbc.bindings[0].headerPath + '/MyObjCHeader.h'
def nbcOutput = nbc.output
inputs.file(file(nbcInput))
outputs.dir(file(nbcOutput))
}
But it doesn’t seem to have an impact, I’m never seeing moeNatJGen UP-TO-DATE
.
Also tried:
outputs.upToDateWhen {
// This however never gets called
true
}
May have something to do with the code in moe gradle plugin NatJGen
constructor, where upToDateWhen
is always false
:
Any tips to get this working properly?