aboutsummaryrefslogtreecommitdiff
path: root/src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy
diff options
context:
space:
mode:
authorMitchell Skaggs <skaggsm333@gmail.com>2019-06-12 17:14:44 -0500
committerMitchell Skaggs <skaggsm333@gmail.com>2019-06-12 17:14:44 -0500
commit52814a5b7bb673aa14cffd4a2b38dceff5395cef (patch)
treedda47102de7e676bfda4a1b3dd3c00131b2c702b /src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy
parent6376d197c635636f09d870de8755e05ca9b98ee0 (diff)
downloadarchitectury-loom-52814a5b7bb673aa14cffd4a2b38dceff5395cef.tar.gz
architectury-loom-52814a5b7bb673aa14cffd4a2b38dceff5395cef.tar.bz2
architectury-loom-52814a5b7bb673aa14cffd4a2b38dceff5395cef.zip
Extract file generation from functional tests
Diffstat (limited to 'src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy')
-rw-r--r--src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy110
1 files changed, 4 insertions, 106 deletions
diff --git a/src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy b/src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy
index 5ad698a4..954565d3 100644
--- a/src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy
+++ b/src/test/groovy/net/fabricmc/loom/EmptyBuildFunctionalTest.groovy
@@ -6,6 +6,7 @@ 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
/**
@@ -27,111 +28,9 @@ class EmptyBuildFunctionalTest extends Specification {
@Unroll
def "empty build succeeds using Minecraft #mcVersion"() {
given:
- settingsFile << """
-rootProject.name = 'empty-build-functional-test'
-"""
-
- propsFile << """
-org.gradle.caching=true
-org.gradle.parallel=true
-
-# Fabric Properties
-# check these on https://fabricmc.net/use
-minecraft_version=$mcVersion
-yarn_mappings=$yarnVersion
-loader_version=$loaderVersion
-
-# Mod Properties
-mod_version = 1.0.0
-maven_group = net.fabricmc
-archives_base_name = fabric-example-mod
-
-# Dependencies
-# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
-fabric_version=$fabricVersion
-"""
-
- buildFile << """
-plugins {
- id 'fabric-loom'
- id 'maven-publish'
-}
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-
-archivesBaseName = project.archives_base_name
-version = project.mod_version
-group = project.maven_group
-
-minecraft {
-}
-
-dependencies {
- //to change the versions see the gradle.properties file
- minecraft "com.mojang:minecraft:\${project.minecraft_version}"
- mappings "net.fabricmc:yarn:\${project.yarn_mappings}"
- modCompile "net.fabricmc:fabric-loader:\${project.loader_version}"
-
- // Fabric API. This is technically optional, but you probably want it anyway.
- modCompile "net.fabricmc.fabric-api:fabric-api:\${project.fabric_version}"
-
- // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
- // You may need to force-disable transitiveness on them.
-}
-
-processResources {
- inputs.property "version", project.version
-
- from(sourceSets.main.resources.srcDirs) {
- include "fabric.mod.json"
- expand "version": project.version
- }
-
- from(sourceSets.main.resources.srcDirs) {
- exclude "fabric.mod.json"
- }
-}
-
-// ensure that the encoding is set to UTF-8, no matter what the system default is
-// this fixes some edge cases with special characters not displaying correctly
-// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
-tasks.withType(JavaCompile) {
- options.encoding = "UTF-8"
-}
-
-// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
-// if it is present.
-// If you remove this task, sources will not be generated.
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = "sources"
- from sourceSets.main.allSource
-}
-
-jar {
- from "LICENSE"
-}
-
-// configure the maven publication
-publishing {
- publications {
- mavenJava(MavenPublication) {
- // add all the jars that should be included when publishing to maven
- artifact(jar) {
- builtBy remapJar
- }
- artifact(sourcesJar) {
- builtBy remapSourcesJar
- }
- }
- }
-
- // select the repositories you want to publish to
- repositories {
- // uncomment to publish to the local maven
- // mavenLocal()
- }
-}
-"""
+ settingsFile << genSettingsFile("empty-build-functional-test")
+ propsFile << genPropsFile(mcVersion, yarnVersion, loaderVersion, fabricVersion)
+ buildFile << genBuildFile()
when:
def result = GradleRunner.create()
@@ -141,7 +40,6 @@ publishing {
.build()
then:
- //result.output.contains('Hello world!')
result.task(":build").outcome == SUCCESS
where: