junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
779 stars 112 forks source link

[weaving] Document weaving with gradle. #126

Closed JesseTG closed 10 years ago

JesseTG commented 10 years ago

So I finally broke down and decided to learn how to use the accompanying tools and weavers for artemis-odb. However, I'm using Gradle for my project (because LibGDX). How can I use the Maven weaving tools with Gradle?

junkdog commented 10 years ago

There's a CLI tool which is basically a stand-alone version of the maven plugin: it will need to be invoked with the proper arguments from the gradle script - I don't have any experience with gradle, but it looks pretty simple.

DaanVanYperen commented 10 years ago

@JesseTG If you figure it out could you add a snippet here so we can add it to the wiki?

JesseTG commented 10 years ago

Will do.

DaanVanYperen commented 10 years ago

@JesseTG did you ever figure this out?

JesseTG commented 10 years ago

No, I did not. School took over.

DaanVanYperen commented 10 years ago

Curses! Obligations ruin the day again!

JesseTG commented 10 years ago

Oh, I'm using Eclipse for my game if that matters. Should've mentioned that a while ago.

junkdog commented 10 years ago

Shouldn't matter, if it's built using gradle, it's IDE agnostic.

DaanVanYperen commented 10 years ago

It certainly feels like the early days of maven IDE integration again, ugh! I wish LibGDX waited a year or two.

DaanVanYperen commented 10 years ago

Putting some time into this, having this might bring some LibGDX users on board.

junkdog commented 10 years ago

:+1:

DaanVanYperen commented 10 years ago

progress!

Artemis plugin started.
Configuration:
        ideFriendlyPacking .............. true
        enablePooledWeaving ............. true
        optimizeEntitySystems ........... true
        outputDirectory ................. E:\GitHub\arktrail\core\build\classes\main
Processed 1 PackedComponents and 0 PooledComponents in 172ms.
:desktop:weave (Thread[Daemon Thread 2,5,main]) completed. Took 0.29 secs.
:desktop:dist (Thread[Daemon Thread 2,5,main]) started.
junkdog commented 10 years ago

Yay! Is this a native gradle plugin?

DaanVanYperen commented 10 years ago

Yes. It introduces a 'weave' task that the user can chain in their build process.

Just to give an idea of the config required in typical LibGDX project:

build.gradle

buildscript {
    dependencies {
        classpath 'net.onedaybeard.artemis:artemis-gradle-plugin:0.7.1-SNAPSHOT'
    }
}

desktop/build.gradle

apply plugin: "artemis"

weave {
    enableArtemisPlugin = true
    enablePooledWeaving = true
    ideFriendlyPacking = true
    optimizeEntitySystems = true
    classesDir = project(':core').sourceSets.main.output.classesDir
}

weave.dependsOn build
dist.dependsOn weave

We just need to swap gradle for maven in the plugin project, and try to get rid of most of this manual configuration.

Plus validate the process ofcourse. XD I have no clue if the end product works. Probably just add it to libgdx quickstart template.

junkdog commented 10 years ago

Hah! Cool, maybe we should release 0.7.1 right away (meaning tomorrow, as I don't have the keys on this laptop). Send a PR!

On Mon, Sep 22, 2014 at 7:32 PM, Daan van Yperen notifications@github.com wrote:

Yes. It introduces a 'weave' task that the user can chain in their build process.

Just to give an idea of the config required in typical LibGDX project:

build.gradle

buildscript { dependencies { classpath 'net.onedaybeard.artemis:artemis-gradle-plugin:0.7.1-SNAPSHOT' }}

desktop/build.gradle

apply plugin: "artemis" weave { enableArtemisPlugin = true enablePooledWeaving = true ideFriendlyPacking = true optimizeEntitySystems = true classesDir = project(':core').sourceSets.main.output.classesDir} weave.dependsOn builddist.dependsOn weave

We just need to swap gradle for maven in the plugin project, and try to get rid of most of this manual configuration.

Plus validate the process ofcourse. XD I have no clue if the end product works. Probably just add it to libgdx quickstart template.

— Reply to this email directly or view it on GitHub https://github.com/junkdog/artemis-odb/issues/126#issuecomment-56409130.

junkdog commented 10 years ago

(Or just push it to master yourself)

On Mon, Sep 22, 2014 at 7:36 PM, Adrian Papari junkdog@angelhill.net wrote:

Hah! Cool, maybe we should release 0.7.1 right away (meaning tomorrow, as I don't have the keys on this laptop). Send a PR!

On Mon, Sep 22, 2014 at 7:32 PM, Daan van Yperen <notifications@github.com

wrote:

Yes. It introduces a 'weave' task that the user can chain in their build process.

Just to give an idea of the config required in typical LibGDX project:

build.gradle

buildscript { dependencies { classpath 'net.onedaybeard.artemis:artemis-gradle-plugin:0.7.1-SNAPSHOT' }}

desktop/build.gradle

apply plugin: "artemis" weave { enableArtemisPlugin = true enablePooledWeaving = true ideFriendlyPacking = true optimizeEntitySystems = true classesDir = project(':core').sourceSets.main.output.classesDir} weave.dependsOn builddist.dependsOn weave

We just need to swap gradle for maven in the plugin project, and try to get rid of most of this manual configuration.

Plus validate the process ofcourse. XD I have no clue if the end product works. Probably just add it to libgdx quickstart template.

— Reply to this email directly or view it on GitHub https://github.com/junkdog/artemis-odb/issues/126#issuecomment-56409130 .

DaanVanYperen commented 10 years ago

Hold on! got to clean it up first, plus now we have a single gradle module in artemis-odb. XD Would be good if we can integrate it with the default maven build process.

DaanVanYperen commented 10 years ago

The weave step is optional right? What happens if I have package/pooled annotations and skip weaving? Right now it doesn't support delta updates like the maven plugin does.

junkdog commented 10 years ago

Hmm, I don't think the maven plugin supports delta updates either - all classes need to be scanned either way (rewriting calls to packed components).

The presence of the weaver annotations do nothing on their own. Edit: this is why it works with GWT too.

Would be good if we can integrate it with the default maven build process.

Yep! Also for publishing artifacts - right now it's automated by maven, but it requires proper maven modules.

DaanVanYperen commented 10 years ago

Yep! Also for publishing artifacts - right now it's automated by maven, but it requires proper maven modules.

Gradle deploys to my local maven repo fine, but still. Provided there are no secret build steps should be unify it.

junkdog commented 10 years ago

Maven needs to build the project itself when publishing though; probably some way around it.

On Mon, Sep 22, 2014 at 8:04 PM, Daan van Yperen notifications@github.com wrote:

Yep! Also for publishing artifacts - right now it's automated by maven, but it requires proper maven modules.

Gradle deploys to my local maven repo fine, but still. Provided there are no secret build steps should be unify it.

— Reply to this email directly or view it on GitHub https://github.com/junkdog/artemis-odb/issues/126#issuecomment-56414042.

DaanVanYperen commented 10 years ago

Maven needs to build the project itself when publishing though; probably some way around it.

It's now a maven module, so that should cover it right? Just need to add some wiki docu and this ticket is history!

DaanVanYperen commented 10 years ago

Bam! If you play with it @JesseTG let us know if you run into any issues.

Edit: After 0.7.1 gets released.

covered by https://github.com/junkdog/artemis-odb/wiki/Weave-Automation

JesseTG commented 10 years ago

You are awesome.