1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00

Improve packaging of published jars

- Publish javadoc again: for now this is just the common-api

 - Remove all dependencies from the published Forge jar. This is
   technically not needed (fg.deobf does this anyway), but seems
   sensible.
This commit is contained in:
Jonathan Coates 2022-11-08 16:43:27 +00:00
parent 0908acbe9b
commit 320007dbc6
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
10 changed files with 56 additions and 20 deletions

View File

@ -15,5 +15,5 @@ rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
"$GITHUB_WORKSPACE/projects/web/build/site/" \
"$SSH_USER@$SSH_HOST:/$DEST"
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
"$GITHUB_WORKSPACE/build/docs/javadoc/" \
"$GITHUB_WORKSPACE/projects/common-api/build/docs/javadoc/" \
"$SSH_USER@$SSH_HOST:/$DEST/javadoc"

View File

@ -3,7 +3,7 @@ name: Build documentation
on:
push:
branches:
- mc-1.16.x
- mc-1.19.x
jobs:
make_doc:
@ -29,7 +29,7 @@ jobs:
run: ./gradlew compileJava --no-daemon || ./gradlew compileJava --no-daemon
- name: Generate documentation
run: ./gradlew docWebsite javadoc --no-daemon
run: ./gradlew docWebsite :common-api:javadoc --no-daemon
- name: Upload documentation
run: .github/workflows/make-doc.sh 2> /dev/null

View File

