Check if java.instrument.jmod is present in the build.gradle.kts file, and add jetbrains annotations
This commit is contained in:
parent
870c7af084
commit
863bc99c10
|
@ -56,6 +56,7 @@ subprojects {
|
|||
allowaccessmodification()
|
||||
adaptclassstrings()
|
||||
"$group.**".also { dontnote(it); dontwarn(it) }
|
||||
dontwarn("net.minecraft.**"); dontwarn("com.mojang.**")
|
||||
|
||||
// kotlinx-serialization related configuration:
|
||||
dontnote("kotlinx.serialization.AnnotationsKt")
|
||||
|
@ -65,18 +66,18 @@ subprojects {
|
|||
keepclasseswithmembers("class $group.snowygui.** { kotlinx.serialization.KSerializer serializer(...); }")
|
||||
|
||||
val homeDir = System.getProperty("java.home") as String
|
||||
libraryjars(configurations.compileClasspath.get().filter { file ->
|
||||
listOf(
|
||||
"kotlin",
|
||||
"gson"
|
||||
).any {
|
||||
file.name.startsWith(it)
|
||||
}
|
||||
libraryjars(configurations.runtimeClasspath.get().filterNot { file ->
|
||||
shadowC.contains(file)
|
||||
})
|
||||
if (JavaVersion.current().isJava9Compatible) {
|
||||
val jmodLocation = "$homeDir/jmods/java.base.jmod"
|
||||
if (!file(jmodLocation).exists()) throw GradleException("Java.base.jmod appears to be missing, please make sure that jmods are installed.")
|
||||
else libraryjars(jmodLocation)
|
||||
val jmodsLocations = setOf(
|
||||
"$homeDir/jmods/java.base.jmod",
|
||||
"$homeDir/jmods/java.instrument.jmod"
|
||||
)
|
||||
if (jmodsLocations.all { !file(it).exists() }) throw GradleException("Jmods appear to be missing, please make sure that jmods are installed.")
|
||||
else jmodsLocations.forEach {
|
||||
libraryjars(it)
|
||||
}
|
||||
} else libraryjars("$homeDir/lib/rt.jar")
|
||||
// Note: dontpreverify() should NOT be used, it will cause errors at runtime
|
||||
useuniqueclassmembernames()
|
||||
|
@ -98,7 +99,8 @@ subprojects {
|
|||
listOf(
|
||||
"$kotlinX:kotlinx-datetime:0.2.0",
|
||||
"com.typesafe:config:1.4.1",
|
||||
"io.github.config4k:config4k:0.4.2"
|
||||
"io.github.config4k:config4k:0.4.2",
|
||||
"org.jetbrains:annotations:20.1.0"
|
||||
).forEach { implementation(it); shadowC(it) { isTransitive = false; } }
|
||||
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
||||
"mappings"(mappingsDep)
|
||||
|
@ -142,7 +144,6 @@ allprojects {
|
|||
tasks {
|
||||
withType(ShadowJar::class) {
|
||||
relocate("kotlinx.datetime", "${rootProject.group}.datetime")
|
||||
relocate("kotlinx.serialization", "${rootProject.group}.serialization")
|
||||
relocate("org.jetbrains", "${rootProject.group}.jetbrainslibs")
|
||||
relocate("javassist", "${rootProject.group}.javassist")
|
||||
relocate("org.reflections8", "${rootProject.group}.reflectionlib")
|
||||
|
|
Loading…
Reference in New Issue