From 85780c6ba8f35809c9f14a4b8c39675cb1af2ebc Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Tue, 1 Dec 2020 17:43:02 -0800 Subject: [PATCH] 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 --- core/build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 660f2401..066de17e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -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'