@ -1,4 +1,6 @@
import cc.tweaked.gradle.*
import groovy.util.Node
import groovy.util.NodeList
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import net.minecraftforge.gradle.common.util.RunConfig
import org.jetbrains.gradle.ext.compiler
@ -33,10 +35,6 @@ cct {
allProjects.forEach { externalSources(it) }
}
java {
registerFeature("extraMods") { usingSourceSet(sourceSets.main.get()) }
}
sourceSets {
// ForgeGradle adds a dep on the clientClasses task, despite forge-api coming from a separate project. Register an
// empty one.
@ -158,10 +156,8 @@ dependencies {
compileOnly(libs.jetbrainsAnnotations)
annotationProcessorEverywhere(libs.autoService)
"extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.19.2-forge-api:11.3.0.262"))
"extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.19.2-common-api:11.3.0.262"))
"extraModsRuntimeOnly"(fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.262"))
"extraModsCompileOnly"(fg.deobf("maven.modrinth:oculus:1.2.5"))
libs.bundles.externalMods.forge.compile.get().map { compileOnly(fg.deobf(it)) }
libs.bundles.externalMods.forge.runtime.get().map { runtimeOnly(fg.deobf(it)) }
implementation(project(":core"))
implementation(commonClasses(project(":forge-api")))
@ -233,7 +229,7 @@ tasks.shadowJar {
configurations = listOf(project.configurations["shade"])
relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt")
relocate("io.netty.handler.codec.http", "cc.tweaked.internal.netty")
relocate("io.netty.handler", "cc.tweaked.internal.netty")
// TODO: minimize(): Would be good to support once our build scripts are stabilised.
}
@ -334,10 +330,21 @@ githubRelease {
tasks.publish { dependsOn(tasks.githubRelease) }
// Don't publish the slim jar
for (cfg in listOf(configurations.apiElements, configurations.runtimeElements)) {
cfg.configure { artifacts.removeIf { it.classifier == "slim" } }
}
publishing {
publications {
named("maven", MavenPublication::class) {
fg.component(this)
// Remove all dependencies: they're shaded anyway! This is very ugly, but not found a better way :(.
pom.withXml {
for (node in asNode().get("dependencies") as NodeList) {
asNode().remove(node as Node)
}
}
}
}
}

View File

@ -64,11 +64,12 @@ tasks.withType(JavaCompile::class.java).configureEach {
options.encoding = "UTF-8"
}
tasks.jar {
isReproducibleFileOrder = true
tasks.withType(AbstractArchiveTask::class.java).configureEach {
isPreserveFileTimestamps = false
archiveClassifier.set("slim")
isReproducibleFileOrder = true
}
tasks.jar {
manifest {
attributes(
"Specification-Title" to "computercraft",

View File

@ -95,7 +95,7 @@ MC projects, as that adds a project(self) -> test dependency, which would pull i
// Configure some tasks to include our additional files.
project.tasks.named("javadoc", Javadoc::class.java) {
source += client.allJava
source(client.allJava)
classpath = main.compileClasspath + main.output + client.compileClasspath + client.output
}
// This are already done by Fabric, but we need it for Forge and vanilla. It shouldn't conflict at all.

View File

@ -6,6 +6,7 @@ forge = "43.1.1"
parchment = "2022.10.16"
parchmentMc = "1.19.2"
# Normal dependencies
asm = "9.3"
autoService = "1.0.1"
checkerFramework = "3.12.0"
@ -21,6 +22,10 @@ netty = { strictly = "[4.1.77.Final,5.0)", prefer = "4.1.77.Final" }
nightConfig = "3.6.5"
slf4j = "1.7.36"
# Minecraft mods
jei = "11.3.0.262"
oculus = "1.2.5"
# Testing
hamcrest = "2.2"
jqwik = "1.7.0"
@ -46,6 +51,7 @@ taskTree = "2.1.0"
vanillaGradle = "0.2.1-SNAPSHOT"
[libraries]
# Normal dependencies
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
autoService = { module = "com.google.auto.service:auto-service", version.ref = "autoService" }
checkerFramework = { module = "org.checkerframework:checker-qual", version.ref = "checkerFramework" }
@ -59,6 +65,12 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.re
netty-http = { module = "io.netty:netty-codec-http", version.ref = "netty" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
# Minecraft mods
jei-api = { module = "mezz.jei:jei-1.19.2-common-api", version.ref = "jei" }
jei-fabric = { module = "mezz.jei:jei-1.19.2-fabric", version.ref = "jei" }
jei-forge = { module = "mezz.jei:jei-1.19.2-forge", version.ref = "jei" }
oculus = { module = "maven.modrinth:oculus", version.ref = "oculus" }
# Testing
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
jqwik-api = { module = "net.jqwik:jqwik-api", version.ref = "jqwik" }
@ -97,6 +109,11 @@ taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
[bundles]
kotlin = ["kotlin-stdlib", "kotlin-coroutines"]
# Minecraft
externalMods-common = ["jei-api"]
externalMods-forge-compile = ["oculus", "jei-api"]
externalMods-forge-runtime = ["jei-forge"]
# Testing
test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"]
testRuntime = ["junit-jupiter-engine", "jqwik-engine"]

View File

@ -15,4 +15,7 @@ dependencies {
tasks.javadoc {
include("dan200/computercraft/api/**/*.java")
// Include the core-api in our javadoc export. This is wrong, but it means we can export a single javadoc dump.
source(project(":core-api").sourceSets.main.map { it.allJava })
}

View File

@ -20,7 +20,7 @@ dependencies {
compileOnlyApi(libs.checkerFramework)
compileOnlyApi(libs.jetbrainsAnnotations)
"docApi"(project(":"))
"docApi"(project(":common-api"))
}
tasks.javadoc {

View File

@ -34,11 +34,11 @@
* // ...
* }
* }</pre>
* <p>
* New capabilities or block lookups (those not built into Forge/Fabric) must be explicitly registered using the
* loader-specific API.
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerGenericSource(GenericSource)
* @see dan200.computercraft.api.ForgeComputerCraftAPI#registerGenericCapability New capabilities (those not
* built into Forge) must be explicitly given to the generic peripheral system, as there is no way to enumerate all
* capabilities.
*/
public interface GenericSource {
/**

View File

@ -16,3 +16,11 @@ dependencies {
tasks.javadoc {
include("dan200/computercraft/api/**/*.java")
}
publishing {
publications {
named("maven", MavenPublication::class) {
fg.component(this)
}
}
}