Skip to content
Luca Vignaroli edited this page Jul 18, 2017 · 33 revisions

Gradle

1.7.1+

Basics

Weaving and factories do not work with older versions of Gradle! Use a recent version

Gradle is a bit more involved. It operates in place on .class files, you will have to hook the weave task somewhere in your build process. See next chapter for a concrete example.

  1. Add plugin dependency to your build script classpath "net.onedaybeard.artemis:artemis-odb-gradle-plugin:2.1.0".
  2. Add repository jcenter(), which contains dependencies for the artemis gradle plugin.
  3. Apply the plugin apply plugin: "artemis"
  4. Specify classes folder with Weave.classesDir
  5. Use weave.dependsOn to have it run somewhere after building.
  6. (Optional) make your final build step depend on weave (lastTask.dependsOn weave).

NOTE for gradle 4.0.1: From this version onwards gradle splits classes by language type in the build folder in order to support mixed language builds. If you want to comply with this replace classesDir = sourceSets.main.output.classesDir with classesDir = new File(buildDir, "classes/java/main") to comply with the new system.

weave {
    classesDir = sourceSets.main.output.classesDir
    dependsOn build
    enableArtemisPlugin = true
    enablePooledWeaving = true
    generateLinkMutators = true
    optimizeEntitySystems = true
}

See https://github.com/DaanVanYperen/libgdx-artemis-quickstart for an up to date example.

Clone this wiki locally