aboutsummaryrefslogtreecommitdiff
path: root/src/test/groovy/net/fabricmc/loom/EmptyBuildMojangFunctionalTest.groovy
blob: d360ba6f79b1d60292a663ced373074e68a6e3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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", "--warning-mode", System.getenv().TEST_WARNING_MODE ?: 'all')
				.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'
	}
}