Tweak tests

dev/0.11
modmuss50 2020-08-26 13:07:26 +01:00
parent 326224ba91
commit 60909ce9a5
5 changed files with 57 additions and 18 deletions

View File

@ -3,7 +3,7 @@ package net.fabricmc.loom
/** /**
* Created by Mitchell Skaggs on 6/12/2019. * Created by Mitchell Skaggs on 6/12/2019.
*/ */
static String genBuildFile() { static String genBuildFile(String mappingsDep = "\"net.fabricmc:yarn:\${project.yarn_mappings}\"") {
""" """
plugins { plugins {
id 'fabric-loom' id 'fabric-loom'
@ -23,7 +23,7 @@ minecraft {
dependencies { dependencies {
//to change the versions see the gradle.properties file //to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:\${project.minecraft_version}" minecraft "com.mojang:minecraft:\${project.minecraft_version}"
mappings "net.fabricmc:yarn:\${project.yarn_mappings}" mappings ${mappingsDep}
modCompile "net.fabricmc:fabric-loader:\${project.loader_version}" modCompile "net.fabricmc:fabric-loader:\${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.

View File

@ -46,7 +46,6 @@ class EmptyBuildFunctionalTest extends Specification {
where: where:
mcVersion | yarnVersion | loaderVersion | fabricVersion mcVersion | yarnVersion | loaderVersion | fabricVersion
'1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.183' '1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.183'
'1.14.1' | '1.14.1+build.10' | '0.4.8+build.155' | '0.3.0+build.183' '1.16.2' | '1.16.2+build.26:v2' | '0.9.2+build.206' | '0.19.0+build.398-1.16'
'1.14.2' | '1.14.2+build.7' | '0.4.8+build.155' | '0.3.0+build.183'
} }
} }

View File

@ -0,0 +1,50 @@
package net.fabricmc.loom
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import spock.lang.Specification
import spock.lang.Unroll
import static net.fabricmc.loom.BuildUtils.*
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
/**
* Created by Mitchell Skaggs on 6/10/2019.
*/
class EmptyBuildMojangFunctionalTest extends Specification {
@Rule
TemporaryFolder testProjectDir = new TemporaryFolder()
File settingsFile
File buildFile
File propsFile
def setup() {
settingsFile = testProjectDir.newFile('settings.gradle')
buildFile = testProjectDir.newFile('build.gradle')
propsFile = testProjectDir.newFile('gradle.properties')
}
@Unroll
def "empty build succeeds using Minecraft #mcVersion"() {
given:
settingsFile << genSettingsFile("empty-build-functional-test")
propsFile << genPropsFile(mcVersion, "nope", loaderVersion, fabricVersion)
buildFile << genBuildFile("minecraft.officialMojangMappings()")
when:
def result = GradleRunner.create()
.withProjectDir(testProjectDir.root)
.withArguments('build',"--stacktrace")
.withPluginClasspath()
.forwardOutput()
.build()
then:
result.task(":build").outcome == SUCCESS
where:
mcVersion | loaderVersion | fabricVersion
'1.16.2' | '0.9.2+build.206' | '0.19.0+build.398-1.16'
}
}

View File

@ -40,13 +40,7 @@ class MixinBuildFunctionalTest extends Specification {
modMixinsJavaFile = testProjectDir.newFile("src/main/java/net/fabricmc/example/mixin/ExampleMixin.java") modMixinsJavaFile = testProjectDir.newFile("src/main/java/net/fabricmc/example/mixin/ExampleMixin.java")
} }
/**
* Why it's ignored:
* <p>
* When doing mixin annotation processing, a {@link ServiceLoader} is used to find implementations of {@link org.spongepowered.tools.obfuscation.service.IObfuscationService}. The classpath isn't passed to the build properly in this case, causing the Fabric-specific {@link net.fabricmc.loom.mixin.ObfuscationServiceFabric} to not be loaded. This causes the mixin to fail to compile because it doesn't know how to be reobfuscated.
*/
@Unroll @Unroll
@Ignore("fails because the annotation processor classpath doesn't include fabric-mixin-compile-extensions, so it doesn't know how to remap anything")
def "mixin build succeeds using Minecraft #mcVersion"() { def "mixin build succeeds using Minecraft #mcVersion"() {
given: given:
settingsFile << genSettingsFile("mixin-build-functional-test") settingsFile << genSettingsFile("mixin-build-functional-test")
@ -71,7 +65,5 @@ class MixinBuildFunctionalTest extends Specification {
where: where:
mcVersion | yarnVersion | loaderVersion | fabricVersion mcVersion | yarnVersion | loaderVersion | fabricVersion
'1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.184' '1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.184'
'1.14.1' | '1.14.1+build.10' | '0.4.8+build.155' | '0.3.0+build.184'
'1.14.2' | '1.14.2+build.7' | '0.4.8+build.155' | '0.3.0+build.184'
} }
} }

View File

@ -58,7 +58,5 @@ class SimpleBuildFunctionalTest extends Specification {
mcVersion | yarnVersion | loaderVersion | fabricVersion mcVersion | yarnVersion | loaderVersion | fabricVersion
'19w45a' | '19w45a+build.2:v2' | '0.6.2+build.166' | '0.4.9+build.258-1.15' '19w45a' | '19w45a+build.2:v2' | '0.6.2+build.166' | '0.4.9+build.258-1.15'
'1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.184' '1.14' | '1.14+build.21' | '0.4.8+build.155' | '0.3.0+build.184'
'1.14.1' | '1.14.1+build.10' | '0.4.8+build.155' | '0.3.0+build.184'
'1.14.2' | '1.14.2+build.7' | '0.4.8+build.155' | '0.3.0+build.184'
} }
} }