MovingBlocks / box2d-editor

Automatically exported from code.google.com/p/box2d-editor - migrated here to maybe maintain together with Destination Sol. Original website:
https://code.google.com/archive/p/box2d-editor/
Apache License 2.0
84 stars 21 forks source link

Building the editor? #33

Open wolpert opened 8 years ago

wolpert commented 8 years ago

Just saw the move of PBE from google to git... looks like the change to gradle is a good start, but it looks like we lost the building of the executable jar file in the move from maven. (Unless I missed the gradle tasks)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/28520323-building-the-editor?utm_campaign=plugin&utm_content=tracker%2F23699865&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F23699865&utm_medium=issues&utm_source=github).
Cervator commented 8 years ago

Hi @wolpert :-)

Did you check out the develop branch? We got far enough with Gradle to where it compiles and runs, but then IIRC there was an issue interacting with LibGDX / OpenGL in some situations. @PrivateAlpha was investigating but was drawn away for something else for the time being.

We haven't gone beyond that point yet so the editor isn't quite functional again yet, at least not for me. So building a proper jar in our Jenkins etc is beyond that.

Gradle will by default include a bunch of tasks with the Java plugin, including a jar builder, "gradlew jar" should do it as-is, I just don't think it'll work. If you're up for helping feel free! We need more contributors :-)

dlon commented 6 years ago

I managed to build a runnable jar using the following task:

diff --git a/editor/build.gradle b/editor/build.gradle
index ea6b97c..49db10e 100644
--- a/editor/build.gradle
+++ b/editor/build.gradle
@@ -57,6 +57,17 @@ task run(type: JavaExec) {
     ignoreExitValue = true
 }

+task dist(type: Jar) {
+    from files(sourceSets.main.output.classesDir)
+    from files(sourceSets.main.output.resourcesDir)
+    from {configurations.compile.collect {zipTree(it)}}
+
+    manifest {
+        attributes 'Main-Class': project.mainClassName,
+                'Class-Path': sourceSets.main.runtimeClasspath
+    }
+}
+
 idea {
     module {
         // Change around the output a bit

It seems to cause issues at times, but I didn't look into why.