Skip to content
Adrian Papari edited this page Mar 9, 2016 · 24 revisions

LibGDX 1.7+ project

Make weaving part of the gradlew desktop:dist target:

Alter /build.gradle

Add artemis-odb gradle plugin to buildscript dependencies.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "net.onedaybeard.artemis:artemis-odb-gradle-plugin:1.4.0"
    }
}

Alter /desktop/build.gradle

Replace the 'dist' task in desktop. This will explode to a folder, weave everything in that folder, then create the jar.

apply plugin: "artemis"
..
project.ext.weaveDir = new File("$buildDir/explodedForWeave")
..
// Prepare folder with all dependencies exploded.
task explodeForWeave(type: Sync, dependsOn: classes) {
    into project.weaveDir
    from files(sourceSets.main.output.classesDir)
    from files(sourceSets.main.output.resourcesDir)
    from {configurations.compile.collect {zipTree(it)}}
    from files(project.assetsDir)
}

// Apply weaving on dependency folder.
weave {
    dependsOn explodeForWeave
    enableArtemisPlugin = true
    enablePooledWeaving = true
    ideFriendlyPacking = true
    optimizeEntitySystems = true
    classesDir = project.weaveDir
}

// package woven classes into jar.
task dist(type: Jar, dependsOn: weave) {
    from project.weaveDir
    manifest {
        attributes 'Main-Class': project.mainClassName
    }
}
Clone this wiki locally