Skip to content
Adrian Papari edited this page Jan 6, 2019 · 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.2.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).
weave {
    classesDir = sourceSets.main.output.classesDir
    dependsOn build
    enableArtemisPlugin = true
    enablePooledWeaving = true
    generateLinkMutators = true
    optimizeEntitySystems = true
}

NOTE for Gradle 4.0.1: Since this version onward 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") in the above snippet.

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

Clone this wiki locally