mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 20:20:30 +00:00
Use the Gradle shadow plugin to shade deps
Just saves us from having to worry about conflicts with other mods which bundle Cobalt. This might make the transition to Jar-in-Jar easier too - not sure yet! Also produce an API jar - fixes #1060.
This commit is contained in:
parent
6d5b13dbbc
commit
1a0e3fc2fa
@ -35,7 +35,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cct_version}")
|
compileOnly fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cct_version}:api")
|
||||||
|
runtimeOnly fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cct_version}")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
40
build.gradle
40
build.gradle
@ -5,14 +5,14 @@ plugins {
|
|||||||
id "com.github.hierynomus.license" version "0.16.1"
|
id "com.github.hierynomus.license" version "0.16.1"
|
||||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||||
id "com.github.breadmoirai.github-release" version "2.2.12"
|
id "com.github.breadmoirai.github-release" version "2.2.12"
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.7.0'
|
id "org.jetbrains.kotlin.jvm" version "1.7.0"
|
||||||
id "com.modrinth.minotaur" version "2.+"
|
id "com.modrinth.minotaur" version "2.+"
|
||||||
id "net.minecraftforge.gradle" version "5.1.+"
|
id "net.minecraftforge.gradle" version "5.1.+"
|
||||||
id "org.spongepowered.mixin" version "0.7.+"
|
id "org.spongepowered.mixin" version "0.7.+"
|
||||||
id "org.parchmentmc.librarian.forgegradle" version "1.+"
|
id "org.parchmentmc.librarian.forgegradle" version "1.+"
|
||||||
|
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
||||||
import com.hierynomus.gradle.license.tasks.LicenseFormat
|
import com.hierynomus.gradle.license.tasks.LicenseFormat
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
@ -103,6 +103,10 @@ mixin {
|
|||||||
add sourceSets.main, 'computercraft.mixins.refmap.json'
|
add sourceSets.main, 'computercraft.mixins.refmap.json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reobf {
|
||||||
|
shadowJar {}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
@ -112,7 +116,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
shade
|
shade { transitive = false }
|
||||||
implementation.extendsFrom shade
|
implementation.extendsFrom shade
|
||||||
cctJavadoc
|
cctJavadoc
|
||||||
|
|
||||||
@ -156,6 +160,14 @@ javadoc {
|
|||||||
include "dan200/computercraft/api/**/*.java"
|
include "dan200/computercraft/api/**/*.java"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task apiJar(type: Jar) {
|
||||||
|
archiveClassifier.set("api")
|
||||||
|
from(sourceSets.main.output) {
|
||||||
|
include "dan200/computercraft/api/**/*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assemble.dependsOn(apiJar)
|
||||||
|
|
||||||
task luaJavadoc(type: Javadoc) {
|
task luaJavadoc(type: Javadoc) {
|
||||||
description "Generates documentation for Java-side Lua functions."
|
description "Generates documentation for Java-side Lua functions."
|
||||||
group "documentation"
|
group "documentation"
|
||||||
@ -174,6 +186,9 @@ task luaJavadoc(type: Javadoc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
finalizedBy("reobfJar")
|
||||||
|
|
||||||
|
archiveClassifier.set("slim")
|
||||||
manifest {
|
manifest {
|
||||||
attributes([
|
attributes([
|
||||||
"Specification-Title" : "computercraft",
|
"Specification-Title" : "computercraft",
|
||||||
@ -186,11 +201,18 @@ jar {
|
|||||||
"MixinConfigs" : "computercraft.mixins.json",
|
"MixinConfigs" : "computercraft.mixins.json",
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar.finalizedBy("reobfJar")
|
shadowJar {
|
||||||
|
finalizedBy("reobfShadowJar")
|
||||||
|
|
||||||
|
archiveClassifier.set("")
|
||||||
|
configurations = [project.configurations.shade]
|
||||||
|
relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt")
|
||||||
|
minimize()
|
||||||
|
}
|
||||||
|
|
||||||
|
assemble.dependsOn("shadowJar")
|
||||||
|
|
||||||
[compileJava, compileTestJava, compileTestModJava].forEach {
|
[compileJava, compileTestJava, compileTestModJava].forEach {
|
||||||
it.configure {
|
it.configure {
|
||||||
@ -491,10 +513,10 @@ curseforge {
|
|||||||
id = '282001'
|
id = '282001'
|
||||||
releaseType = isStable ? 'release' : 'alpha'
|
releaseType = isStable ? 'release' : 'alpha'
|
||||||
changelog = "Release notes can be found on the GitHub repository (https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
changelog = "Release notes can be found on the GitHub repository (https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||||
|
mainArtifact(shadowJar)
|
||||||
|
|
||||||
addGameVersion "${mc_version}"
|
addGameVersion "${mc_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modrinth {
|
modrinth {
|
||||||
@ -502,16 +524,16 @@ modrinth {
|
|||||||
projectId = 'gu7yAYhd'
|
projectId = 'gu7yAYhd'
|
||||||
versionNumber = "${project.mc_version}-${project.mod_version}"
|
versionNumber = "${project.mc_version}-${project.mod_version}"
|
||||||
versionType = isStable ? 'release' : 'alpha'
|
versionType = isStable ? 'release' : 'alpha'
|
||||||
uploadFile = jar
|
uploadFile = shadowJar
|
||||||
gameVersions = [project.mc_version]
|
gameVersions = [project.mc_version]
|
||||||
changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
from components.java
|
from components.java
|
||||||
|
// artifact(apiJar)
|
||||||
fg.component(it)
|
fg.component(it)
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
|
Loading…
Reference in New Issue
Block a user