build: переход на Gradle Kotlin DSL
This commit is contained in:
82
build.gradle.kts
Normal file
82
build.gradle.kts
Normal file
@@ -0,0 +1,82 @@
|
||||
plugins {
|
||||
java
|
||||
application
|
||||
}
|
||||
|
||||
group = "lwjake2"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs("src")
|
||||
resources.srcDirs("resources")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
val lwjglVersion by extra("2.9.3")
|
||||
val lwjglPlatform by extra(
|
||||
when {
|
||||
org.gradle.internal.os.OperatingSystem.current().isWindows -> "windows"
|
||||
org.gradle.internal.os.OperatingSystem.current().isMacOsX -> "osx"
|
||||
else -> "linux"
|
||||
}
|
||||
)
|
||||
|
||||
dependencies {
|
||||
implementation("org.lwjgl.lwjgl:lwjgl:$lwjglVersion")
|
||||
implementation("org.lwjgl.lwjgl:lwjgl_util:$lwjglVersion")
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("lwjake2.LWJake2")
|
||||
applicationDefaultJvmArgs = listOf("-Djava.library.path=${layout.buildDirectory.get()}/natives/$lwjglPlatform")
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<Wrapper> {
|
||||
gradleVersion = "8.10"
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
}
|
||||
|
||||
withType<JavaCompile> {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.addAll(listOf("-Xlint:unchecked", "-Xlint:deprecation"))
|
||||
}
|
||||
|
||||
register<Copy>("unpackBaseQ2") {
|
||||
val zipFile = file("baseq2.zip")
|
||||
println(zipFile.absolutePath)
|
||||
|
||||
eachFile {
|
||||
path = path.substringAfter('/').substringAfter('\\')
|
||||
}
|
||||
includeEmptyDirs = false
|
||||
|
||||
from(zipTree(zipFile))
|
||||
into("baseq2")
|
||||
}
|
||||
|
||||
register<Copy>("unpackNative") {
|
||||
configurations.runtimeClasspath.get().filter {
|
||||
it.name.contains("lwjgl-platform-") &&
|
||||
it.name.contains(lwjglPlatform)
|
||||
}.forEach {
|
||||
includeEmptyDirs = false
|
||||
from(zipTree(it)) {
|
||||
exclude("META-INF/*")
|
||||
}
|
||||
into(layout.buildDirectory.dir("natives/$lwjglPlatform"))
|
||||
}
|
||||
}
|
||||
|
||||
named<JavaExec>("run") {
|
||||
dependsOn("unpackNative")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user