Merge with Fabric 1.1, stage 2

This commit is contained in:
Juuz
2023-02-16 01:00:05 +02:00
21 changed files with 89 additions and 73 deletions

View File

@@ -14,13 +14,13 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [7.5.0-jdk17]
version: [7.5.1-jdk17]
runs-on: ubuntu-22.04
container:
image: gradle:${{ matrix.version }}
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- run: gradle build check -x test --stacktrace --warning-mode fail
- uses: Juuxel/publish-checkstyle-report@v1
@@ -36,15 +36,15 @@ jobs:
runs-on: ubuntu-22.04
container:
image: gradle:7.5.0-jdk17
image: gradle:7.5.1-jdk17
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: gradle writeActionsTestMatrix --stacktrace --warning-mode fail
-
id: set-matrix
run: echo "::set-output name=matrix::$(cat build/test_matrix.json)"
run: echo "matrix=$(cat build/test_matrix.json)" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [7.4.0-jdk17]
version: [7.5.1-jdk17]
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}
runs-on: ubuntu-22.04
@@ -64,7 +64,7 @@ jobs:
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: gradle printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
env:
TEST_WARNING_MODE: fail
@@ -95,11 +95,12 @@ jobs:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- run: ./gradlew printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
env:
TEST_WARNING_MODE: fail
@@ -112,7 +113,7 @@ jobs:
path: build/test-results/**/*.xml
retention-days: 1
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ steps.test.outputs.test }} (${{ matrix.java }}) Results (Windows)
@@ -126,14 +127,15 @@ jobs:
fail-fast: false
matrix:
java: [ 17, 18 ]
os: [ windows-2022, ubuntu-22.04, macos-11 ]
os: [ windows-2022, ubuntu-22.04, macos-12 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- run: ./gradlew test --tests *ReproducibleBuildTest --stacktrace --warning-mode fail
- name: Publish test results for report
@@ -144,7 +146,7 @@ jobs:
path: build/test-results/**/*.xml
retention-days: 1
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: Reproducible Build ${{ matrix.os }} (${{ matrix.java }}) Results

View File

@@ -19,7 +19,7 @@ dependencies {
implementation gradleApi()
testImplementation(gradleTestKit())
testImplementation('org.spockframework:spock-core:2.1-groovy-3.0') {
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
exclude module: 'groovy-all'
}
}

View File

@@ -9,7 +9,7 @@ plugins {
id 'jacoco'
id 'codenarc'
id "org.jetbrains.kotlin.jvm" version "1.6.10" // Must match the version included with gradle.
id "com.diffplug.spotless" version "6.8.0"
id "com.diffplug.spotless" version "6.11.0"
id "org.gradle.test-retry" version "1.4.1"
}
@@ -81,14 +81,14 @@ dependencies {
// libraries
implementation ('commons-io:commons-io:2.11.0')
implementation ('com.google.code.gson:gson:2.9.0')
implementation ('com.fasterxml.jackson.core:jackson-databind:2.13.3')
implementation ('com.google.code.gson:gson:2.10')
implementation ('com.fasterxml.jackson.core:jackson-databind:2.13.4.2')
implementation ('com.google.guava:guava:31.1-jre')
implementation ('org.ow2.asm:asm:9.3')
implementation ('org.ow2.asm:asm-analysis:9.3')
implementation ('org.ow2.asm:asm-commons:9.3')
implementation ('org.ow2.asm:asm-tree:9.3')
implementation ('org.ow2.asm:asm-util:9.3')
implementation ('org.ow2.asm:asm:9.4')
implementation ('org.ow2.asm:asm-analysis:9.4')
implementation ('org.ow2.asm:asm-commons:9.4')
implementation ('org.ow2.asm:asm-tree:9.4')
implementation ('org.ow2.asm:asm-util:9.4')
implementation ('me.tongfei:progressbar:0.9.0')
// game handling utils
@@ -108,14 +108,14 @@ dependencies {
implementation "dev.architectury:refmap-remapper:1.0.5"
// decompilers
implementation ('net.fabricmc:fabric-fernflower:1.5.0')
implementation ('net.fabricmc:cfr:0.1.1')
implementation ('net.fabricmc:fabric-fernflower:2.0.0')
implementation ('net.fabricmc:cfr:0.2.0')
// source code remapping
implementation ('dev.architectury:mercury:0.1.2.15')
// Kotlin
implementation('org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.4.2') {
implementation('org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.5.0') {
transitive = false
}
@@ -132,15 +132,15 @@ dependencies {
// Testing
testImplementation(gradleTestKit())
testImplementation('org.spockframework:spock-core:2.1-groovy-3.0') {
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
exclude module: 'groovy-all'
}
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation ('io.javalin:javalin:4.6.1') {
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
testImplementation ('io.javalin:javalin:5.1.2') {
exclude group: 'org.jetbrains.kotlin'
}
testImplementation 'net.fabricmc:fabric-installer:0.9.0'
testImplementation 'org.mockito:mockito-core:4.6.1'
testImplementation 'org.mockito:mockito-core:4.8.0'
compileOnly 'org.jetbrains:annotations:23.0.0'
testCompileOnly 'org.jetbrains:annotations:23.0.0'
@@ -183,7 +183,7 @@ spotless {
checkstyle {
configFile = file('checkstyle.xml')
toolVersion = '10.3.1'
toolVersion = '10.3.4'
}
codenarc {
@@ -201,7 +201,7 @@ gradlePlugin {
}
jacoco {
toolVersion = "0.8.7"
toolVersion = "0.8.8"
}
// Run to get test coverage.
@@ -385,6 +385,6 @@ class PrintActionsTestName extends DefaultTask {
@TaskAction
def run() {
def sanitised = testName.replace('*', '_')
println "::set-output name=test::$sanitised"
new File(System.getenv().GITHUB_OUTPUT) << "\ntest=$sanitised"
}
}

View File

@@ -160,10 +160,5 @@
<module name="AtclauseOrder">
<property name="tagOrder" value="@param,@return,@throws,@deprecated"/>
</module>
<!-- Prevent var for all cases other than new instance creation -->
<module name="MatchXpath">
<property name="query" value="//VARIABLE_DEF[./TYPE/IDENT[@text='var'] and not(./ASSIGN/EXPR/LITERAL_NEW)]"/>
</module>
</module>
</module>
</module>

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6
gradlew vendored
View File

@@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

14
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -89,6 +89,14 @@ public interface LoomGradleExtensionAPI {
NamedDomainObjectContainer<RunConfigSettings> getRunConfigs();
/**
* {@return the value of {@link #getRunConfigs}}
* This is an alias for it that matches {@link #runs}.
*/
default NamedDomainObjectContainer<RunConfigSettings> getRuns() {
return getRunConfigs();
}
void mixin(Action<MixinExtensionAPI> action);
/**

View File

@@ -57,7 +57,8 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
public void provide(boolean applyDependencies) throws Exception {
parentMinecraftProvider.provide(false);
boolean requiresProcessing = parentMinecraftProvider.getMinecraftJarPaths().stream()
boolean requiresProcessing = parentMinecraftProvider.getMinecraftJars().stream()
.map(this::getProcessedPath)
.anyMatch(jarProcessorManager::requiresProcessingJar);
if (requiresProcessing) {
@@ -76,7 +77,7 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
private void processJars() throws IOException {
for (MinecraftJar minecraftJar : parentMinecraftProvider.getMinecraftJars()) {
final MinecraftJar outputJar = getProcessedPath(minecraftJar);
final MinecraftJar outputJar = getProcessedJar(minecraftJar);
deleteSimilarJars(outputJar.getPath());
final LocalMavenHelper mavenHelper = getMavenHelper(minecraftJar.getName());
@@ -139,7 +140,7 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
@Override
public List<MinecraftJar> getMinecraftJars() {
return getParentMinecraftProvider().getMinecraftJars().stream()
.map(this::getProcessedPath)
.map(this::getProcessedJar)
.toList();
}
@@ -147,9 +148,13 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
return parentMinecraftProvider;
}
public MinecraftJar getProcessedPath(MinecraftJar minecraftJar) {
final Path path = getMavenHelper(minecraftJar.getName()).getOutputFile(null);
return minecraftJar.forPath(path);
private Path getProcessedPath(MinecraftJar minecraftJar) {
final LocalMavenHelper mavenHelper = getMavenHelper(minecraftJar.getName());
return mavenHelper.getOutputFile(null);
}
public MinecraftJar getProcessedJar(MinecraftJar minecraftJar) {
return minecraftJar.forPath(getProcessedPath(minecraftJar));
}
public static final class MergedImpl extends ProcessedNamedMinecraftProvider<MergedMinecraftProvider, NamedMinecraftProvider.MergedImpl> implements Merged {
@@ -159,7 +164,7 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
@Override
public MinecraftJar getMergedJar() {
return getProcessedPath(getParentMinecraftProvider().getMergedJar());
return getProcessedJar(getParentMinecraftProvider().getMergedJar());
}
}
@@ -170,12 +175,12 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
@Override
public MinecraftJar getCommonJar() {
return getProcessedPath(getParentMinecraftProvider().getCommonJar());
return getProcessedJar(getParentMinecraftProvider().getCommonJar());
}
@Override
public MinecraftJar getClientOnlyJar() {
return getProcessedPath(getParentMinecraftProvider().getClientOnlyJar());
return getProcessedJar(getParentMinecraftProvider().getClientOnlyJar());
}
}
@@ -197,7 +202,7 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
@Override
public MinecraftJar getEnvOnlyJar() {
return getProcessedPath(getParentMinecraftProvider().getEnvOnlyJar());
return getProcessedJar(getParentMinecraftProvider().getEnvOnlyJar());
}
@Override

View File

@@ -27,7 +27,7 @@ package net.fabricmc.loom.test
import org.gradle.util.GradleVersion
class LoomTestConstants {
private final static String NIGHTLY_VERSION = "8.0-20221022221212+0000"
private final static String NIGHTLY_VERSION = "8.0-20221027221148+0000"
private final static boolean NIGHTLY_EXISTS = nightlyExists(NIGHTLY_VERSION)
public final static String DEFAULT_GRADLE = GradleVersion.current().getVersion()

View File

@@ -39,7 +39,7 @@ class KotlinTest extends Specification implements GradleProjectTestTrait {
def gradle = gradleProject(project: "kotlin", version: version)
def server = ServerRunner.create(gradle.projectDir, "1.16.5")
.withMod(gradle.getOutputFile("fabric-example-mod-0.0.1.jar"))
.downloadMod(ServerRunner.FABRIC_LANG_KOTLIN, "fabric-language-kotlin-1.7.3+kotlin.1.6.20.jar")
.downloadMod(ServerRunner.FABRIC_LANG_KOTLIN, "fabric-language-kotlin-1.8.5+kotlin.1.7.20.jar")
when:
def result = gradle.run(task: "build")

View File

@@ -56,7 +56,7 @@ class ModJavadocTest extends Specification implements GradleProjectTestTrait {
}
private static String getClassSource(GradleProject gradle, String classname) {
File sourcesJar = gradle.getGeneratedLocalSources("1.17.1/net.fabricmc.yarn.1_17_1.1.17.1+build.59-v2")
File sourcesJar = gradle.getGeneratedLocalSources("1.17.1-net.fabricmc.yarn.1_17_1.1.17.1+build.59-v2")
return new String(ZipUtils.unpack(sourcesJar.toPath(), classname), StandardCharsets.UTF_8)
}
}

View File

@@ -34,7 +34,7 @@ import static net.fabricmc.loom.test.LoomTestConstants.*
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class UnpickTest extends Specification implements GradleProjectTestTrait {
static final String MAPPINGS = "21w13a/net.fabricmc.yarn.21w13a.21w13a+build.30-v2"
static final String MAPPINGS = "21w13a-net.fabricmc.yarn.21w13a.21w13a+build.30-v2"
def "unpick decompile"() {
setup:

View File

@@ -24,7 +24,7 @@
package net.fabricmc.loom.test.unit.download
import io.javalin.http.HttpCode
import io.javalin.http.HttpStatus
import net.fabricmc.loom.util.Checksum
import net.fabricmc.loom.util.download.Download
import net.fabricmc.loom.util.download.DownloadException
@@ -175,7 +175,7 @@ class DownloadFileTest extends DownloadTest {
if (clientEtag == etag) {
// Etag matches, no need to send the data.
it.status(HttpCode.NOT_MODIFIED)
it.status(HttpStatus.NOT_MODIFIED)
return
}

View File

@@ -24,7 +24,7 @@
package net.fabricmc.loom.test.unit.download
import io.javalin.http.HttpCode
import io.javalin.http.HttpStatus
import net.fabricmc.loom.util.download.Download
import net.fabricmc.loom.util.download.DownloadException
@@ -80,7 +80,7 @@ class DownloadStringTest extends DownloadTest {
requests ++
if (requests < 3) {
it.status(HttpCode.INTERNAL_SERVER_ERROR)
it.status(HttpStatus.INTERNAL_SERVER_ERROR)
return
}

View File

@@ -33,7 +33,6 @@ abstract class DownloadTest extends Specification {
@Shared
Javalin server = Javalin.create { config ->
config.enableDevLogging()
}.start(9081)
def cleanupSpec() {

View File

@@ -244,11 +244,11 @@ trait GradleProjectTestTrait {
}
File getGeneratedSources(String mappings) {
return new File(getGradleHomeDir(), "caches/fabric-loom/${mappings}/minecraft-merged-named-sources.jar")
return new File(getGradleHomeDir(), "caches/fabric-loom/minecraftMaven/net/minecraft/minecraft-merged/${mappings}/minecraft-merged-${mappings}-sources.jar")
}
File getGeneratedLocalSources(String mappings) {
return new File(getProjectDir(), ".gradle/loom-cache/${mappings}/minecraft-project-@-merged-named-sources.jar")
return new File(getProjectDir(), ".gradle/loom-cache/minecraftMaven/net/minecraft/minecraft-merged-project-root/${mappings}/minecraft-merged-project-root-${mappings}-sources.jar")
}
void buildSrc(String name) {

View File

@@ -37,7 +37,6 @@ trait MockMavenServerTrait {
println "Maven server path: ${testMavenDir.absolutePath}"
server = Javalin.create { config ->
config.enableDevLogging()
}.start(mavenServerPort)
/**
@@ -61,7 +60,7 @@ trait MockMavenServerTrait {
file.parentFile.mkdirs()
file.withOutputStream {
IOUtils.copy(ctx.bodyAsInputStream(), it)
IOUtils.copy(ctx.bodyInputStream(), it)
}
}
}

View File

@@ -34,7 +34,7 @@ class ServerRunner {
"1.16.5": "https://github.com/FabricMC/fabric/releases/download/0.37.1%2B1.16/fabric-api-0.37.1+1.16.jar",
"1.17.1": "https://github.com/FabricMC/fabric/releases/download/0.37.1%2B1.17/fabric-api-0.37.1+1.17.jar"
]
static final String FABRIC_LANG_KOTLIN = "https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/1.7.3%2Bkotlin.1.6.20/fabric-language-kotlin-1.7.3%2Bkotlin.1.6.20.jar"
static final String FABRIC_LANG_KOTLIN = "https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/1.8.5%2Bkotlin.1.7.20/fabric-language-kotlin-1.8.5%2Bkotlin.1.7.20.jar"
final File serverDir
final String minecraftVersion

View File

@@ -1,8 +1,8 @@
import java.util.Properties
plugins {
kotlin("jvm") version "1.6.20"
kotlin("plugin.serialization") version "1.6.20"
kotlin("jvm") version "1.7.20"
kotlin("plugin.serialization") version "1.7.20"
id("dev.architectury.loom")
}
@@ -17,5 +17,5 @@ dependencies {
minecraft(group = "com.mojang", name = "minecraft", version = "1.16.5")
mappings(group = "net.fabricmc", name = "yarn", version = "1.16.5+build.5", classifier = "v2")
modImplementation("net.fabricmc:fabric-loader:0.12.12")
modImplementation(group = "net.fabricmc", name = "fabric-language-kotlin", version = "1.7.3+kotlin.1.6.20")
modImplementation(group = "net.fabricmc", name = "fabric-language-kotlin", version = "1.8.5+kotlin.1.7.20")
}