Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/1.20.2' into permissions-api
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
#	settings.gradle
  • Loading branch information
xpple committed Oct 20, 2023
2 parents b2b538d + 1fbc78f commit be2bb39
Show file tree
Hide file tree
Showing 496 changed files with 12,769 additions and 6,076 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ jobs:
build:
strategy:
matrix:
java: [17-jdk, 20-jdk]
java: [17-ubuntu, 21-ubuntu]
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:${{ matrix.java }}
image: mcr.microsoft.com/openjdk/jdk:${{ matrix.java }}
options: --user root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gradle/wrapper-validation-action@v1
Expand All @@ -28,15 +28,19 @@ 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
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
Expand All @@ -56,7 +60,7 @@ jobs:
server_test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
Expand All @@ -69,7 +73,7 @@ jobs:
check_resources:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
build:
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:20-jdk
image: mcr.microsoft.com/openjdk/jdk:21-ubuntu
options: --user root
steps:
- run: apt update && apt install git -y && git --version
- run: git config --global --add safe.directory /__w/fabric/fabric
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: FabricMC/fabric-action-scripts@v2
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ For support and discussion for both developers and users, visit [the Fabric Disc

## Using Fabric API to play with mods

Make sure you have install fabric loader first. More information about installing Fabric Loader can be found [here](https://fabricmc.net/use/).
Make sure you have installed fabric loader first. More information about installing Fabric Loader can be found [here](https://fabricmc.net/use/).

To use Fabric API, download it from [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api), [GitHub Releases](https://github.com/FabricMC/fabric/releases) or [Modrinth](https://modrinth.com/mod/fabric-api).

The downloaded jar file should be placed in your `mods` folder.

## Using Fabric API to develop mods

To setup a Fabric development environment, check out the [Fabric example mod](https://github.com/FabricMC/fabric-example-mod) and follow the instructions there. The example mod already depends on Fabric API.
To set up a Fabric development environment, check out the [Fabric example mod](https://github.com/FabricMC/fabric-example-mod) and follow the instructions there. The example mod already depends on Fabric API.

To include the full Fabric API with all modules in the development environment, add the following to your `dependencies` block in the gradle buildscript:

Expand Down
160 changes: 64 additions & 96 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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.4.1" 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.3.4"
}

def ENV = System.getenv()
def signingEnabled = ENV.SIGNING_SERVER

version = project.version + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getBranch()
logger.lifecycle("Building Fabric: " + version)
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -203,6 +195,10 @@ allprojects {
}
}

loom.runs.configureEach {
vmArg("-enableassertions")
}

allprojects.each { p ->
if (project.name == "deprecated") {
return
Expand Down Expand Up @@ -231,6 +227,7 @@ allprojects {

testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
testImplementation sourceSets.testmodClient.output
testImplementation 'org.mockito:mockito-core:5.4.0'
}

test {
Expand Down Expand Up @@ -266,18 +263,16 @@ allprojects {

checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = "10.11.0"
toolVersion = "10.12.1"
}

tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

if (signingEnabled) {
remoteSign {
sign remapJar
}
remoteSign {
sign remapJar
}

// Run this task after updating minecraft to regenerate any required resources
Expand Down Expand Up @@ -411,7 +406,7 @@ loom {
}
autoTestServer {
inherit testmodServer
name "Auto Test Server"
name "Auto Test Server"
vmArg "-Dfabric.autoTest"
}
autoTestClient {
Expand Down Expand Up @@ -510,7 +505,8 @@ tasks.register('runProductionAutoTestClient', JavaExec) {

jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.autoTest"
"-Dfabric.autoTest",
"-enableassertions"
)
}
}
Expand Down Expand Up @@ -541,7 +537,8 @@ tasks.register('runProductionAutoTestServer', JavaExec) {

jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.autoTest"
"-Dfabric.autoTest",
"-enableassertions"
)

args("nogui")
Expand Down Expand Up @@ -595,6 +592,10 @@ subprojects {
return
}

base {
archivesName = project.name
}

dependencies {
testmodImplementation sourceSets.main.output

Expand All @@ -619,8 +620,8 @@ subprojects {
pom {
addPomMetadataInformation(project, pom)
}
artifact(signingEnabled ? signRemapJar.output : remapJar) {
builtBy(signingEnabled ? signRemapJar : remapJar)
artifact(signRemapJar.output) {
builtBy(signRemapJar)
}

artifact(remapSourcesJar) {
Expand All @@ -639,8 +640,8 @@ subprojects {
publishing {
publications {
mavenJava(MavenPublication) {
artifact(signingEnabled ? signRemapJar.output : remapJar) {
builtBy(signingEnabled ? signRemapJar : remapJar)
artifact(signRemapJar.output) {
builtBy(signRemapJar)
}

artifact(sourcesJar) {
Expand All @@ -657,7 +658,7 @@ publishing {
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
subprojects.each {
// Dont depend on the deprecated modules in the main artifact.
// The maven BOM containing all of the deprecated modules is added manually below.
if (it.path.startsWith(":deprecated")) {
return
}
Expand All @@ -668,6 +669,13 @@ publishing {
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}

// Depend on the deprecated BOM to allow opting out of deprecated modules.
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", group)
depNode.appendNode("artifactId", "fabric-api-deprecated")
depNode.appendNode("version", version)
depNode.appendNode("scope", "compile")
}
}
}
Expand Down Expand Up @@ -727,77 +735,39 @@ 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
}

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")
}
}
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("CURSEFORGE_API_KEY").getOrNull() == null

options {
forgeGradleIntegration = false
curseforge {
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
projectId = "306612"
minecraftVersions.add(project.curseforge_minecraft_version)
}
}

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

import java.util.stream.Collectors

tasks.register('github') {
dependsOn(signingEnabled ? signRemapJar : remapJar)
onlyIf {
ENV.GITHUB_TOKEN
modrinth {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "P7dR8mSH"
minecraftVersions.add(project.minecraft_version)
}

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");
github {
accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("FabricMC/dryrun")
commitish = providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun")
}
}

modrinth {
projectId = "fabric-api"
versionName = "[$project.minecraft_version] Fabric API $project.version"
versionType = project.prerelease == "true" ? "beta" : "release"
changelog = ENV.CHANGELOG ?: "No changelog provided"
assemble.dependsOn signRemapJar

uploadFile = signingEnabled ? signRemapJar.output : remapJar
}
import java.util.stream.Collectors

// A task to ensure that the version being released has not already been released.
tasks.register('checkVersion') {
Expand All @@ -811,7 +781,5 @@ tasks.register('checkVersion') {
}
}

github.mustRunAfter checkVersion
project.tasks.modrinth.mustRunAfter checkVersion
tasks.publishMods.dependsOn checkVersion
publish.mustRunAfter checkVersion
project.tasks.curseforge.mustRunAfter checkVersion
1 change: 0 additions & 1 deletion deprecated/fabric-command-api-v1/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
archivesBaseName = "fabric-command-api-v1"
version = getSubprojectVersion(project)

moduleDependencies(project, [
Expand Down
1 change: 0 additions & 1 deletion deprecated/fabric-commands-v0/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
archivesBaseName = "fabric-commands-v0"
version = getSubprojectVersion(project)

moduleDependencies(project, [
Expand Down
Loading

0 comments on commit be2bb39

Please sign in to comment.