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