|
| 1 | +sourceCompatibility = 1.8 |
| 2 | +sourceSets.main.java.srcDirs = [ "src/" ] |
| 3 | +sourceSets.main.resources.srcDirs = ["../assets"] |
| 4 | + |
| 5 | +project.ext.mainClassName = "com.mygdx.game.DesktopLauncher" |
| 6 | +project.ext.assetsDir = new File("../assets") |
| 7 | + |
| 8 | +import org.gradle.internal.os.OperatingSystem |
| 9 | + |
| 10 | +tasks.register('run', JavaExec) { |
| 11 | + dependsOn classes |
| 12 | + mainClass = project.mainClassName |
| 13 | + classpath = sourceSets.main.runtimeClasspath |
| 14 | + standardInput = System.in |
| 15 | + workingDir = project.assetsDir |
| 16 | + ignoreExitValue = true |
| 17 | + |
| 18 | + if (OperatingSystem.current() == OperatingSystem.MAC_OS) { |
| 19 | + // Required to run on macOS |
| 20 | + jvmArgs += "-XstartOnFirstThread" |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +tasks.register('debug', JavaExec) { |
| 25 | + dependsOn classes |
| 26 | + mainClass = project.mainClassName |
| 27 | + classpath = sourceSets.main.runtimeClasspath |
| 28 | + standardInput = System.in |
| 29 | + workingDir = project.assetsDir |
| 30 | + ignoreExitValue = true |
| 31 | + debug = true |
| 32 | +} |
| 33 | + |
| 34 | +tasks.register('dist', Jar) { |
| 35 | + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) |
| 36 | + manifest { |
| 37 | + attributes 'Main-Class': project.mainClassName |
| 38 | + } |
| 39 | + dependsOn configurations.runtimeClasspath |
| 40 | + from { |
| 41 | + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } |
| 42 | + } |
| 43 | + with jar |
| 44 | +} |
| 45 | + |
| 46 | + |
| 47 | +dist.dependsOn classes |
| 48 | + |
| 49 | +eclipse.project.name = appName + "-desktop" |
0 commit comments