1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-04 17:16:20 +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/" \ "$GITHUB_WORKSPACE/projects/web/build/site/" \
"$SSH_USER@$SSH_HOST:/$DEST" "$SSH_USER@$SSH_HOST:/$DEST"
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \ 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" "$SSH_USER@$SSH_HOST:/$DEST/javadoc"

View File

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

View File

@ -1,4 +1,6 @@
import cc.tweaked.gradle.* import cc.tweaked.gradle.*
import groovy.util.Node
import groovy.util.NodeList
import net.darkhax.curseforgegradle.TaskPublishCurseForge import net.darkhax.curseforgegradle.TaskPublishCurseForge
import net.minecraftforge.gradle.common.util.RunConfig import net.minecraftforge.gradle.common.util.RunConfig
import org.jetbrains.gradle.ext.compiler import org.jetbrains.gradle.ext.compiler
@ -33,10 +35,6 @@ cct {
allProjects.forEach { externalSources(it) } allProjects.forEach { externalSources(it) }
} }
java {
registerFeature("extraMods") { usingSourceSet(sourceSets.main.get()) }
}
sourceSets { sourceSets {
// ForgeGradle adds a dep on the clientClasses task, despite forge-api coming from a separate project. Register an // ForgeGradle adds a dep on the clientClasses task, despite forge-api coming from a separate project. Register an
// empty one. // empty one.
@ -158,10 +156,8 @@ dependencies {
compileOnly(libs.jetbrainsAnnotations) compileOnly(libs.jetbrainsAnnotations)
annotationProcessorEverywhere(libs.autoService) annotationProcessorEverywhere(libs.autoService)
"extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.19.2-forge-api:11.3.0.262")) libs.bundles.externalMods.forge.compile.get().map { compileOnly(fg.deobf(it)) }
"extraModsCompileOnly"(fg.deobf("mezz.jei:jei-1.19.2-common-api:11.3.0.262")) libs.bundles.externalMods.forge.runtime.get().map { runtimeOnly(fg.deobf(it)) }
"extraModsRuntimeOnly"(fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.262"))
"extraModsCompileOnly"(fg.deobf("maven.modrinth:oculus:1.2.5"))
implementation(project(":core")) implementation(project(":core"))
implementation(commonClasses(project(":forge-api"))) implementation(commonClasses(project(":forge-api")))
@ -233,7 +229,7 @@ tasks.shadowJar {
configurations = listOf(project.configurations["shade"]) configurations = listOf(project.configurations["shade"])
relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt") 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. // TODO: minimize(): Would be good to support once our build scripts are stabilised.
} }
@ -334,10 +330,21 @@ githubRelease {
tasks.publish { dependsOn(tasks.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 { publishing {
publications { publications {
named("maven", MavenPublication::class) { named("maven", MavenPublication::class) {
fg.component(this) 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" options.encoding = "UTF-8"
} }
tasks.jar { tasks.withType(AbstractArchiveTask::class.java).configureEach {
isReproducibleFileOrder = true
isPreserveFileTimestamps = false isPreserveFileTimestamps = false
archiveClassifier.set("slim") isReproducibleFileOrder = true
}
tasks.jar {
manifest { manifest {
attributes( attributes(
"Specification-Title" to "computercraft", "Specification-Title" to "computercraft",

View File

@ -95,7 +95,7 @@ class MinecraftConfigurations private constructor(private val project: Project)
// Configure some tasks to include our additional files. // Configure some tasks to include our additional files.
project.tasks.named("javadoc", Javadoc::class.java) { project.tasks.named("javadoc", Javadoc::class.java) {
source += client.allJava source(client.allJava)
classpath = main.compileClasspath + main.output + client.compileClasspath + client.output 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. // 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" parchment = "2022.10.16"
parchmentMc = "1.19.2" parchmentMc = "1.19.2"
# Normal dependencies
asm = "9.3" asm = "9.3"
autoService = "1.0.1" autoService = "1.0.1"
checkerFramework = "3.12.0" 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" nightConfig = "3.6.5"
slf4j = "1.7.36" slf4j = "1.7.36"
# Minecraft mods
jei = "11.3.0.262"
oculus = "1.2.5"
# Testing # Testing
hamcrest = "2.2" hamcrest = "2.2"
jqwik = "1.7.0" jqwik = "1.7.0"
@ -46,6 +51,7 @@ taskTree = "2.1.0"
vanillaGradle = "0.2.1-SNAPSHOT" vanillaGradle = "0.2.1-SNAPSHOT"
[libraries] [libraries]
# Normal dependencies
asm = { module = "org.ow2.asm:asm", version.ref = "asm" } asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
autoService = { module = "com.google.auto.service:auto-service", version.ref = "autoService" } autoService = { module = "com.google.auto.service:auto-service", version.ref = "autoService" }
checkerFramework = { module = "org.checkerframework:checker-qual", version.ref = "checkerFramework" } 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" } netty-http = { module = "io.netty:netty-codec-http", version.ref = "netty" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } 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 # Testing
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" } hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
jqwik-api = { module = "net.jqwik:jqwik-api", version.ref = "jqwik" } jqwik-api = { module = "net.jqwik:jqwik-api", version.ref = "jqwik" }
@ -97,6 +109,11 @@ taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
[bundles] [bundles]
kotlin = ["kotlin-stdlib", "kotlin-coroutines"] kotlin = ["kotlin-stdlib", "kotlin-coroutines"]
# Minecraft
externalMods-common = ["jei-api"]
externalMods-forge-compile = ["oculus", "jei-api"]
externalMods-forge-runtime = ["jei-forge"]
# Testing # Testing
test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"] test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"]
testRuntime = ["junit-jupiter-engine", "jqwik-engine"] testRuntime = ["junit-jupiter-engine", "jqwik-engine"]

View File

@ -15,4 +15,7 @@ dependencies {
tasks.javadoc { tasks.javadoc {
include("dan200/computercraft/api/**/*.java") 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.checkerFramework)
compileOnlyApi(libs.jetbrainsAnnotations) compileOnlyApi(libs.jetbrainsAnnotations)
"docApi"(project(":")) "docApi"(project(":common-api"))
} }
tasks.javadoc { tasks.javadoc {

View File

@ -34,11 +34,11 @@ import net.minecraft.resources.ResourceLocation;
* // ... * // ...
* } * }
* }</pre> * }</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.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 { public interface GenericSource {
/** /**

View File

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