165 lines
4.3 KiB
Groovy
165 lines
4.3 KiB
Groovy
import org.embeddedt.embeddium.gradle.task.GenerateLWJGLAbstraction
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'xyz.wagyourtail.jvmdowngrader' version '1.3.6'
|
|
}
|
|
|
|
group = "org.embeddedt.celeritas"
|
|
version = rootProject.version
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
withSourcesJar()
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
def generatedSourcesDir = layout.buildDirectory.dir("generated/sources/lwjgl-abstraction/java")
|
|
|
|
sourceSets {
|
|
lwjglCommon {
|
|
java.srcDir(generatedSourcesDir.map { it.dir("main") })
|
|
}
|
|
lwjgl2 {
|
|
java.srcDir(generatedSourcesDir.map { it.dir("lwjgl2") })
|
|
compileClasspath += main.compileClasspath
|
|
compileClasspath += lwjglCommon.output
|
|
}
|
|
lwjgl3 {
|
|
java.srcDir(generatedSourcesDir.map { it.dir("lwjgl3") })
|
|
compileClasspath += main.compileClasspath
|
|
compileClasspath += lwjglCommon.output
|
|
}
|
|
main {
|
|
compileClasspath += lwjglCommon.output
|
|
}
|
|
}
|
|
|
|
def generateAbstractionLayer = tasks.register("generateLWJGLAbstraction", GenerateLWJGLAbstraction) {
|
|
lwjgl2Classpath.from(configurations.named("lwjgl2CompileClasspath"))
|
|
lwjgl3Classpath.from(configurations.named("lwjgl3CompileClasspath"))
|
|
outputDirectory.set(generatedSourcesDir)
|
|
}
|
|
|
|
tasks.named("compileLwjglCommonJava") {
|
|
dependsOn(generateAbstractionLayer)
|
|
}
|
|
|
|
dependencies {
|
|
def lwjglVersion = "3.3.1"
|
|
def lwjgl2Version = "2.9.3"
|
|
|
|
lwjgl3CompileOnly(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
|
|
lwjgl3CompileOnly "org.lwjgl:lwjgl"
|
|
lwjgl3CompileOnly "org.lwjgl:lwjgl-opengl"
|
|
|
|
lwjgl2CompileOnly("org.lwjgl.lwjgl:lwjgl:$lwjgl2Version")
|
|
|
|
implementation "org.joml:joml:1.10.5"
|
|
implementation "it.unimi.dsi:fastutil:7.1.0"
|
|
implementation "org.apache.logging.log4j:log4j-api:2.0-beta9"
|
|
compileOnly "org.jetbrains:annotations:24.1.0"
|
|
compileOnly("org.projectlombok:lombok:1.18.30")
|
|
annotationProcessor("org.projectlombok:lombok:1.18.30")
|
|
implementation("org.ow2.asm:asm:9.6")
|
|
implementation("org.ow2.asm:asm-tree:9.6")
|
|
implementation("org.ow2.asm:asm-util:9.6")
|
|
|
|
implementation "com.google.code.gson:gson:2.10.1"
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.0'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
tasks.named('test', Test) {
|
|
useJUnitPlatform()
|
|
|
|
maxHeapSize = '1G'
|
|
|
|
testLogging {
|
|
events "passed"
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId 'celeritas-common'
|
|
from components.java
|
|
|
|
artifact(shadeDowngradedApi) {
|
|
classifier = 'downgraded-8'
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = "taumcRepository"
|
|
url = uri("https://maven.taumc.org/releases")
|
|
credentials {
|
|
username = System.getenv("MAVEN_USERNAME")
|
|
password = System.getenv("MAVEN_SECRET")
|
|
}
|
|
authentication {
|
|
basic(BasicAuthentication)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jar {
|
|
from(rootProject.file("COPYING"))
|
|
from(rootProject.file("COPYING.LESSER"))
|
|
from(sourceSets.lwjglCommon.output)
|
|
from(sourceSets.lwjgl2.output)
|
|
from(sourceSets.lwjgl3.output)
|
|
manifest {
|
|
attributes([
|
|
"Lwjgl3ify-Aware": "true"
|
|
])
|
|
}
|
|
}
|
|
|
|
def extraSourceSets = [sourceSets.lwjglCommon, sourceSets.lwjgl2]
|
|
|
|
configurations {
|
|
apiElements
|
|
runtimeElements
|
|
}
|
|
|
|
extraSourceSets.each { srcSet ->
|
|
["apiElements", "runtimeElements"].each { conf ->
|
|
configurations.getByName(conf).outgoing.variants.named("classes") {
|
|
artifact(srcSet.java.destinationDirectory) {
|
|
builtBy tasks.named(srcSet.compileJavaTaskName)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
downgraded {
|
|
canBeConsumed = true
|
|
canBeResolved = false
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
downgraded(tasks.named("shadeDowngradedApi"))
|
|
}
|
|
|
|
// make RFG stop complaining
|
|
def obfAttr = Attribute.of("com.gtnewhorizons.retrofuturagradle.obfuscation", String)
|
|
def transformedAttr = Attribute.of("rfgDeobfuscatorTransformed", Boolean)
|
|
|
|
["runtimeElements", "downgraded"].forEach { name ->
|
|
configurations.getByName(name).attributes {
|
|
attribute(obfAttr, "mcp")
|
|
attribute(transformedAttr, true)
|
|
}
|
|
} |