gradle: check operating system
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
## Run Client
|
## Run Client
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gradle client:run
|
gradle :client:copyNatives :client:run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run Server
|
## Run Server
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gradle client:run
|
gradle :server:run
|
||||||
```
|
```
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
@@ -5,6 +7,7 @@ plugins {
|
|||||||
|
|
||||||
group = 'minecraft'
|
group = 'minecraft'
|
||||||
version = '1.12.2'
|
version = '1.12.2'
|
||||||
|
OperatingSystem os = DefaultNativePlatform.currentOperatingSystem
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
@@ -21,7 +24,7 @@ run {
|
|||||||
workingDir.mkdir()
|
workingDir.mkdir()
|
||||||
}
|
}
|
||||||
|
|
||||||
systemProperty 'java.library.path', file("$buildDir/natives/windows")
|
systemProperty 'java.library.path', file("$buildDir/natives")
|
||||||
args '--version', '1.12.2', '--accessToken', '0', '--assetsDir', 'assets', '--assetIndex', "1.12.2", '--userProperties', '{}'
|
args '--version', '1.12.2', '--accessToken', '0', '--assetsDir', 'assets', '--assetIndex', "1.12.2", '--userProperties', '{}'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +38,6 @@ dependencies {
|
|||||||
implementation name: 'com/mojang/authlib/1.5.25/authlib-1.5.25'
|
implementation name: 'com/mojang/authlib/1.5.25/authlib-1.5.25'
|
||||||
implementation name: 'com/mojang/text2speech/1.10.3/text2speech-1.10.3'
|
implementation name: 'com/mojang/text2speech/1.10.3/text2speech-1.10.3'
|
||||||
implementation name: 'com/mojang/realms/1.10.21/realms-1.10.21'
|
implementation name: 'com/mojang/realms/1.10.21/realms-1.10.21'
|
||||||
implementation name: 'com/mojang/text2speech/1.10.3/text2speech-1.10.3-natives-windows'
|
|
||||||
implementation name: 'com/paulscode/codecjorbis/20101023/codecjorbis-20101023'
|
implementation name: 'com/paulscode/codecjorbis/20101023/codecjorbis-20101023'
|
||||||
implementation name: 'com/paulscode/codecwav/20101023/codecwav-20101023'
|
implementation name: 'com/paulscode/codecwav/20101023/codecwav-20101023'
|
||||||
implementation name: 'com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123'
|
implementation name: 'com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123'
|
||||||
@@ -44,9 +46,16 @@ dependencies {
|
|||||||
implementation name: 'oshi-project/oshi-core/1.1/oshi-core-1.1'
|
implementation name: 'oshi-project/oshi-core/1.1/oshi-core-1.1'
|
||||||
implementation name: 'org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209'
|
implementation name: 'org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209'
|
||||||
implementation name: 'org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209'
|
implementation name: 'org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209'
|
||||||
implementation name: 'org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows'
|
|
||||||
implementation name: 'com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2'
|
implementation name: 'com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2'
|
||||||
|
|
||||||
|
if (os.isWindows()) {
|
||||||
|
implementation name: 'com/mojang/text2speech/1.10.3/text2speech-1.10.3-natives-windows'
|
||||||
|
implementation name: 'org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows'
|
||||||
|
} else {
|
||||||
|
implementation name: 'com/mojang/text2speech/1.10.3/text2speech-1.10.3-natives-linux'
|
||||||
|
implementation name: 'org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux'
|
||||||
|
}
|
||||||
|
|
||||||
implementation 'net.java.dev.jna:jna:4.4.0'
|
implementation 'net.java.dev.jna:jna:4.4.0'
|
||||||
implementation 'net.java.jinput:jinput:2.0.5'
|
implementation 'net.java.jinput:jinput:2.0.5'
|
||||||
implementation 'net.java.jinput:jinput-platform:2.0.5'
|
implementation 'net.java.jinput:jinput-platform:2.0.5'
|
||||||
@@ -63,13 +72,23 @@ dependencies {
|
|||||||
implementation 'commons-codec:commons-codec:1.10'
|
implementation 'commons-codec:commons-codec:1.10'
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyNativesWindows {
|
tasks.register('copyNatives').configure {
|
||||||
doLast {
|
doLast {
|
||||||
|
def classifier
|
||||||
|
def suffix
|
||||||
|
if (os.isWindows()) {
|
||||||
|
classifier = 'natives-windows'
|
||||||
|
suffix = '-natives-windows'
|
||||||
|
} else {
|
||||||
|
classifier = 'natives-linux'
|
||||||
|
suffix = '-natives-linux'
|
||||||
|
}
|
||||||
|
|
||||||
copy {
|
copy {
|
||||||
def resolvedArtifacts = configurations.compile.resolvedConfiguration.resolvedArtifacts
|
def resolvedArtifacts = configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts
|
||||||
def matches = resolvedArtifacts.findAll {it.classifier == 'natives-windows' || it.name.endsWith('-natives-windows')}
|
def matches = resolvedArtifacts.findAll {it.classifier == classifier || it.name.endsWith(suffix)}
|
||||||
from matches.collect { it.file }.collect { zipTree(it) }
|
from matches.collect { it.file }.collect { zipTree(it).matching { exclude 'META-INF/**' } }
|
||||||
into "$buildDir/natives/windows"
|
into "$buildDir/natives"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
libs/com/mojang/text2speech/1.10.3/text2speech-1.10.3-natives-linux.jar
(Stored with Git LFS)
Normal file
BIN
libs/com/mojang/text2speech/1.10.3/text2speech-1.10.3-natives-linux.jar
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
libs/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar
(Stored with Git LFS)
Normal file
BIN
libs/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user