Update to loom 1.3 and use Mod Publish Plugin (#3158)

* Update to loom 1.3

* Fix more 1.3 deprecations

* Opps

* Move to mod publish plugin

* Revert some changes

* Fix some more Gradle deprecations

* Fix names

* Remove extra stuff

* Cleanup
This commit is contained in:
modmuss 2023-08-02 18:51:21 +01:00 committed by GitHub
parent d9acd820fc
commit f4b7e42468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 62 additions and 150 deletions

View file

@ -14,7 +14,7 @@ jobs:
with:
fetch-depth: 0
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew check build publishToMavenLocal --stacktrace --warning-mode=fail -Porg.gradle.parallel.threads=4
- run: ./gradlew check build publishToMavenLocal publishMods --stacktrace --warning-mode=fail -Porg.gradle.parallel.threads=4
- uses: Juuxel/publish-checkstyle-report@v1
if: ${{ failure() }}
with:
@ -28,10 +28,14 @@ jobs:
with:
name: Artifacts
path: ./*/build/libs/
- uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/publishMods/
- uses: actions/upload-artifact@v3
with:
name: Maven Local
path: /root/.m2/repository
path: /root/.m2/repository/net/fabricmc/
client_test:
runs-on: ubuntu-22.04

View file

@ -22,7 +22,7 @@ jobs:
context: changelog
workflow_id: release.yml
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew checkVersion build publish curseforge github modrinth --stacktrace -Porg.gradle.parallel.threads=4
- run: ./gradlew checkVersion build publish publishMods --stacktrace -Porg.gradle.parallel.threads=4
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}

View file

@ -1,25 +1,17 @@
buildscript {
dependencies {
classpath 'org.kohsuke:github-api:1.135'
}
}
plugins {
id "java-library"
id "eclipse"
id "idea"
id "maven-publish"
id 'jacoco'
id "fabric-loom" version "1.2.7" apply false
id "com.diffplug.spotless" version "6.18.0"
id "fabric-loom" version "1.3.8" apply false
id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "3.1.0"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.4.3"
id "me.modmuss50.remotesign" version "0.4.0" apply false
id "me.modmuss50.mod-publish-plugin" version "0.2.0"
}
def ENV = System.getenv()
def signingEnabled = ENV.SIGNING_SERVER
version = project.version + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getBranch()
logger.lifecycle("Building Fabric: " + version)
@ -123,16 +115,16 @@ allprojects {
enabled = false
}
if (signingEnabled) {
remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
jarAuthKey = ENV.SIGNING_JAR_KEY
remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
jarAuthKey = ENV.SIGNING_JAR_KEY
afterEvaluate {
// PGP sign all maven publications.
sign publishing.publications.mavenJava
}
useDummyForTesting = ENV.SIGNING_SERVER == null
afterEvaluate {
// PGP sign all maven publications.
sign publishing.publications.mavenJava
}
}
@ -266,7 +258,7 @@ allprojects {
checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = "10.11.0"
toolVersion = "10.12.1"
}
tasks.withType(AbstractArchiveTask).configureEach {
@ -274,10 +266,8 @@ allprojects {
reproducibleFileOrder = true
}
if (signingEnabled) {
remoteSign {
sign remapJar
}
remoteSign {
sign remapJar
}
// Run this task after updating minecraft to regenerate any required resources
@ -411,7 +401,7 @@ loom {
}
autoTestServer {
inherit testmodServer
name "Auto Test Server"
name "Auto Test Server"
vmArg "-Dfabric.autoTest"
}
autoTestClient {
@ -595,6 +585,10 @@ subprojects {
return
}
base {
archivesName = project.name
}
dependencies {
testmodImplementation sourceSets.main.output
@ -619,8 +613,8 @@ subprojects {
pom {
addPomMetadataInformation(project, pom)
}
artifact(signingEnabled ? signRemapJar.output : remapJar) {
builtBy(signingEnabled ? signRemapJar : remapJar)
artifact(signRemapJar.output) {
builtBy(signRemapJar)
}
artifact(remapSourcesJar) {
@ -639,8 +633,8 @@ subprojects {
publishing {
publications {
mavenJava(MavenPublication) {
artifact(signingEnabled ? signRemapJar.output : remapJar) {
builtBy(signingEnabled ? signRemapJar : remapJar)
artifact(signRemapJar.output) {
builtBy(signRemapJar)
}
artifact(sourcesJar) {
@ -727,78 +721,40 @@ remapJar {
}
// Include the signed or none signed jar from the sub project.
nestedJars.from project("${it.path}").tasks.getByName(signingEnabled ? "signRemapJar" : "remapJar")
nestedJars.from project("${it.path}").tasks.getByName("signRemapJar")
}
}
}
curseforge {
if (ENV.CURSEFORGE_API_KEY) {
apiKey = ENV.CURSEFORGE_API_KEY
publishMods {
file = signRemapJar.output
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
type = project.prerelease == "true" ? BETA : STABLE
displayName = "[${project.minecraft_version}] Fabric API $project.version"
modLoaders.add("fabric")
dryRun = providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null
curseforge {
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
projectId = "306612"
minecraftVersions.add(project.curseforge_minecraft_version)
}
project {
id = "306612"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = project.prerelease == "true" ? "beta" : "release"
addGameVersion "1.20.1"
addGameVersion "Fabric"
mainArtifact(signingEnabled ? signRemapJar.output : remapJar) {
displayName = "[$project.minecraft_version] Fabric API $project.version"
}
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
modrinth {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "P7dR8mSH"
minecraftVersions.add(project.minecraft_version)
}
options {
forgeGradleIntegration = false
github {
accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("FabricMC/dryrun")
commitish = providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun")
}
}
if (signingEnabled) {
project.tasks.curseforge.dependsOn signRemapJar
project.tasks.modrinth.dependsOn signRemapJar
build.dependsOn signRemapJar
}
import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GitHub
assemble.dependsOn signRemapJar
import java.util.stream.Collectors
tasks.register('github') {
dependsOn(signingEnabled ? signRemapJar : remapJar)
onlyIf {
ENV.GITHUB_TOKEN
}
doLast {
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
def repository = github.getRepository(ENV.GITHUB_REPOSITORY)
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
releaseBuilder.name("[$project.minecraft_version] Fabric API $project.version")
releaseBuilder.body(ENV.CHANGELOG ?: "No changelog provided")
releaseBuilder.commitish(getBranch())
releaseBuilder.prerelease(project.prerelease == "true")
def ghRelease = releaseBuilder.create()
ghRelease.uploadAsset(signingEnabled ? signRemapJar.output.get().getAsFile() : remapJar.archiveFile.get().getAsFile(), "application/java-archive");
}
}
modrinth {
projectId = "fabric-api"
versionName = "[$project.minecraft_version] Fabric API $project.version"
versionType = project.prerelease == "true" ? "beta" : "release"
changelog = ENV.CHANGELOG ?: "No changelog provided"
uploadFile = signingEnabled ? signRemapJar.output : remapJar
}
// A task to ensure that the version being released has not already been released.
tasks.register('checkVersion') {
doFirst {
@ -811,7 +767,5 @@ tasks.register('checkVersion') {
}
}
github.mustRunAfter checkVersion
project.tasks.modrinth.mustRunAfter checkVersion
tasks.publishMods.dependsOn checkVersion
publish.mustRunAfter checkVersion
project.tasks.curseforge.mustRunAfter checkVersion

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-command-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-commands-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-containers-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-events-lifecycle-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-keybindings-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-loot-tables-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-models-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-networking-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-renderer-registries-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-rendering-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-api-base"
version = getSubprojectVersion(project)
testDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-api-lookup-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-biome-api-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,2 +1 @@
archivesBaseName = "fabric-block-api-v1"
version = getSubprojectVersion(project)

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-blockrenderlayer-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-client-tags-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-command-api-v2"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-content-registries-v0"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-convention-tags-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,2 +1 @@
archivesBaseName = "fabric-crash-report-info-v1"
version = getSubprojectVersion(project)

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-data-generation-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [
@ -54,7 +53,7 @@ loom {
test.dependsOn runDatagen
task datapackZip(type: Zip, dependsOn: runDatagen) {
archiveFileName = "${archivesBaseName}-${project.version}-test-datapack.zip"
archiveFileName = "${base.archivesName.get()}-${project.version}-test-datapack.zip"
destinationDirectory = layout.buildDirectory.dir('libs')
from file("src/testmod/generated")

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-dimensions-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-entity-events-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-events-interaction-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-game-rule-api-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-gametest-api-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-item-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-item-group-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-key-binding-api-v1"
version = getSubprojectVersion(project)
testDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-lifecycle-events-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-loot-api-v2"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-message-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-mining-level-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-model-loading-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-networking-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-object-builder-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-particles-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-recipe-api-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-registry-sync-v0"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-renderer-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-renderer-indigo"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-rendering-data-attachment-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-rendering-fluids-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-rendering-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-resource-conditions-api-v1"
version = getSubprojectVersion(project)
testDependencies(project, [':fabric-gametest-api-v1'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-resource-loader-v0"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-screen-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base'])

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-screen-handler-api-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-sound-api-v1"
version = getSubprojectVersion(project)
testDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-transfer-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [

View file

@ -1,4 +1,3 @@
archivesBaseName = "fabric-transitive-access-wideners-v1"
version = getSubprojectVersion(project)
loom {

View file

@ -9,6 +9,7 @@ loader_version=0.14.21
installer_version=0.11.1
prerelease=false
curseforge_minecraft_version=1.20.1
# Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.30

Binary file not shown.

View file

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

5
gradlew vendored
View file

@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.