Skip to content

Commit 871c41c

Browse files
committed
Move tools to a separate project
1 parent f32b218 commit 871c41c

9 files changed

Lines changed: 77 additions & 11 deletions

File tree

Makefile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
DESKTOP_JAR=$(CURDIR)/desktop/build/libs/desktop-1.0.jar
2+
TOOLS_JAR=$(CURDIR)/tools/build/libs/tools-1.0.jar
23
GRADLEW=./gradlew --offline
34
GAME_CP=com.greenyetilab.tinywheels
45
EXECUTABLE=tinywheels
@@ -18,21 +19,26 @@ JDK_LINUX64_ZIP=openjdk-linux64.zip
1819
all: build
1920

2021
clean: clean-packr
21-
rm -f $(DESKTOP_JAR)
22+
rm -f $(DESKTOP_JAR) $(TOOLS_JAR)
2223

2324
$(DESKTOP_JAR):
2425
${GRADLEW} desktop:dist
2526

27+
$(TOOLS_JAR):
28+
${GRADLEW} tools:dist
29+
2630
build: $(DESKTOP_JAR)
2731

32+
tools: $(TOOLS_JAR)
33+
2834
run: build
2935
cd android/assets && java -jar $(DESKTOP_JAR)
3036

31-
packer: build
32-
java -cp $(DESKTOP_JAR) $(GAME_CP).desktop.Packer $(CURDIR)
37+
packer: tools
38+
java -cp $(TOOLS_JAR) $(GAME_CP).tools.Packer $(CURDIR)
3339

34-
mappacker: build
35-
java -cp $(DESKTOP_JAR) $(GAME_CP).desktop.MapPacker core/assets/maps android/assets/maps
40+
mappacker: tools
41+
java -cp $(TOOLS_JAR) $(GAME_CP).tools.MapPacker core/assets/maps android/assets/maps
3642

3743
# Packr
3844
$(JDK_LINUX64_ZIP):
@@ -83,3 +89,5 @@ apk:
8389

8490
release: dist apk
8591
git tag -f -m "Release Tiny Wheels $(VERSION)" $(VERSION)
92+
93+
.PHONY: tools

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ project(":desktop") {
3232
apply plugin: "java"
3333

3434

35+
dependencies {
36+
compile project(":core")
37+
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
38+
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
39+
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
40+
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
41+
}
42+
}
43+
44+
project(":tools") {
45+
apply plugin: "java"
46+
3547
dependencies {
3648
compile project(":core")
3749
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include 'desktop', 'android', 'core'
1+
include 'desktop', 'tools', 'android', 'core'

tools/build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apply plugin: "java"
2+
3+
sourceCompatibility = 1.6
4+
sourceSets.main.java.srcDirs = [ "src/" ]
5+
6+
project.ext.mainClassName = "com.greenyetilab.tinywheels.tools.Packer"
7+
project.ext.assetsDir = new File("../android/assets");
8+
9+
task run(dependsOn: classes, type: JavaExec) {
10+
main = project.mainClassName
11+
classpath = sourceSets.main.runtimeClasspath
12+
standardInput = System.in
13+
workingDir = project.assetsDir
14+
ignoreExitValue = true
15+
}
16+
17+
task dist(type: Jar) {
18+
from files(sourceSets.main.output.classesDir)
19+
from files(sourceSets.main.output.resourcesDir)
20+
from {configurations.compile.collect {zipTree(it)}}
21+
from files(project.assetsDir);
22+
23+
manifest {
24+
attributes 'Main-Class': project.mainClassName
25+
}
26+
}
27+
28+
dist.dependsOn classes
29+
30+
eclipse {
31+
project {
32+
name = appName + "-tools"
33+
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
34+
}
35+
}
36+
37+
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
38+
doLast {
39+
def classpath = new XmlParser().parse(file(".classpath"))
40+
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
41+
def writer = new FileWriter(file(".classpath"))
42+
def printer = new XmlNodePrinter(new PrintWriter(writer))
43+
printer.setPreserveWhitespace(true)
44+
printer.print(classpath)
45+
}
46+
}

desktop/src/com/greenyetilab/tinywheels/desktop/CommandLineApplication.java renamed to tools/src/com/greenyetilab/tinywheels/tools/CommandLineApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.greenyetilab.tinywheels.desktop;
1+
package com.greenyetilab.tinywheels.tools;
22

33
import com.badlogic.gdx.ApplicationAdapter;
44
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;

desktop/src/com/greenyetilab/tinywheels/desktop/LapPositionTableGenerator.java renamed to tools/src/com/greenyetilab/tinywheels/tools/LapPositionTableGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.greenyetilab.tinywheels.desktop;
1+
package com.greenyetilab.tinywheels.tools;
22

33
import com.badlogic.gdx.Gdx;
44
import com.badlogic.gdx.files.FileHandle;

desktop/src/com/greenyetilab/tinywheels/desktop/MapPacker.java renamed to tools/src/com/greenyetilab/tinywheels/tools/MapPacker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* governing permissions and limitations under the License.
1212
******************************************************************************/
1313

14-
package com.greenyetilab.tinywheels.desktop;
14+
package com.greenyetilab.tinywheels.tools;
1515

1616
import com.badlogic.gdx.files.FileHandle;
1717
import com.badlogic.gdx.graphics.g2d.TextureAtlas;

desktop/src/com/greenyetilab/tinywheels/desktop/Packer.java renamed to tools/src/com/greenyetilab/tinywheels/tools/Packer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.greenyetilab.tinywheels.desktop;
1+
package com.greenyetilab.tinywheels.tools;
22

33
import com.badlogic.gdx.graphics.Texture;
44
import com.badlogic.gdx.tools.texturepacker.TexturePacker;

desktop/src/com/greenyetilab/tinywheels/desktop/TileSetLayout.java renamed to tools/src/com/greenyetilab/tinywheels/tools/TileSetLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.greenyetilab.tinywheels.desktop;
1+
package com.greenyetilab.tinywheels.tools;
22

33
import com.badlogic.gdx.files.FileHandle;
44
import com.badlogic.gdx.maps.MapProperties;

0 commit comments

Comments
 (0)