-
Notifications
You must be signed in to change notification settings - Fork 115
Fluid Entity Gradle
Daan van Yperen edited this page Sep 16, 2016
·
11 revisions
Notice: since this uses an unreleased version of artemis, install the latest version of odb into your local repo first! mvn clean:install
Assuming a libGDX project that's already set up for artemis-odb. (see libgdx-artemis-quickstart)
-
Add the plugin to the buildscript dependencies.
dependencies { // lib for artemis-odb fluid. classpath "net.onedaybeard.artemis:artemis-fluid-gradle-plugin:$artemisVersion" }
-
Add a module to your main
build.gradle
:project(":components") { apply plugin: "java" }
-
Add it to settings.gradle as well
-
Create
components/build.gradle
, example:apply plugin: "java" sourceCompatibility = 1.7 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' sourceSets.main.java.srcDirs = ["src/"] eclipse.project { name = appName + "-components" }
-
Add the new
components
as a dependency to your system module in mainbuild.gradle
project(":core") { apply plugin: "java" dependencies { compile project(":components")
-
Move your components over to the new module.
-
Add the following to your system module (example:
core/build.gradle
)apply plugin: "artemis-fluid" ext { fluidOutputDir = file("$buildDir/generated-sources/fluid/") } // Replace existing line. sourceSets.main.java.srcDirs = ["src/",fluidOutputDir] fluid { generatedSourcesDirectory = fluidOutputDir classpath = sourceSets.main.compileClasspath // optional parameters. Uncomment to activate. // preferences.prefixComponentGetter = "_" // prefix for E::[get]pos() // preferences.prefixComponentCreate = "" // prefix for E::[]pos() // preferences.prefixComponentHas = "has" // prefix for E::[has]Pos() // preferences.prefixComponentRemove = "remove" // prefix for E::[remove]Pos() // preferences.generateTagMethods = true // add tag convenience methods. // preferences.generateGroupMethods = true // add group convenience methods. // preferences.generateBooleanComponentAccessors = true // Generate boolean accessors for flag components? // preferences.swallowGettersWithParameters = false // global setting. overridden by @Fluid annotation. } compileJava.dependsOn fluid // Help intellIJ pick up the generated classes. idea.module { excludeDirs -= file("$buildDir") excludeDirs += file("$buildDir/classes") excludeDirs += file("$buildDir/dependency-cache") excludeDirs += file("$buildDir/libs") excludeDirs += file("$buildDir/tmp") }
-
Run
gradle core:compile
. If it worked you should find generated source in(core module)/build/generated-sources/fluid/
.
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference