75 lines
2.4 KiB
Groovy
75 lines
2.4 KiB
Groovy
//file:noinspection DependencyNotationArgument
|
||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||
|
||
plugins {
|
||
id "application"
|
||
}
|
||
|
||
application {
|
||
mainClassName = "Start"
|
||
}
|
||
|
||
run {
|
||
workingDir = new File(buildDir, "run")
|
||
if (!workingDir.exists()) {
|
||
workingDir.mkdir()
|
||
}
|
||
systemProperty "java.library.path", file("$buildDir/natives")
|
||
|
||
dependsOn ":client:copyNatives"
|
||
}
|
||
|
||
dependencies {
|
||
implementation(project(":shared"))
|
||
|
||
implementation("com.google.code.gson:gson:2.9.1")
|
||
|
||
implementation name: "jinput-1.0.0-b01"
|
||
implementation name: "jorbis-0.0.17"
|
||
implementation name: "org/lwjgl/lwjgl/lwjgl/2.9.0/lwjgl-2.9.0"
|
||
implementation name: "org/lwjgl/lwjgl/lwjgl_util/2.9.0/lwjgl_util-2.9.0"
|
||
implementation name: "paulscode"
|
||
|
||
if (DefaultNativePlatform.currentOperatingSystem.isWindows()) {
|
||
implementation name: "org/lwjgl/lwjgl/lwjgl-platform/2.9.0/lwjgl-platform-2.9.0-natives-windows"
|
||
// вроде подходит и слава богу
|
||
implementation name: "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows"
|
||
} else {
|
||
implementation name: "org/lwjgl/lwjgl/lwjgl-platform/2.9.0/lwjgl-platform-2.9.0-natives-linux"
|
||
// вроде подходит и слава богу
|
||
implementation name: "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux"
|
||
}
|
||
}
|
||
|
||
tasks.register("copyNatives").configure {
|
||
doLast {
|
||
def classifier
|
||
def suffix
|
||
if (DefaultNativePlatform.currentOperatingSystem.isWindows()) {
|
||
classifier = "natives-windows"
|
||
suffix = "-natives-windows"
|
||
} else {
|
||
classifier = "natives-linux"
|
||
suffix = "-natives-linux"
|
||
}
|
||
|
||
copy {
|
||
def resolvedArtifacts = configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts
|
||
def matches = resolvedArtifacts.findAll {it.classifier == classifier || it.name.endsWith(suffix)}
|
||
from matches.collect { it.file }.collect { zipTree(it).matching { exclude "META-INF/**" } }
|
||
into "$buildDir/natives"
|
||
}
|
||
}
|
||
}
|
||
|
||
task unpackResources(type: Copy) {
|
||
File zipFile = file("../mc-resources.zip")
|
||
File outputDir = new File(buildDir, "run")
|
||
if (!outputDir.exists()) {
|
||
outputDir.mkdir()
|
||
}
|
||
println(zipFile.absolutePath)
|
||
|
||
from zipTree(zipFile)
|
||
into outputDir
|
||
} |