Compare commits

...
1 Commits
Author SHA1 Message Date
Raven Szewczyk ea3b258225 Don't minimize/relocate zenscript 2023-01-30 13:41:47 +00:00
2 changed files with 73 additions and 8 deletions

No files matched your search

+68 -8
View File
@@ -1,4 +1,4 @@
//version: 1674988119 //version: 1675084541
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -55,9 +55,9 @@ plugins {
id 'eclipse' id 'eclipse'
id 'scala' id 'scala'
id 'maven-publish' id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
@@ -113,6 +113,7 @@ propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "") propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true) propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
// Deprecated properties (kept for backwards compat) // Deprecated properties (kept for backwards compat)
propertyDefaultIfUnset("gradleTokenModId", "") propertyDefaultIfUnset("gradleTokenModId", "")
propertyDefaultIfUnset("gradleTokenModName", "") propertyDefaultIfUnset("gradleTokenModName", "")
@@ -149,6 +150,33 @@ java {
} }
} }
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project
kotlin {
jvmToolchain(8)
}
// Kotlin hacks our source sets, so we hack Kotlin's tasks
def disabledKotlinTaskList = [
"kaptGenerateStubsMcLauncherKotlin",
"kaptGenerateStubsPatchedMcKotlin",
"kaptGenerateStubsInjectedTagsKotlin",
"compileMcLauncherKotlin",
"compilePatchedMcKotlin",
"compileInjectedTagsKotlin",
"kaptMcLauncherKotlin",
"kaptPatchedMcKotlin",
"kaptInjectedTagsKotlin",
"kspMcLauncherKotlin",
"kspPatchedMcKotlin",
"kspInjectedTagsKotlin",
]
tasks.configureEach { task ->
if (task.name in disabledKotlinTaskList) {
task.enabled = false
}
}
}
configurations { configurations {
create("runtimeOnlyNonPublishable") { create("runtimeOnlyNonPublishable") {
description = "Runtime only dependencies that are not published alongside the jar" description = "Runtime only dependencies that are not published alongside the jar"
@@ -392,7 +420,7 @@ if (file('addon.gradle').exists()) {
// Allow unsafe repos but warn // Allow unsafe repos but warn
repositories.configureEach { repo -> repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
if (repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) { if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'") logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'")
repo.allowInsecureProtocol = true repo.allowInsecureProtocol = true
} }
@@ -502,6 +530,14 @@ dependencies {
} }
} }
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) {
dependencies {
kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
}
}
}
apply from: 'dependencies.gradle' apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
@@ -542,9 +578,11 @@ if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure { tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg) extraSrgFiles.from(mixinSrg)
} }
}
if (usesMixins.toBoolean()) { tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure { tasks.named("compileJava", JavaCompile).configure {
doFirst { doFirst {
new File(mixinTmpDir).mkdirs() new File(mixinTmpDir).mkdirs()
@@ -558,6 +596,25 @@ if (usesMixins.toBoolean()) {
"-XDignore.symbol.file" "-XDignore.symbol.file"
] ]
} }
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
} }
tasks.named("processResources", ProcessResources).configure { tasks.named("processResources", ProcessResources).configure {
@@ -613,6 +670,7 @@ if (usesShadowedDependencies.toBoolean()) {
tasks.register('relocateShadowJar', ConfigureShadowRelocation) { tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar target = tasks.shadowJar
prefix = modGroup + ".shadow" prefix = modGroup + ".shadow"
enabled = minimizeShadowedDependencies.toBoolean()
} }
tasks.named("shadowJar", ShadowJar).configure { tasks.named("shadowJar", ShadowJar).configure {
manifest { manifest {
@@ -628,7 +686,9 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile project.configurations.shadeCompile
] ]
archiveClassifier.set('dev') archiveClassifier.set('dev')
dependsOn(relocateShadowJar) if (minimizeShadowedDependencies.toBoolean()) {
dependsOn(relocateShadowJar)
}
} }
configurations.runtimeElements.outgoing.artifacts.clear() configurations.runtimeElements.outgoing.artifacts.clear()
configurations.apiElements.outgoing.artifacts.clear() configurations.apiElements.outgoing.artifacts.clear()
+5
View File
@@ -63,6 +63,11 @@ containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required. # responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = true usesShadowedDependencies = true
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = false
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = false
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories # Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true includeWellKnownRepositories = true