X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=desktop%2Fbuild.gradle;h=f909ef108038f25ce939a04c8e745a2784fa193a;hb=3a443514027417133d7a7e18766720dfea028a87;hp=8c919ce28f1304c4756e341e1c55249cf31edb28;hpb=b1614a603547cfdcc3501b178f03aa40f1b7b82f;p=cavedroid.git diff --git a/desktop/build.gradle b/desktop/build.gradle index 8c919ce..f909ef1 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -1,55 +1,50 @@ -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 = ["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("assets/") -task run(dependsOn: classes, type: JavaExec) { +task run(dependsOn: build, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true + ignoreExitValue = true as JavaExecSpec + args "--debug" } -task debug(dependsOn: classes, type: JavaExec) { +task runTouch(dependsOn: build, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true - debug = true + ignoreExitValue = true as JavaExecSpec + args "--touch", "--debug" } -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); - +task dist(dependsOn: build, type: Jar) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { attributes 'Main-Class': project.mainClassName } -} - -dist.dependsOn classes - -eclipse { - project { - name = appName + "-desktop" - linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' + from { + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + with jar } -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" }