mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-27 10:05:35 -05:00
Setup unit tests & format gradle files. (#3073)
This commit is contained in:
parent
8cec7577f3
commit
b3afc78b68
54 changed files with 247 additions and 215 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -5,7 +5,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
java: [17-jdk, 20-jdk]
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: eclipse-temurin:${{ matrix.java }}
|
||||
options: --user root
|
||||
|
|
2
.github/workflows/manage_issues.yml
vendored
2
.github/workflows/manage_issues.yml
vendored
|
@ -6,7 +6,7 @@ on:
|
|||
|
||||
jobs:
|
||||
labels:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: FabricMC/fabric-action-scripts@v2
|
||||
with:
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -6,7 +6,7 @@ permissions:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: eclipse-temurin:20-jdk
|
||||
options: --user root
|
||||
|
|
163
build.gradle
163
build.gradle
|
@ -10,7 +10,7 @@ plugins {
|
|||
id "idea"
|
||||
id "maven-publish"
|
||||
id 'jacoco'
|
||||
id "fabric-loom" version "1.2.5" apply false
|
||||
id "fabric-loom" version "1.2.7" apply false
|
||||
id "com.diffplug.spotless" version "6.18.0"
|
||||
id "org.ajoberstar.grgit" version "3.1.0"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
|
@ -25,6 +25,7 @@ version = project.version + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getB
|
|||
logger.lifecycle("Building Fabric: " + version)
|
||||
|
||||
|
||||
import net.fabricmc.loom.util.gradle.SourceSetHelper
|
||||
import groovy.json.JsonSlurper
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
|
||||
|
@ -139,7 +140,9 @@ allprojects {
|
|||
setupRepositories(repositories)
|
||||
}
|
||||
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
apply plugin: "java-library"
|
||||
apply plugin: "checkstyle"
|
||||
|
@ -174,6 +177,11 @@ allprojects {
|
|||
compileClasspath += testmod.compileClasspath
|
||||
runtimeClasspath += testmod.runtimeClasspath
|
||||
}
|
||||
|
||||
test {
|
||||
compileClasspath += testmodClient.compileClasspath
|
||||
runtimeClasspath += testmodClient.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
|
@ -196,7 +204,9 @@ allprojects {
|
|||
}
|
||||
|
||||
allprojects.each { p ->
|
||||
if (project.name == "deprecated") return
|
||||
if (project.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
loom.mods.register(p.name) {
|
||||
sourceSet p.sourceSets.main
|
||||
|
@ -218,6 +228,26 @@ allprojects {
|
|||
testmodClientImplementation sourceSets.main.output
|
||||
testmodClientImplementation sourceSets.client.output
|
||||
testmodClientImplementation sourceSets.testmod.output
|
||||
|
||||
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
|
||||
testImplementation sourceSets.testmodClient.output
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
||||
afterEvaluate {
|
||||
// See: https://github.com/FabricMC/fabric-loader/pull/585
|
||||
def classPathGroups = loom.mods.stream()
|
||||
.map { modSettings ->
|
||||
SourceSetHelper.getClasspath(modSettings, getProject()).stream()
|
||||
.map(File.&getAbsolutePath)
|
||||
.collect(Collectors.joining(File.pathSeparator))
|
||||
}
|
||||
.collect(Collectors.joining(File.pathSeparator+File.pathSeparator))
|
||||
|
||||
systemProperty("fabric.classPathGroups", classPathGroups)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
|
@ -236,10 +266,10 @@ allprojects {
|
|||
|
||||
checkstyle {
|
||||
configFile = rootProject.file("checkstyle.xml")
|
||||
toolVersion = "10.9.3"
|
||||
toolVersion = "10.11.0"
|
||||
}
|
||||
|
||||
tasks.withType(AbstractArchiveTask) {
|
||||
tasks.withType(AbstractArchiveTask).configureEach {
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
@ -251,11 +281,11 @@ allprojects {
|
|||
}
|
||||
|
||||
// Run this task after updating minecraft to regenerate any required resources
|
||||
task generateResources {
|
||||
tasks.register('generateResources') {
|
||||
group = "fabric"
|
||||
}
|
||||
|
||||
task testmodJar(type: Jar) {
|
||||
tasks.register('testmodJar', Jar) {
|
||||
from sourceSets.testmod.output
|
||||
from sourceSets.testmodClient.output
|
||||
destinationDirectory = new File(project.buildDir, "devlibs")
|
||||
|
@ -278,7 +308,8 @@ allprojects {
|
|||
}
|
||||
}
|
||||
|
||||
task remapTestmodJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: testmodJar) {
|
||||
tasks.register('remapTestmodJar', net.fabricmc.loom.task.RemapJarTask) {
|
||||
dependsOn testmodJar
|
||||
input = testmodJar.archiveFile
|
||||
archiveClassifier = "testmod"
|
||||
addNestedDependencies = false
|
||||
|
@ -287,7 +318,7 @@ allprojects {
|
|||
}
|
||||
build.dependsOn remapTestmodJar
|
||||
|
||||
task validateMixinNames(type: net.fabricmc.loom.task.ValidateMixinNameTask) {
|
||||
tasks.register('validateMixinNames', net.fabricmc.loom.task.ValidateMixinNameTask) {
|
||||
source(sourceSets.main.output)
|
||||
source(sourceSets.client.output)
|
||||
source(sourceSets.testmod.output)
|
||||
|
@ -302,7 +333,9 @@ remapTestmodJar {
|
|||
def testModJarTasks = []
|
||||
|
||||
subprojects {
|
||||
if (it.name == "deprecated" || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) return
|
||||
if (it.name == "deprecated" || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
|
||||
return
|
||||
}
|
||||
|
||||
testModJarTasks += it.tasks.remapTestmodJar
|
||||
}
|
||||
|
@ -330,7 +363,7 @@ javadoc {
|
|||
memberLevel = JavadocMemberLevel.PACKAGE
|
||||
links(
|
||||
"https://maven.fabricmc.net/docs/yarn-${rootProject.minecraft_version}${project.yarn_version}/"
|
||||
)
|
||||
)
|
||||
// Disable the crazy super-strict doclint tool in Java 8
|
||||
addStringOption("Xdoclint:none", "-quiet")
|
||||
|
||||
|
@ -338,11 +371,13 @@ javadoc {
|
|||
'apiNote:a:API Note:',
|
||||
'implSpec:a:Implementation Requirements:',
|
||||
'implNote:a:Implementation Note:'
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
allprojects.each {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
source(it.sourceSets.main.allJava)
|
||||
source(it.sourceSets.client.allJava)
|
||||
|
@ -353,7 +388,7 @@ javadoc {
|
|||
failOnError true
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
tasks.register('javadocJar', Jar) {
|
||||
dependsOn javadoc
|
||||
from javadoc.destinationDir
|
||||
//Set as `fatjavadoc` to prevent an ide form trying to use this javadoc, over using the modules javadoc
|
||||
|
@ -401,7 +436,10 @@ loom {
|
|||
}
|
||||
test.dependsOn runGametest
|
||||
|
||||
def coverageTasks = [runGametestCoverage, runAutoTestClientCoverage]
|
||||
def coverageTasks = [
|
||||
runGametestCoverage,
|
||||
runAutoTestClientCoverage
|
||||
]
|
||||
|
||||
jacoco {
|
||||
coverageTasks.forEach {
|
||||
|
@ -409,23 +447,24 @@ jacoco {
|
|||
}
|
||||
}
|
||||
|
||||
task coverage(type: JacocoReport, dependsOn: coverageTasks) {
|
||||
tasks.register('coverage', JacocoReport) {
|
||||
dependsOn coverageTasks
|
||||
coverageTasks.forEach {
|
||||
executionData it
|
||||
}
|
||||
|
||||
// Add all source as input
|
||||
allprojects { p ->
|
||||
if (p.path.startsWith(":deprecated")) return
|
||||
if (p.path.startsWith(":deprecated")) {
|
||||
return
|
||||
}
|
||||
sourceSets p.sourceSets.main, p.sourceSets.client, p.sourceSets.testmod, p.sourceSets.testmodClient
|
||||
}
|
||||
|
||||
// Exclude mixins
|
||||
afterEvaluate {
|
||||
classDirectories.setFrom(files(classDirectories.files.collect {
|
||||
fileTree(dir: it, exclude: '**/mixin/**')
|
||||
}))
|
||||
}
|
||||
classDirectories.setFrom(files(classDirectories.files.collect {
|
||||
fileTree(dir: it, exclude: '**/mixin/**')
|
||||
}))
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
@ -447,39 +486,36 @@ dependencies {
|
|||
import net.fabricmc.loom.util.Platform
|
||||
|
||||
// This is very far beyond loom's API if you copy this, you're on your own.
|
||||
task runProductionAutoTestClient(type: JavaExec, dependsOn: [remapJar, remapTestmodJar]) {
|
||||
tasks.register('runProductionAutoTestClient', JavaExec) {
|
||||
dependsOn remapJar, remapTestmodJar, downloadAssets
|
||||
classpath.from configurations.productionRuntime
|
||||
mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient"
|
||||
workingDir = file("run")
|
||||
|
||||
afterEvaluate {
|
||||
dependsOn downloadAssets
|
||||
}
|
||||
|
||||
doFirst {
|
||||
classpath.from loom.minecraftProvider.minecraftClientJar
|
||||
workingDir.mkdirs()
|
||||
|
||||
args(
|
||||
"--assetIndex", loom.minecraftProvider.versionInfo.assetIndex().fabricId(loom.minecraftProvider.minecraftVersion()),
|
||||
"--assetsDir", new File(loom.files.userCache, "assets").absolutePath,
|
||||
"--gameDir", workingDir.absolutePath
|
||||
)
|
||||
"--assetIndex", loom.minecraftProvider.versionInfo.assetIndex().fabricId(loom.minecraftProvider.minecraftVersion()),
|
||||
"--assetsDir", new File(loom.files.userCache, "assets").absolutePath,
|
||||
"--gameDir", workingDir.absolutePath
|
||||
)
|
||||
|
||||
if (Platform.CURRENT.operatingSystem.isMacOS()) {
|
||||
jvmArgs(
|
||||
"-XstartOnFirstThread"
|
||||
)
|
||||
"-XstartOnFirstThread"
|
||||
)
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
||||
"-Dfabric.autoTest"
|
||||
)
|
||||
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
||||
"-Dfabric.autoTest"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
task serverPropertiesJar(type: Jar) {
|
||||
tasks.register('serverPropertiesJar', Jar) {
|
||||
def propsFile = file("build/tmp/install.properties")
|
||||
|
||||
doFirst {
|
||||
|
@ -494,7 +530,8 @@ task serverPropertiesJar(type: Jar) {
|
|||
from(propsFile)
|
||||
}
|
||||
|
||||
task runProductionAutoTestServer(type: JavaExec, dependsOn: [remapJar, remapTestmodJar, serverPropertiesJar]) {
|
||||
tasks.register('runProductionAutoTestServer', JavaExec) {
|
||||
dependsOn remapJar, remapTestmodJar, serverPropertiesJar
|
||||
classpath.from configurations.productionRuntimeServer, serverPropertiesJar
|
||||
mainClass = "net.fabricmc.installer.ServerLauncher"
|
||||
workingDir = file("run")
|
||||
|
@ -503,18 +540,29 @@ task runProductionAutoTestServer(type: JavaExec, dependsOn: [remapJar, remapTest
|
|||
workingDir.mkdirs()
|
||||
|
||||
jvmArgs(
|
||||
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
||||
"-Dfabric.autoTest"
|
||||
)
|
||||
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
|
||||
"-Dfabric.autoTest"
|
||||
)
|
||||
|
||||
args("nogui")
|
||||
}
|
||||
}
|
||||
|
||||
// Format all the gradle files
|
||||
spotless {
|
||||
groovyGradle {
|
||||
target 'src/**/*.gradle', '*.gradle', 'gradle/*.gradle'
|
||||
greclipse()
|
||||
}
|
||||
}
|
||||
|
||||
def addPomMetadataInformation(Project project, MavenPom pom) {
|
||||
def modJsonFile = project.file("src/main/resources/fabric.mod.json")
|
||||
if (!modJsonFile.exists())
|
||||
|
||||
if (!modJsonFile.exists()) {
|
||||
modJsonFile = project.file("src/client/resources/fabric.mod.json")
|
||||
}
|
||||
|
||||
def modJson = new JsonSlurper().parse(modJsonFile)
|
||||
pom.name = modJson.name
|
||||
pom.url = "https://github.com/FabricMC/fabric/tree/HEAD/${project.rootDir.relativePath(project.projectDir)}"
|
||||
|
@ -543,7 +591,9 @@ def addPomMetadataInformation(Project project, MavenPom pom) {
|
|||
}
|
||||
|
||||
subprojects {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testmodImplementation sourceSets.main.output
|
||||
|
@ -608,7 +658,9 @@ publishing {
|
|||
def depsNode = asNode().appendNode("dependencies")
|
||||
subprojects.each {
|
||||
// Dont depend on the deprecated modules in the main artifact.
|
||||
if (it.path.startsWith(":deprecated")) return
|
||||
if (it.path.startsWith(":deprecated")) {
|
||||
return
|
||||
}
|
||||
|
||||
def depNode = depsNode.appendNode("dependency")
|
||||
depNode.appendNode("groupId", it.group)
|
||||
|
@ -641,20 +693,22 @@ void setupRepositories(RepositoryHandler repositories) {
|
|||
}
|
||||
|
||||
subprojects.each {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
remapJar.dependsOn("${it.path}:remapJar")
|
||||
}
|
||||
|
||||
// These modules are not included in the fat jar, maven will resolve them via the pom.
|
||||
def devOnlyModules = [
|
||||
"fabric-gametest-api-v1",
|
||||
]
|
||||
def devOnlyModules = ["fabric-gametest-api-v1",]
|
||||
|
||||
dependencies {
|
||||
afterEvaluate {
|
||||
subprojects.each {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
api project(path: "${it.path}", configuration: "namedElements")
|
||||
clientImplementation project("${it.path}:").sourceSets.client.output
|
||||
|
@ -668,7 +722,9 @@ dependencies {
|
|||
remapJar {
|
||||
afterEvaluate {
|
||||
subprojects.each {
|
||||
if (it.name in devOnlyModules || it.name == "deprecated") return
|
||||
if (it.name in devOnlyModules || it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
// Include the signed or none signed jar from the sub project.
|
||||
nestedJars.from project("${it.path}").tasks.getByName(signingEnabled ? "signRemapJar" : "remapJar")
|
||||
|
@ -711,7 +767,10 @@ if (signingEnabled) {
|
|||
import org.kohsuke.github.GHReleaseBuilder
|
||||
import org.kohsuke.github.GitHub
|
||||
|
||||
task github(dependsOn: (signingEnabled ? signRemapJar : remapJar)) {
|
||||
import java.util.stream.Collectors
|
||||
|
||||
tasks.register('github') {
|
||||
dependsOn(signingEnabled ? signRemapJar : remapJar)
|
||||
onlyIf {
|
||||
ENV.GITHUB_TOKEN
|
||||
}
|
||||
|
@ -741,7 +800,7 @@ modrinth {
|
|||
}
|
||||
|
||||
// A task to ensure that the version being released has not already been released.
|
||||
task checkVersion {
|
||||
tasks.register('checkVersion') {
|
||||
doFirst {
|
||||
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml").text
|
||||
def metadata = new XmlSlurper().parseText(xml)
|
||||
|
|
|
@ -13,10 +13,10 @@ publishing {
|
|||
allprojects.each {
|
||||
if (it.name == "deprecated") return // Dont depend on yourself :)
|
||||
|
||||
// Depend on all of the deprecated projects
|
||||
if (!it.path.startsWith(":deprecated")) return
|
||||
// Depend on all of the deprecated projects
|
||||
if (!it.path.startsWith(":deprecated")) return
|
||||
|
||||
def depNode = depsNode.appendNode("dependency")
|
||||
def depNode = depsNode.appendNode("dependency")
|
||||
depNode.appendNode("groupId", it.group)
|
||||
depNode.appendNode("artifactId", it.name)
|
||||
depNode.appendNode("version", it.version)
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-command-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-command-api-v2'
|
||||
'fabric-api-base',
|
||||
'fabric-command-api-v2'
|
||||
])
|
||||
|
|
|
@ -2,8 +2,8 @@ archivesBaseName = "fabric-commands-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-command-api-v2'
|
||||
'fabric-api-base',
|
||||
'fabric-command-api-v2'
|
||||
])
|
||||
|
||||
loom {
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-containers-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
])
|
||||
|
|
|
@ -2,7 +2,7 @@ archivesBaseName = "fabric-events-lifecycle-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-item-api-v1',
|
||||
'fabric-lifecycle-events-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-item-api-v1',
|
||||
'fabric-lifecycle-events-v1'
|
||||
])
|
||||
|
|
|
@ -2,5 +2,5 @@ archivesBaseName = "fabric-keybindings-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-key-binding-api-v1'
|
||||
'fabric-key-binding-api-v1'
|
||||
])
|
||||
|
|
|
@ -2,8 +2,8 @@ archivesBaseName = "fabric-loot-tables-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-loot-api-v2'
|
||||
'fabric-api-base',
|
||||
'fabric-loot-api-v2'
|
||||
])
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-networking-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
])
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-renderer-registries-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-rendering-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-rendering-v1'
|
||||
])
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-rendering-v0"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-rendering-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-rendering-v1'
|
||||
])
|
||||
|
|
|
@ -2,7 +2,7 @@ archivesBaseName = "fabric-biome-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/fabric-biome-api-v1.accesswidener")
|
||||
accessWidenerPath = file("src/main/resources/fabric-biome-api-v1.accesswidener")
|
||||
}
|
||||
|
||||
testDependencies(project, [
|
||||
|
@ -16,7 +16,7 @@ sourceSets {
|
|||
testmod {
|
||||
resources {
|
||||
srcDirs += [
|
||||
'src/testmod/generated'
|
||||
'src/testmod/generated'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
archivesBaseName = "fabric-blockrenderlayer-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
archivesBaseName = "fabric-client-tags-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-convention-tags-v1',
|
||||
':fabric-lifecycle-events-v1',
|
||||
':fabric-convention-tags-v1',
|
||||
':fabric-lifecycle-events-v1',
|
||||
])
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
archivesBaseName = "fabric-command-api-v2"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-lifecycle-events-v1',
|
||||
':fabric-lifecycle-events-v1',
|
||||
])
|
||||
|
||||
loom {
|
||||
|
|
|
@ -6,7 +6,7 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-lifecycle-events-v1',
|
||||
'fabric-resource-loader-v0'
|
||||
'fabric-api-base',
|
||||
'fabric-lifecycle-events-v1',
|
||||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
archivesBaseName = "fabric-convention-tags-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-lifecycle-events-v1',
|
||||
':fabric-lifecycle-events-v1',
|
||||
])
|
||||
|
||||
sourceSets {
|
||||
|
|
|
@ -2,12 +2,12 @@ archivesBaseName = "fabric-data-generation-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-registry-sync-v0',
|
||||
'fabric-networking-api-v1',
|
||||
'fabric-resource-conditions-api-v1',
|
||||
'fabric-item-group-api-v1',
|
||||
'fabric-recipe-api-v1',
|
||||
'fabric-api-base',
|
||||
'fabric-registry-sync-v0',
|
||||
'fabric-networking-api-v1',
|
||||
'fabric-resource-conditions-api-v1',
|
||||
'fabric-item-group-api-v1',
|
||||
'fabric-recipe-api-v1',
|
||||
])
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
archivesBaseName = "fabric-dimensions-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-command-api-v2',
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
archivesBaseName = "fabric-entity-events-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-command-api-v2',
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
archivesBaseName = "fabric-events-interaction-v0"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
|
|
@ -6,6 +6,6 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
archivesBaseName = "fabric-item-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-content-registries-v0',
|
||||
':fabric-content-registries-v0',
|
||||
])
|
||||
|
|
|
@ -2,8 +2,8 @@ archivesBaseName = "fabric-item-group-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
||||
loom {
|
||||
|
|
|
@ -5,6 +5,4 @@ loom {
|
|||
accessWidenerPath = file("src/main/resources/fabric-lifecycle-events-v1.accesswidener")
|
||||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
|
|
@ -2,6 +2,6 @@ archivesBaseName = "fabric-loot-api-v2"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
'fabric-api-base',
|
||||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
archivesBaseName = "fabric-message-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
'fabric-command-api-v2'
|
||||
])
|
||||
testDependencies(project, ['fabric-command-api-v2'])
|
||||
|
|
|
@ -2,11 +2,11 @@ archivesBaseName = "fabric-mining-level-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-lifecycle-events-v1',
|
||||
'fabric-resource-loader-v0'
|
||||
'fabric-api-base',
|
||||
'fabric-lifecycle-events-v1',
|
||||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-lifecycle-events-v1'
|
||||
':fabric-lifecycle-events-v1'
|
||||
])
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
archivesBaseName = "fabric-models-v0"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-rendering-v1',
|
||||
':fabric-resource-loader-v0'
|
||||
':fabric-rendering-v1',
|
||||
':fabric-resource-loader-v0'
|
||||
])
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
archivesBaseName = "fabric-networking-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-command-api-v2',
|
||||
|
|
|
@ -6,9 +6,7 @@ moduleDependencies(project, [
|
|||
'fabric-resource-loader-v0'
|
||||
])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-command-api-v2'
|
||||
])
|
||||
testDependencies(project, [':fabric-command-api-v2'])
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/fabric-object-builder-api-v1.accesswidener")
|
||||
|
|
|
@ -5,9 +5,7 @@ loom {
|
|||
accessWidenerPath = file("src/main/resources/fabric-particles-v1.accesswidener")
|
||||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
validateMixinNames {
|
||||
// Loom needs to handle inner mixins better
|
||||
|
|
|
@ -6,5 +6,5 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
"fabric-networking-api-v1",
|
||||
"fabric-networking-api-v1",
|
||||
])
|
||||
|
|
|
@ -6,11 +6,11 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-lifecycle-events-v1',
|
||||
':fabric-command-api-v2',
|
||||
':fabric-lifecycle-events-v1',
|
||||
':fabric-command-api-v2',
|
||||
])
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
archivesBaseName = "fabric-renderer-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-block-api-v1',
|
||||
|
|
|
@ -6,6 +6,6 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-renderer-api-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-renderer-api-v1'
|
||||
])
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
archivesBaseName = "fabric-rendering-data-attachment-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/fabric-rendering-data-attachment-v1.accesswidener")
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
archivesBaseName = "fabric-rendering-fluids-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
archivesBaseName = "fabric-rendering-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-object-builder-api-v1'
|
||||
':fabric-object-builder-api-v1'
|
||||
])
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
archivesBaseName = "fabric-resource-conditions-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-gametest-api-v1'
|
||||
])
|
||||
testDependencies(project, [':fabric-gametest-api-v1'])
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
archivesBaseName = "fabric-screen-api-v1"
|
||||
version = getSubprojectVersion(project)
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base'
|
||||
])
|
||||
moduleDependencies(project, ['fabric-api-base'])
|
||||
|
|
|
@ -6,8 +6,8 @@ loom {
|
|||
}
|
||||
|
||||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
'fabric-api-base',
|
||||
'fabric-networking-api-v1'
|
||||
])
|
||||
|
||||
testDependencies(project, [
|
||||
|
|
|
@ -2,7 +2,7 @@ archivesBaseName = "fabric-sound-api-v1"
|
|||
version = getSubprojectVersion(project)
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-api-base',
|
||||
':fabric-resource-loader-v0',
|
||||
':fabric-command-api-v2'
|
||||
':fabric-api-base',
|
||||
':fabric-resource-loader-v0',
|
||||
':fabric-command-api-v2'
|
||||
])
|
||||
|
|
|
@ -4,7 +4,8 @@ version = getSubprojectVersion(project)
|
|||
moduleDependencies(project, [
|
||||
'fabric-api-base',
|
||||
'fabric-api-lookup-api-v1',
|
||||
'fabric-lifecycle-events-v1', // transitive dependency of API Lookup
|
||||
'fabric-lifecycle-events-v1',
|
||||
// transitive dependency of API Lookup
|
||||
'fabric-rendering-fluids-v1',
|
||||
])
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ loom {
|
|||
}
|
||||
|
||||
testDependencies(project, [
|
||||
':fabric-rendering-v1',
|
||||
':fabric-object-builder-api-v1'
|
||||
':fabric-rendering-v1',
|
||||
':fabric-object-builder-api-v1'
|
||||
])
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ task generateAccessWidener {
|
|||
|
||||
Path commonJar = loom.namedMinecraftProvider.parentMinecraftProvider.commonJar.path
|
||||
|
||||
try (def fs = FileSystems.newFileSystem(URI.create("jar:${commonJar.toUri()}"), [create: false])) {
|
||||
FileSystems.newFileSystem(URI.create("jar:${commonJar.toUri()}"), [create: false]).withCloseable { fs ->
|
||||
generateBlockConstructors(lines, fs)
|
||||
lines.add("")
|
||||
generateItemConstructors(lines, fs)
|
||||
|
@ -43,7 +43,7 @@ task generateAccessWidener {
|
|||
|
||||
Path clientJar = loom.namedMinecraftProvider.parentMinecraftProvider.clientOnlyJar.path
|
||||
|
||||
try (def fs = FileSystems.newFileSystem(URI.create("jar:${clientJar.toUri()}"), [create: false])) {
|
||||
FileSystems.newFileSystem(URI.create("jar:${clientJar.toUri()}"), [create: false]).withCloseable { fs ->
|
||||
generateRenderPhaseFields(lines, fs)
|
||||
}
|
||||
|
||||
|
@ -56,27 +56,27 @@ task generateAccessWidener {
|
|||
def generateBlockConstructors(List<String> lines, FileSystem fs) {
|
||||
lines.add("# Constructors of non-abstract block classes")
|
||||
Files.list(fs.getPath("net/minecraft/block"))
|
||||
.filter { Files.isRegularFile(it) && it.toString().endsWith(".class") }
|
||||
.map { loadClass(it) }
|
||||
.sorted(Comparator.comparing { it.name })
|
||||
.filter { (it.access & Opcodes.ACC_ABSTRACT) == 0 }
|
||||
.forEach { node ->
|
||||
for (def method : node.methods) {
|
||||
// Checklist for finding block constructors as of 1.19.3:
|
||||
// - class directly in net.minecraft.block (excluding subpackages)
|
||||
// - method name == <init> (by definition)
|
||||
// - contains an AbstractBlock$Settings parameter
|
||||
// - only taking into account non-abstract classes and non-public constructors
|
||||
.filter { Files.isRegularFile(it) && it.toString().endsWith(".class") }
|
||||
.map { loadClass(it) }
|
||||
.sorted(Comparator.comparing { it.name })
|
||||
.filter { (it.access & Opcodes.ACC_ABSTRACT) == 0 }
|
||||
.forEach { node ->
|
||||
for (def method : node.methods) {
|
||||
// Checklist for finding block constructors as of 1.19.3:
|
||||
// - class directly in net.minecraft.block (excluding subpackages)
|
||||
// - method name == <init> (by definition)
|
||||
// - contains an AbstractBlock$Settings parameter
|
||||
// - only taking into account non-abstract classes and non-public constructors
|
||||
|
||||
// Block constructor...
|
||||
if (method.name == "<init>" && Type.getArgumentTypes(method.desc).any { it.internalName == 'net/minecraft/block/AbstractBlock$Settings' }) {
|
||||
// ...and non-public
|
||||
if ((method.access & Opcodes.ACC_PUBLIC) == 0) {
|
||||
lines.add("transitive-accessible method $node.name <init> $method.desc")
|
||||
// Block constructor...
|
||||
if (method.name == "<init>" && Type.getArgumentTypes(method.desc).any { it.internalName == 'net/minecraft/block/AbstractBlock$Settings' }) {
|
||||
// ...and non-public
|
||||
if ((method.access & Opcodes.ACC_PUBLIC) == 0) {
|
||||
lines.add("transitive-accessible method $node.name <init> $method.desc")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def generateItemConstructors(List<String> lines, FileSystem fs) {
|
||||
|
@ -119,7 +119,7 @@ def generateRenderPhaseFields(List<String> lines, FileSystem fs) {
|
|||
ClassNode loadClass(Path path) {
|
||||
def node = new ClassNode()
|
||||
|
||||
try (def is = Files.newInputStream(path)) {
|
||||
Files.newInputStream(path).withCloseable { is ->
|
||||
new ClassReader(is).accept(node, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ def validateAccessWidener(List<String> lines) {
|
|||
for (int i = 0; i < lines.size(); i++) {
|
||||
String line = lines.get(i)
|
||||
if (line.isBlank() || line.startsWith("#") || line.startsWith("transitive-") || line.startsWith("accessWidener")) continue
|
||||
exceptions.add(String.valueOf(i + 1))
|
||||
exceptions.add(String.valueOf(i + 1))
|
||||
}
|
||||
|
||||
if (exceptions.size() > 0) {
|
||||
|
|
|
@ -5,7 +5,7 @@ fabric.loom.multiProjectOptimisation=true
|
|||
version=0.82.1
|
||||
minecraft_version=1.20-pre7
|
||||
yarn_version=+build.1
|
||||
loader_version=0.14.19
|
||||
loader_version=0.14.21
|
||||
installer_version=0.11.1
|
||||
|
||||
prerelease=true
|
||||
|
|
|
@ -8,7 +8,9 @@ import groovy.json.JsonSlurper
|
|||
*/
|
||||
|
||||
subprojects {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
// Create the task
|
||||
task validateModules(type: ValidateModuleTask)
|
||||
|
@ -42,7 +44,7 @@ class ValidateModuleTask extends DefaultTask {
|
|||
clientOnlyMod = true
|
||||
}
|
||||
|
||||
def json = new JsonSlurper().parse(file) as Map<String, Map<String, String>>
|
||||
def json = new JsonSlurper().parse(file)
|
||||
|
||||
if (json.custom == null) {
|
||||
throw new GradleException("Module ${project} does not have a custom value containing module lifecycle!")
|
||||
|
|
|
@ -30,7 +30,9 @@ class BumpVersionTask extends DefaultTask {
|
|||
// Bump all versions. To be used when buildscript changes are made.
|
||||
if (input == "allPatch") {
|
||||
project.getChildProjects().values().forEach {
|
||||
if (it.name == "deprecated") return
|
||||
if (it.name == "deprecated") {
|
||||
return
|
||||
}
|
||||
|
||||
toUpdate.put(it, 2)
|
||||
}
|
||||
|
@ -68,7 +70,9 @@ class BumpVersionTask extends DefaultTask {
|
|||
|
||||
toUpdate.keySet().forEach { p ->
|
||||
project.allprojects.each { cp ->
|
||||
if (cp.name == "deprecated" || cp.name == "fabric-api") return
|
||||
if (cp.name == "deprecated" || cp.name == "fabric-api") {
|
||||
return
|
||||
}
|
||||
|
||||
def config = cp.configurations.api
|
||||
config.allDependencies.forEach { dep ->
|
||||
|
@ -111,9 +115,9 @@ class BumpVersionTask extends DefaultTask {
|
|||
println "${p.name}: $version -> $newVersion"
|
||||
|
||||
text = text.replace(
|
||||
"${p.name}-version=$version",
|
||||
"${p.name}-version=$newVersion"
|
||||
)
|
||||
"${p.name}-version=$version",
|
||||
"${p.name}-version=$newVersion"
|
||||
)
|
||||
}
|
||||
|
||||
gpFile.text = text
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import java.nio.file.Files
|
||||
|
||||
for (def sourceSet in [sourceSets.main, sourceSets.client]) {
|
||||
for (def sourceSet in [
|
||||
sourceSets.main,
|
||||
sourceSets.client
|
||||
]) {
|
||||
// We have to capture the source set name for the lazy string literals,
|
||||
// otherwise it'll just be whatever the last source set is in the list.
|
||||
def sourceSetName = sourceSet.name
|
||||
|
|
|
@ -17,7 +17,12 @@ class ValidateAnnotations extends SourceTask {
|
|||
|
||||
@TaskAction
|
||||
def run() {
|
||||
for (def dir in ['api', 'impl', 'mixin', 'test']) {
|
||||
for (def dir in [
|
||||
'api',
|
||||
'impl',
|
||||
'mixin',
|
||||
'test'
|
||||
]) {
|
||||
getSource().matching { include "net/fabricmc/fabric/$dir/" }.forEach {
|
||||
if (it.isDirectory()) {
|
||||
return
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"FabricMC"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.19",
|
||||
"fabricloader": ">=0.14.21",
|
||||
"java": ">=17",
|
||||
"minecraft": ">=1.20- <1.20.1-"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue