-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix lib relocation when lib is not included
Alright, this basically occurred because the shared project used to relocate almost every library, for example, SnakeYaml was being relocated as YamlFile uses it and it's part of the shared project, but when using MCUtils-Spigot as a plugin, an exception was thrown as the relocated classes weren't present. This is because MCUtils-Spigot does not shade SnakeYaml as it is present on Spigot already. Sadly, now every platform has to relocate its libraries to fix this issue (Except jetbrains annotations, which are global and as such part of the mcutils shadow conventions)
- Loading branch information
Showing
4 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
30 changes: 15 additions & 15 deletions
30
buildSrc/src/main/kotlin/mcutils.shadow-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import org.gradle.kotlin.dsl.support.uppercaseFirstChar | ||
|
||
plugins { | ||
java | ||
com.gradleup.shadow | ||
java | ||
com.gradleup.shadow | ||
} | ||
|
||
tasks { | ||
shadowJar { | ||
archiveClassifier = null | ||
shadowJar { | ||
archiveFileName = "MCUtils-" + project.name.uppercaseFirstChar() + "-${rootProject.version}.jar" | ||
archiveClassifier = null | ||
|
||
relocate("org.jetbrains.annotations", "net.codersky.mcutils.shaded.jetbrains.annotations") | ||
relocate("org.intellij.lang.annotations", "net.codersky.mcutils.shaded.intellij.annotations") | ||
relocate("net.kyori", "net.codersky.mcutils.shaded.kyori") | ||
relocate("org.yaml.snakeyaml", "net.codersky.mcutils.shaded.snakeyaml") | ||
relocate("org.jetbrains.annotations", "net.codersky.mcutils.shaded.jetbrains.annotations") | ||
relocate("org.intellij.lang.annotations", "net.codersky.mcutils.shaded.intellij.annotations") | ||
|
||
mergeServiceFiles() | ||
minimize() | ||
} | ||
mergeServiceFiles() | ||
minimize() | ||
} | ||
|
||
assemble { | ||
dependsOn(shadowJar) | ||
} | ||
assemble { | ||
dependsOn(shadowJar) | ||
} | ||
} | ||
|
||
configurations.implementation.get().extendsFrom(configurations.shadow.get()) | ||
configurations.implementation.get().extendsFrom(configurations.shadow.get()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters