From 45fb6ac7e974836ac9566ce0ea193f9795e51385 Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Sun, 22 Jan 2023 17:37:18 +0000 Subject: [PATCH] Add an option to not minimize shadowed dependencies (#110) --- build.gradle | 11 ++++++++--- gradle.properties | 5 ++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 2dc32c9..7adc079 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1673027205 +//version: 1674294951 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -144,6 +144,7 @@ propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeRelations", "") +propertyDefaultIfUnset("minimizeShadowedDependencies", true) String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -411,7 +412,9 @@ shadowJar { attributes(getManifestAttributes()) } - minimize() // This will only allow shading for actually used classes + if (minimizeShadowedDependencies.toBoolean()) { + minimize() // This will only allow shading for actually used classes + } configurations = [ project.configurations.shadowImplementation, project.configurations.shadowCompile @@ -554,7 +557,9 @@ task shadowDevJar(type: ShadowJar) { attributes(getManifestAttributes()) } - minimize() // This will only allow shading for actually used classes + if (minimizeShadowedDependencies.toBoolean()) { + minimize() // This will only allow shading for actually used classes + } configurations = [ project.configurations.shadowImplementation, project.configurations.shadowCompile diff --git a/gradle.properties b/gradle.properties index 30f2705..25695e1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -71,6 +71,9 @@ forceEnableMixins = false # 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. usesShadowedDependencies = false +# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access +# their own classes, making the minimization unreliable. +minimizeShadowedDependencies = true # Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. @@ -114,4 +117,4 @@ curseForgeRelations = # Uncomment this to disable spotless checks # This should only be uncommented to keep it easier to sync with upstream/other forks. # That is, if there is no other active fork/upstream, NEVER change this. -# disableSpotless = true \ No newline at end of file +# disableSpotless = true