Created :core:generateSources gradle task

:core:generateSources calls :core:createFlatBuffers
:core:createFlatBuffers will only error out if not up-to-date on non-windows
:core:compileJava depends on :core:generateSources
This commit is contained in:
Collin Smith 2020-12-01 17:43:02 -08:00
parent f81198781d
commit 85780c6ba8

View File

@ -92,11 +92,18 @@ flatbuffers {
task createFlatBuffers(type: FlatBuffers) {
doFirst {
if (OperatingSystem.current() != OperatingSystem.WINDOWS) {
throw new GradleException("'flatc' can only run on Windows")
if (!state.upToDate && OperatingSystem.current() != OperatingSystem.WINDOWS) {
throw new GradleException("'$name' can only run on $OperatingSystem.WINDOWS")
}
}
inputDir = flatbuffersSourceDirs
outputDir = generatedSourceDirs
}
task generateSources {
outputs.dir project.ext.flatbuffersSourceDirs
}
generateSources.dependsOn 'createFlatBuffers'
compileJava.dependsOn 'generateSources'