riiablo/core/build.gradle
Collin Smith c736412b4b Created Tables and TsvParser impl in :core
Created Tables and TsvParser impl in :core
Added lazy loading of table records
2020-12-17 22:33:32 -08:00

176 lines
5.5 KiB
Groovy

apply plugin: 'java-library'
apply plugin: 'artemis'
apply plugin: 'io.netifi.flatbuffers'
import io.netifi.flatbuffers.plugin.tasks.FlatBuffers
import org.gradle.internal.os.OperatingSystem
import java.text.SimpleDateFormat
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.resources.srcDirs += rootProject.file('assets')
idea.module.resourceDirs += rootProject.file('assets')
project.ext.generatedSourceDir = file("$buildDir/generated-src/main/java/")
sourceSets.main.java.srcDirs += generatedSourceDir
idea.module.generatedSourceDirs += generatedSourceDir
project.ext.annotationProcessorGeneratedSourcesDirectory = compileJava.options.annotationProcessorGeneratedSourcesDirectory
sourceSets.main.java.srcDirs += annotationProcessorGeneratedSourcesDirectory
idea.module.generatedSourceDirs += annotationProcessorGeneratedSourcesDirectory
project.ext.vcsGeneratedSourceDir = file('gen/main/java/')
sourceSets.main.java.srcDirs += vcsGeneratedSourceDir
idea.module.generatedSourceDirs += vcsGeneratedSourceDir
project.ext.flatbuffersSourceDirs = file('src/main/flatbuffers/')
// LibGDX
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$gdxAiVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
}
// Libraries
dependencies {
api "com.android.support:support-annotations:28.0.0"
api "commons-io:commons-io:2.5"
api "org.apache.commons:commons-lang3:3.9"
api "org.apache.commons:commons-collections4:4.1"
api "org.apache.commons:commons-math3:3.6.1"
api "org.apache.commons:commons-text:1.8"
api "com.jcraft:jzlib:1.1.3"
}
// Excel
dependencies {
implementation "com.squareup:javapoet:1.13.0"
}
// Table
dependencies {
annotationProcessor project(':table:annotation-processor')
implementation project(':table:core')
implementation project(':table:annotations')
}
// Networking
dependencies {
api "com.google.flatbuffers:flatbuffers-java:$flatbuffersVersion"
api "io.netty:netty-all:$nettyVersion"
}
// Box2D (to be deprecated)
dependencies {
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
}
// Logging
// Some utilities do not work on Android
// Intended for use in :desktop to get package tree at runtime for debugging
dependencies {
api "org.reflections:reflections:0.9.12"
}
// Artemis ODB
dependencies {
// components to expose
api "net.onedaybeard.artemis:artemis-odb:$artemisOdbVersion"
api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion"
//api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion"
// Artemis-odb
api "net.onedaybeard.artemis:artemis-odb:$artemisOdbVersion"
// api "net.onedaybeard.artemis:artemis-odb-serializer-json-libgdx:$artemisOdbVersion"
// Artemis-odb bonus functionality (systems, events, components).
api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion"
//api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion"
api "net.mostlyoriginal.artemis-odb:contrib-eventbus:$artemisContribVersion"
//api "net.mostlyoriginal.artemis-odb:contrib-plugin-operations:$artemisContribVersion"
//api "net.mostlyoriginal.artemis-odb:contrib-plugin-profiler:$artemisContribVersion"
//api "net.mostlyoriginal.artemis-odb:contrib-plugin-singleton:$artemisContribVersion"
}
dependencies {
testImplementation "junit:junit:4.12"
testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
weave {
classesDir = sourceSets.main.java.outputDir
enableArtemisPlugin = true
enablePooledWeaving = true
generateLinkMutators = true
optimizeEntitySystems = true
}
// FIXME: see #134 https://github.com/collinsmith/riiablo/issues/134
//classes.finalizedBy weave
flatbuffers {
flatcPath = rootProject.file('flatbuffers/flatc.exe')
language = 'java'
flatBuffersVersion = flatbuffersVersion
}
task createFlatBuffers(type: FlatBuffers) {
doFirst {
if (OperatingSystem.current() != OperatingSystem.WINDOWS) {
throw new GradleException("'$name' can only run on Windows")
}
}
inputDir = flatbuffersSourceDirs
outputDir = vcsGeneratedSourceDir
}
task generateSources {
outputs.dir project.ext.flatbuffersSourceDirs
}
if (OperatingSystem.current() != OperatingSystem.WINDOWS) {
logger.warn("Disabling $createFlatBuffers.name because it can only run on Windows")
createFlatBuffers.enabled = false
}
generateSources.dependsOn 'createFlatBuffers'
generateSources.dependsOn 'createVersionSource'
compileJava.dependsOn 'generateSources'
task createVersionSource {
// force task to execute for every build
outputs.upToDateWhen { false }
def versionClassName = 'RiiabloVersion'
def timeZone = TimeZone.getTimeZone("UTC")
def dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
dateFormat.setTimeZone(timeZone)
def buildDate = dateFormat.format(new Date())
def versionFile = file("${generatedSourceDir}/com/riiablo/${versionClassName}.java")
outputs.file(versionFile)
doLast {
versionFile.text =
"""// Generated by ${path} on ${buildDate}
package com.riiablo;
public final class ${versionClassName} {
public static final String VERSION = "${version}";
public static final String BUILD_DATE = "${buildDate}";
}
"""
}
}
//tasks.withType(JavaCompile) {
// options.compilerArgs << '-Xlint:unchecked'
// options.deprecation = true
//}