Refined flatbuffers dependency implementation (see #132)

Included flatc.exe within repository (v1.11.0 binary)
Added check within :core:createFlatBuffers task for Windows OS family
Added flatbuffersVersion variable within gradle.properties to 1.11.0
Changed many fields to variables and implemented flatbuffers closure
This commit is contained in:
Collin Smith 2020-12-01 10:02:07 -08:00
parent fb089185c1
commit 6e44b4d745
3 changed files with 19 additions and 4 deletions

View File

@ -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
}

BIN
flatbuffers/flatc.exe Normal file

Binary file not shown.

View File

@ -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