104 lines
2.7 KiB
Groovy
104 lines
2.7 KiB
Groovy
plugins {
|
|
id 'maven-publish'
|
|
id 'java'
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
}
|
|
}
|
|
|
|
archivesBaseName = project.archives_base_name
|
|
version = project.version
|
|
group = project.maven_group
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
import org.gradle.internal.os.OperatingSystem
|
|
|
|
switch (OperatingSystem.current()) {
|
|
//TODO fetch proper natives based on architecture
|
|
case OperatingSystem.MAC_OS:
|
|
project.ext.lwjglNatives = "natives-macos"
|
|
break
|
|
case OperatingSystem.LINUX:
|
|
project.ext.lwjglNatives = "natives-linux"
|
|
break
|
|
case OperatingSystem.WINDOWS:
|
|
project.ext.lwjglNatives = "natives-windows"
|
|
break
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
|
|
|
implementation platform("org.lwjgl:lwjgl-bom:$lwjgl_version")
|
|
|
|
implementation "net.java.jinput:jinput:2.0.9"
|
|
// lwjgl_util picks up lwjgl 2.9.3 and we don't want that
|
|
// implementation "org.lwjgl.lwjgl:lwjgl_util:2.9.3"
|
|
implementation "org.lwjgl:lwjgl"
|
|
implementation "org.lwjgl:lwjgl-glfw"
|
|
implementation "org.lwjgl:lwjgl-openal"
|
|
implementation "org.lwjgl:lwjgl-opengl"
|
|
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
|
|
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
|
|
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
|
|
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
|
|
|
|
testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.5.2')
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.0.0'
|
|
testImplementation "org.ow2.asm:asm:${project.asm_version}"
|
|
testImplementation "org.ow2.asm:asm-tree:${project.asm_version}"
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
exceptionFormat = 'full'
|
|
events = ["passed", "failed", "skipped"]
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
|
|
task mergeMethods(type: org.mcphackers.legacylwjgl3.MergeLWJGL) {
|
|
dependsOn compileJava
|
|
|
|
classpath = configurations.compileClasspath.resolve()
|
|
sourceSet = sourceSets.main.output.classesDirs.getFiles()
|
|
}
|
|
classes.finalizedBy mergeMethods
|
|
|
|
task sourcesJar(type: Jar) {
|
|
archiveClassifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifact jar
|
|
artifact sourcesJar
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
|
|
maven {
|
|
name = "taumcRepository"
|
|
url = uri("https://maven.taumc.org/releases")
|
|
credentials {
|
|
username = System.getenv("MAVEN_USERNAME")
|
|
password = System.getenv("MAVEN_SECRET")
|
|
}
|
|
authentication {
|
|
basic(BasicAuthentication)
|
|
}
|
|
}
|
|
}
|
|
}
|