aboutsummaryrefslogtreecommitdiff
path: root/src/test/groovy/net
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2021-07-10 23:52:38 +0300
committerGitHub <noreply@github.com>2021-07-10 21:52:38 +0100
commite9657d63c47f982116e94134257a57d2d6166481 (patch)
tree5d5ff06fde4b7383c532bb5c83ed06b76721b390 /src/test/groovy/net
parent54fe0909ff030401f1db2bca261b62a476b9de82 (diff)
downloadarchitectury-loom-e9657d63c47f982116e94134257a57d2d6166481.tar.gz
architectury-loom-e9657d63c47f982116e94134257a57d2d6166481.tar.bz2
architectury-loom-e9657d63c47f982116e94134257a57d2d6166481.zip
Fix local file mod dependencies (#430)
* ModProcessor: Add more descriptive error TR output error message * Fix flatDir/files/fileTree mod dependencies * Add clarifying comment * Use hash as a placeholder version * ProjectTestTrait: Copy instead of reading and writing text This allows having jars and other binary data in tests. * Add integration test for local file dependencies * Use File.bytes instead of Files.copy * Use truncated SHA256 instead of murmur3
Diffstat (limited to 'src/test/groovy/net')
-rw-r--r--src/test/groovy/net/fabricmc/loom/test/integration/LocalFileDependencyTest.groovy50
-rw-r--r--src/test/groovy/net/fabricmc/loom/test/util/ProjectTestTrait.groovy2
2 files changed, 51 insertions, 1 deletions
diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/LocalFileDependencyTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/LocalFileDependencyTest.groovy
new file mode 100644
index 00000000..69461987
--- /dev/null
+++ b/src/test/groovy/net/fabricmc/loom/test/integration/LocalFileDependencyTest.groovy
@@ -0,0 +1,50 @@
+/*
+ * This file is part of fabric-loom, licensed under the MIT License (MIT).
+ *
+ * Copyright (c) 2016, 2017, 2018 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.ProjectTestTrait
+import spock.lang.Specification
+import spock.lang.Unroll
+
+import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
+
+class LocalFileDependencyTest extends Specification implements ProjectTestTrait {
+ @Override
+ String name() {
+ "localFileDependency"
+ }
+
+ @Unroll
+ def "build (gradle #gradle)"() {
+ when:
+ def result = create("build", gradle)
+ then:
+ result.task(":build").outcome == SUCCESS
+ where:
+ gradle | _
+ DEFAULT_GRADLE | _
+ PRE_RELEASE_GRADLE | _
+ }
+}
diff --git a/src/test/groovy/net/fabricmc/loom/test/util/ProjectTestTrait.groovy b/src/test/groovy/net/fabricmc/loom/test/util/ProjectTestTrait.groovy
index 28901dd7..7097681f 100644
--- a/src/test/groovy/net/fabricmc/loom/test/util/ProjectTestTrait.groovy
+++ b/src/test/groovy/net/fabricmc/loom/test/util/ProjectTestTrait.groovy
@@ -59,7 +59,7 @@ trait ProjectTestTrait {
}
tempFile.parentFile.mkdirs()
- tempFile << file.text
+ tempFile.bytes = file.bytes
}
// Disable the CI checks to ensure nothing is skipped