X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=desktop%2Fbuild.gradle;h=04317e4a995c6299132e0aa0225ce17e69d005de;hb=4e63a1e672fcf47fab405eb660f7020b6f5c0283;hp=8c919ce28f1304c4756e341e1c55249cf31edb28;hpb=b1614a603547cfdcc3501b178f03aa40f1b7b82f;p=cavedroid.git diff --git a/desktop/build.gradle b/desktop/build.gradle index 8c919ce..04317e4 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -1,17 +1,34 @@ -apply plugin: "java" +plugins { + id 'java-library' + id 'kotlin' + id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlinVersion" +} + +java.targetCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_1_8 -sourceCompatibility = 1.6 -sourceSets.main.java.srcDirs = [ "src/" ] +sourceSets.main.java.srcDirs = ["src/"] +sourceSets.main.resources.srcDirs = ["../android/assets"] -project.ext.mainClassName = "ru.deadsoftware.cavecraft.desktop.DesktopLauncher" -project.ext.assetsDir = new File("../android/assets"); +project.ext.mainClassName = "ru.deadsoftware.cavedroid.desktop.DesktopLauncher" +project.ext.assetsDir = new File("../android/assets") task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true + ignoreExitValue = true as JavaExecSpec + args "--debug" +} + +task runTouch(dependsOn: classes, type: JavaExec) { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true as JavaExecSpec + args "--touch", "--debug" } task debug(dependsOn: classes, type: JavaExec) { @@ -19,37 +36,26 @@ task debug(dependsOn: classes, type: JavaExec) { classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true + ignoreExitValue = true as JavaExecSpec debug = true } task dist(type: Jar) { - from files(sourceSets.main.output.classesDir) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); - + duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { attributes 'Main-Class': project.mainClassName } + from { + configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } + } + with jar } dist.dependsOn classes -eclipse { - project { - name = appName + "-desktop" - linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' - } -} - -task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { - doLast { - def classpath = new XmlParser().parse(file(".classpath")) - new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); - def writer = new FileWriter(file(".classpath")) - def printer = new XmlNodePrinter(new PrintWriter(writer)) - printer.setPreserveWhitespace(true) - printer.print(classpath) - } +dependencies { + implementation project(":core") + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion" + api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" + api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" }