Rev 1698 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1688 | chris | 1 | apply plugin: "java" |
| 2 | |||
| 3 | sourceCompatibility = 1.6 |
||
| 4 | sourceSets.main.java.srcDirs = [ "src/" ] |
||
| 5 | |||
| 6 | project.ext.mainClassName = "com.gebauz.watergame.desktop.DesktopLauncher" |
||
| 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 + "-desktop" |
||
| 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 | } |