diff --git a/core/build.gradle b/core/build.gradle index 0a3b6ee5..52de40f4 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'artemis' apply plugin: 'io.netifi.flatbuffers' import io.netifi.flatbuffers.plugin.tasks.FlatBuffers +import org.gradle.internal.os.OperatingSystem [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' @@ -13,6 +14,8 @@ project.ext.generatedSourceDirs = file('gen/main/java/') sourceSets.main.java.srcDirs += generatedSourceDirs idea.module.generatedSourceDirs += generatedSourceDirs +project.ext.flatbuffersSourceDirs = file('src/main/java/com/riiablo/net/') + dependencies { api "com.badlogicgames.gdx:gdx:$gdxVersion" api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" @@ -29,7 +32,7 @@ dependencies { api "org.apache.commons:commons-math3:3.6.1" api "org.apache.commons:commons-text:1.8" api "com.jcraft:jzlib:1.1.3" - api "com.google.flatbuffers:flatbuffers-java:1.11.0" + api "com.google.flatbuffers:flatbuffers-java:$flatbuffersVersion" } dependencies { @@ -81,8 +84,19 @@ dependencies { // // classes.finalizedBy weave -task createFlatBuffers(type: FlatBuffers) { - inputDir = file('src/main/java/com/riiablo/net/') - outputDir = file('gen/main/java/') +flatbuffers { + flatcPath = rootProject.file('flatbuffers/flatc.exe') language = 'java' + flatBuffersVersion = flatbuffersVersion +} + +task createFlatBuffers(type: FlatBuffers) { + doFirst { + if (OperatingSystem.current() != OperatingSystem.WINDOWS) { + throw new GradleException("'flatc' can only run on Windows") + } + } + + inputDir = flatbuffersSourceDirs + outputDir = generatedSourceDirs } diff --git a/flatbuffers/flatc.exe b/flatbuffers/flatc.exe new file mode 100644 index 00000000..1f6f6d76 Binary files /dev/null and b/flatbuffers/flatc.exe differ diff --git a/gradle.properties b/gradle.properties index d4b5fbf1..93446b44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,5 +9,6 @@ artemisOdbVersion=2.3.0 artemisContribVersion=2.4.0 gdxAiVersion=1.8.2 nettyVersion=4.1.50.Final +flatbuffersVersion=1.11.0 cliVersion=1.4 box2DLightsVersion=1.5