Add CustomManifestTest
parent
34b771f744
commit
d271dfadd0
|
@ -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.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 CustomManifestTest extends Specification implements ProjectTestTrait {
|
||||||
|
@Override
|
||||||
|
String name() {
|
||||||
|
"minimalBase"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
def filesReady() {
|
||||||
|
buildGradle() << '''
|
||||||
|
loom {
|
||||||
|
customManifest = "https://maven.fabricmc.net/net/minecraft/1_18_experimental-snapshot-1.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft "com.mojang:minecraft:1.18_experimental-snapshot-1"
|
||||||
|
mappings "net.fabricmc:yarn:1.18_experimental-snapshot-1+build.2:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:0.11.6"
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unroll
|
||||||
|
def "customManifest (gradle #gradle)"() {
|
||||||
|
when:
|
||||||
|
def result = create("build", gradle)
|
||||||
|
then:
|
||||||
|
result.task(":build").outcome == SUCCESS
|
||||||
|
where:
|
||||||
|
gradle | _
|
||||||
|
DEFAULT_GRADLE | _
|
||||||
|
PRE_RELEASE_GRADLE | _
|
||||||
|
}
|
||||||
|
}
|
|
@ -79,9 +79,17 @@ trait ProjectTestTrait {
|
||||||
gradleHome.deleteDir()
|
gradleHome.deleteDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File buildGradle() {
|
||||||
|
return new File(testProjectDir, "build.gradle")
|
||||||
|
}
|
||||||
|
|
||||||
|
def filesReady() {
|
||||||
|
}
|
||||||
|
|
||||||
BuildResult create(String task, String gradleVersion = DEFAULT_GRADLE) {
|
BuildResult create(String task, String gradleVersion = DEFAULT_GRADLE) {
|
||||||
System.setProperty("fabric.loom.test", "true")
|
System.setProperty("fabric.loom.test", "true")
|
||||||
copyInputFiles()
|
copyInputFiles()
|
||||||
|
filesReady()
|
||||||
|
|
||||||
GradleRunner.create()
|
GradleRunner.create()
|
||||||
.withProjectDir(testProjectDir)
|
.withProjectDir(testProjectDir)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// This is used by a range of tests that append to this file before running the gradle tasks.
|
||||||
|
// Can be used for tests that require minimal custom setup
|
||||||
|
plugins {
|
||||||
|
id 'fabric-loom'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
archivesBaseName = "fabric-example-mod"
|
||||||
|
version = "1.0.0"
|
||||||
|
group = "com.example"
|
Loading…
Reference in New Issue