diff options
author | shedaniel <daniel@shedaniel.me> | 2021-10-13 15:09:08 +0800 |
---|---|---|
committer | shedaniel <daniel@shedaniel.me> | 2021-10-13 15:13:02 +0800 |
commit | 72295a81969f129a6ef5e2339b6a4f78d7cbc240 (patch) | |
tree | cfdaf150718eecc1116b163b7c8ae199048493c9 /src/test/groovy | |
parent | 64f10eb47bd6b0411e62566cbcf692946b9fa812 (diff) | |
parent | d8675e056b7b16fd9b8307191301a06d931ecd1f (diff) | |
download | architectury-loom-72295a81969f129a6ef5e2339b6a4f78d7cbc240.tar.gz architectury-loom-72295a81969f129a6ef5e2339b6a4f78d7cbc240.tar.bz2 architectury-loom-72295a81969f129a6ef5e2339b6a4f78d7cbc240.zip |
Merge remote-tracking branch 'FabricMC/dev/0.10' into dev/0.10.0
Signed-off-by: shedaniel <daniel@shedaniel.me>
# Conflicts:
# .github/workflows/test.yml
# src/main/java/net/fabricmc/loom/configuration/RemapConfiguration.java
# src/main/java/net/fabricmc/loom/configuration/ide/RunConfig.java
# src/main/java/net/fabricmc/loom/configuration/providers/MinecraftProviderImpl.java
# src/main/java/net/fabricmc/loom/configuration/providers/minecraft/assets/MinecraftAssetsProvider.java
# src/main/java/net/fabricmc/loom/decompilers/fernflower/AbstractFernFlowerDecompiler.java
# src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java
# src/main/java/net/fabricmc/loom/task/GenVsCodeProjectTask.java
# src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java
# src/main/java/net/fabricmc/loom/util/SourceRemapper.java
# src/test/resources/projects/parchment/build.gradle
Diffstat (limited to 'src/test/groovy')
5 files changed, 122 insertions, 4 deletions
diff --git a/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy b/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy index a82e9086..d1985600 100644 --- a/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy @@ -24,9 +24,11 @@ package net.fabricmc.loom.test +import org.gradle.util.GradleVersion + class LoomTestConstants { - public final static String DEFAULT_GRADLE = "7.0.1" - public final static String PRE_RELEASE_GRADLE = "7.4-20210927222644+0000" + public final static String DEFAULT_GRADLE = GradleVersion.current().getVersion() + public final static String PRE_RELEASE_GRADLE = "7.4-20211011231946+0000" public final static String[] STANDARD_TEST_VERSIONS = [DEFAULT_GRADLE, PRE_RELEASE_GRADLE] } diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/DecompileTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/DecompileTest.groovy index 239fa637..daa2a511 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/DecompileTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/DecompileTest.groovy @@ -47,6 +47,7 @@ class DecompileTest extends Specification implements GradleProjectTestTrait { decompiler | task | version 'fernflower' | "genSources" | DEFAULT_GRADLE 'fernflower' | "genSources" | PRE_RELEASE_GRADLE - 'cfr' | "genSourcesWithExperimentalCfr" | DEFAULT_GRADLE + 'cfr' | "genSourcesWithCfr" | DEFAULT_GRADLE + 'cfr' | "genSourcesWithCfr" | PRE_RELEASE_GRADLE } } diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/MigrateMappingsTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/MigrateMappingsTest.groovy new file mode 100644 index 00000000..e53f931d --- /dev/null +++ b/src/test/groovy/net/fabricmc/loom/test/integration/MigrateMappingsTest.groovy @@ -0,0 +1,50 @@ +/* + * This file is part of fabric-loom, licensed under the MIT License (MIT). + * + * Copyright (c) 2021 FabricMC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package net.fabricmc.loom.test.integration + +import net.fabricmc.loom.test.util.GradleProjectTestTrait +import spock.lang.Specification +import spock.lang.Unroll + +import static net.fabricmc.loom.test.LoomTestConstants.STANDARD_TEST_VERSIONS +import static org.gradle.testkit.runner.TaskOutcome.SUCCESS + +class MigrateMappingsTest extends Specification implements GradleProjectTestTrait { + @Unroll + def "Migrate mappings (gradle #version)"() { + setup: + def gradle = gradleProject(project: "java16", version: version) + + when: + def result = gradle.run(tasks: ["migrateMappings", "--mappings", "21w38a+build.10"]) + + then: + result.task(":migrateMappings").outcome == SUCCESS + // TODO check it actually did something + + where: + version << STANDARD_TEST_VERSIONS + } +} diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/MultiProjectTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/MultiProjectTest.groovy index 11de0ef8..5aa5b70e 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/MultiProjectTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/MultiProjectTest.groovy @@ -38,7 +38,7 @@ class MultiProjectTest extends Specification implements GradleProjectTestTrait { def gradle = gradleProject(project: "multiproject", version: version) when: - def result = gradle.run(task: "build") + def result = gradle.run(tasks: ["build", "eclipse", "vscode", "idea"]) then: result.task(":build").outcome == SUCCESS diff --git a/src/test/groovy/net/fabricmc/loom/test/unit/IPCTest.groovy b/src/test/groovy/net/fabricmc/loom/test/unit/IPCTest.groovy new file mode 100644 index 00000000..a53751a8 --- /dev/null +++ b/src/test/groovy/net/fabricmc/loom/test/unit/IPCTest.groovy @@ -0,0 +1,65 @@ +/* + * This file is part of fabric-loom, licensed under the MIT License (MIT). + * + * Copyright (c) 2021 FabricMC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package net.fabricmc.loom.test.unit + +import net.fabricmc.loom.util.ipc.IPCClient +import net.fabricmc.loom.util.ipc.IPCServer +import spock.lang.Specification +import spock.lang.Timeout + +import java.nio.file.Files +import java.util.function.Consumer + +@Timeout(20) +class IPCTest extends Specification { + def "ipc test"() { + given: + def path = Files.createTempFile("loom", "ipc") + Files.deleteIfExists(path) + + def received = [] + Consumer<String> consumer = { str -> + println str + received << str + } + + when: + def ipcServer = new IPCServer(path, consumer) + + new IPCClient(path).withCloseable { client -> + client.accept("Test") + client.accept("Hello") + } + + // Allow ipcServer to finish reading, before closing. + while (received.size() != 2) { } + ipcServer.close() + + then: + received.size() == 2 + received[0] == "Test" + received[1] == "Hello" + } +} |