Rev 1698 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1688 | chris | 1 | apply plugin: "java" |
| 2 | |||
| 1698 | chris | 3 | repositories { |
| 4 | jcenter() |
||
| 5 | } |
||
| 6 | |||
| 7 | dependencies { |
||
| 1707 | chris | 8 | compile "org.mockito:mockito-core:1.+" |
| 9 | compile "junit:junit:4.+" |
||
| 1698 | chris | 10 | } |
| 11 | |||
| 1688 | chris | 12 | sourceCompatibility = 1.6 |
| 13 | sourceSets.main.java.srcDirs = [ "src/" ] |
||
| 14 | |||
| 15 | project.ext.mainClassName = "com.gebauz.watergame.desktop.DesktopLauncher" |
||
| 16 | project.ext.assetsDir = new File("../android/assets"); |
||
| 17 | |||
| 18 | task run(dependsOn: classes, type: JavaExec) { |
||
| 19 | main = project.mainClassName |
||
| 20 | classpath = sourceSets.main.runtimeClasspath |
||
| 21 | standardInput = System.in |
||
| 22 | workingDir = project.assetsDir |
||
| 23 | ignoreExitValue = true |
||
| 24 | } |
||
| 25 | |||
| 26 | task dist(type: Jar) { |
||
| 27 | from files(sourceSets.main.output.classesDir) |
||
| 28 | from files(sourceSets.main.output.resourcesDir) |
||
| 29 | from {configurations.compile.collect {zipTree(it)}} |
||
| 30 | from files(project.assetsDir); |
||
| 31 | |||
| 32 | manifest { |
||
| 33 | attributes 'Main-Class': project.mainClassName |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | dist.dependsOn classes |
||
| 38 | |||
| 39 | eclipse { |
||
| 40 | project { |
||
| 41 | name = appName + "-desktop" |
||
| 42 | linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { |
||
| 47 | doLast { |
||
| 48 | def classpath = new XmlParser().parse(file(".classpath")) |
||
| 49 | new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); |
||
| 50 | def writer = new FileWriter(file(".classpath")) |
||
| 51 | def printer = new XmlNodePrinter(new PrintWriter(writer)) |
||
| 52 | printer.setPreserveWhitespace(true) |
||
| 53 | printer.print(classpath) |
||
| 54 | } |
||
| 1698 | chris | 55 | } |
| 56 | |||
| 57 |