Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start work on Client Game Test API #4292

Merged
merged 15 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
with:
distribution: 'microsoft'
java-version: '21'
- name: Run Auto test Client
- name: Run Client Gametests
uses: modmuss50/xvfb-action@v1
with:
run: ./gradlew runProductionAutoTestClient --stacktrace --warning-mode=fail
run: ./gradlew runProductionClientGametest --stacktrace --warning-mode=fail
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
37 changes: 23 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ loom {
name "Auto Test Server"
vmArg "-Dfabric.autoTest"
}
autoTestClient {
clientGametest {
inherit testmodClient
name "Auto Test Client"
vmArg "-Dfabric.autoTest"
name "Client Game Test"
vmArg "-Dfabric.client.gametest"
vmArg "-Dfabric-tag-conventions-v2.missingTagTranslationWarning=fail"
vmArg "-Dfabric-tag-conventions-v1.legacyTagWarning=fail"
}
Expand All @@ -432,9 +432,9 @@ loom {
ideConfigGenerated = false
}

autoTestClientCoverage {
inherit autoTestClient
name "Auto Test Client Coverage"
clientGametestCoverage {
inherit clientGametest
name "Client Game Test Coverage"
ideConfigGenerated = false
}
}
Expand All @@ -448,7 +448,7 @@ test.dependsOn runGametest

def coverageTasks = [
runGametestCoverage,
runAutoTestClientCoverage
runClientGametestCoverage
]

jacoco {
Expand Down Expand Up @@ -484,20 +484,26 @@ configurations {
extendsFrom configurations.minecraftRuntimeLibraries
}
productionRuntimeServer
productionMods {
transitive = false
}
}

dependencies {
productionRuntime "net.fabricmc:fabric-loader:${project.loader_version}"
productionRuntime "net.fabricmc:intermediary:${project.minecraft_version}"

productionRuntimeServer "net.fabricmc:fabric-installer:${project.installer_version}:server"
productionMods project(':fabric-client-gametest-api-v1')
}

import net.fabricmc.loom.util.Platform

def productionMods = project.files(configurations.productionMods, remapJar.archiveFile, remapTestmodJar.archiveFile)

// This is very far beyond loom's API if you copy this, you're on your own.
tasks.register('runProductionAutoTestClient', JavaExec) {
dependsOn remapJar, remapTestmodJar, downloadAssets
tasks.register('runProductionClientGametest', JavaExec) {
dependsOn productionMods, downloadAssets
classpath.from configurations.productionRuntime
mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient"
workingDir = file("run")
Expand All @@ -519,8 +525,8 @@ tasks.register('runProductionAutoTestClient', JavaExec) {
}

jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.autoTest",
"-Dfabric.addMods=${productionMods.collect { it.absolutePath }.join(File.pathSeparator)}",
"-Dfabric.client.gametest",
"-Dfabric-tag-conventions-v2.missingTagTranslationWarning=fail",
"-Dfabric-tag-conventions-v1.legacyTagWarning=fail"
)
Expand All @@ -544,7 +550,7 @@ tasks.register('serverPropertiesJar', Jar) {
}

tasks.register('runProductionAutoTestServer', JavaExec) {
dependsOn remapJar, remapTestmodJar, serverPropertiesJar
dependsOn productionMods, serverPropertiesJar
classpath.from configurations.productionRuntimeServer, serverPropertiesJar
mainClass = "net.fabricmc.installer.ServerLauncher"
workingDir = file("run")
Expand All @@ -553,7 +559,7 @@ tasks.register('runProductionAutoTestServer', JavaExec) {
workingDir.mkdirs()

jvmArgs(
"-Dfabric.addMods=${remapJar.archiveFile.get().asFile.absolutePath}${File.pathSeparator}${remapTestmodJar.archiveFile.get().asFile.absolutePath}",
"-Dfabric.addMods=${productionMods.collect { it.absolutePath }.join(File.pathSeparator)}",
"-Dfabric.autoTest",
)
jvmArgs(debugArgs)
Expand Down Expand Up @@ -726,7 +732,10 @@ subprojects.each {
}

// 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-client-gametest-api-v1",
"fabric-gametest-api-v1",
]

dependencies {
afterEvaluate {
Expand Down
11 changes: 1 addition & 10 deletions fabric-api-base/src/testmod/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@
"main": [
"net.fabricmc.fabric.test.base.FabricApiBaseTestInit"
],
"client": [
"net.fabricmc.fabric.test.base.client.FabricApiAutoTestClient"
],
"server": [
"net.fabricmc.fabric.test.base.FabricApiAutoTestServer"
],
"fabric-gametest" : [
"net.fabricmc.fabric.test.base.FabricApiBaseGameTest"
]
},
"mixins": [
{
"config": "fabric-api-base-testmod.client.mixins.json",
"environment": "client"
}
]
}
}

This file was deleted.

Loading