Add a simple java 16 project test
This commit is contained in:
		
							parent
							
								
									9303dc39c3
								
							
						
					
					
						commit
						432e88f354
					
				
					 8 changed files with 166 additions and 0 deletions
				
			
		|  | @ -0,0 +1,49 @@ | |||
| /* | ||||
|  * 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 Java16ProjectTest extends Specification implements ProjectTestTrait { | ||||
| 	@Override | ||||
| 	String name() { | ||||
| 		"java16" | ||||
| 	} | ||||
| 
 | ||||
| 	@Unroll | ||||
| 	def "build (gradle #gradle)"() { | ||||
| 		when: | ||||
| 			def result = create("build", gradle) | ||||
| 		then: | ||||
| 			result.task(":build").outcome == SUCCESS | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										27
									
								
								src/test/resources/projects/java16/build.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/test/resources/projects/java16/build.gradle
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| plugins { | ||||
| 	id 'fabric-loom' | ||||
| 	id 'maven-publish' | ||||
| } | ||||
| 
 | ||||
| sourceCompatibility = JavaVersion.VERSION_16 | ||||
| targetCompatibility = JavaVersion.VERSION_16 | ||||
| 
 | ||||
| archivesBaseName = project.archives_base_name | ||||
| version = project.mod_version | ||||
| group = project.maven_group | ||||
| 
 | ||||
| dependencies { | ||||
| 	// To change the versions see the gradle.properties file | ||||
| 	minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||||
| 	mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||||
| 	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||||
| } | ||||
| 
 | ||||
| tasks.withType(JavaCompile).configureEach { | ||||
| 	it.options.encoding = "UTF-8" | ||||
| 	it.options.release = 16 | ||||
| } | ||||
| 
 | ||||
| java { | ||||
| 	withSourcesJar() | ||||
| } | ||||
							
								
								
									
										9
									
								
								src/test/resources/projects/java16/gradle.properties
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/test/resources/projects/java16/gradle.properties
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| org.gradle.jvmargs=-Xmx1G | ||||
| 
 | ||||
| minecraft_version=21w19a | ||||
| yarn_mappings=21w19a+build.1 | ||||
| loader_version=0.11.2 | ||||
| 
 | ||||
| mod_version = 1.0.0 | ||||
| maven_group = com.example | ||||
| archives_base_name = fabric-example-mod | ||||
							
								
								
									
										2
									
								
								src/test/resources/projects/java16/settings.gradle
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/test/resources/projects/java16/settings.gradle
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| rootProject.name = "fabric-example-mod" | ||||
| 
 | ||||
|  | @ -0,0 +1,14 @@ | |||
| package net.fabricmc.example; | ||||
| 
 | ||||
| import net.fabricmc.api.ModInitializer; | ||||
| 
 | ||||
| public class ExampleMod implements ModInitializer { | ||||
| 	@Override | ||||
| 	public void onInitialize() { | ||||
| 		// This code runs as soon as Minecraft is in a mod-load-ready state. | ||||
| 		// However, some things (like resources) may still be uninitialized. | ||||
| 		// Proceed with mild caution. | ||||
| 
 | ||||
| 		System.out.println("Hello Fabric world!"); | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,15 @@ | |||
| package net.fabricmc.example.mixin; | ||||
| 
 | ||||
| import net.minecraft.client.gui.screen.TitleScreen; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| 
 | ||||
| @Mixin(TitleScreen.class) | ||||
| public class ExampleMixin { | ||||
| 	@Inject(at = @At("HEAD"), method = "init()V") | ||||
| 	private void init(CallbackInfo info) { | ||||
| 		System.out.println("This line is printed by an example mod mixin!"); | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,36 @@ | |||
| { | ||||
|   "schemaVersion": 1, | ||||
|   "id": "modid", | ||||
|   "version": "${version}", | ||||
| 
 | ||||
|   "name": "Example Mod", | ||||
|   "description": "This is an example description! Tell everyone what your mod is about!", | ||||
|   "authors": [ | ||||
|     "Me!" | ||||
|   ], | ||||
|   "contact": { | ||||
|     "homepage": "https://fabricmc.net/", | ||||
|     "sources": "https://github.com/FabricMC/fabric-example-mod" | ||||
|   }, | ||||
| 
 | ||||
|   "license": "CC0-1.0", | ||||
| 
 | ||||
|   "environment": "*", | ||||
|   "entrypoints": { | ||||
|     "main": [ | ||||
|       "net.fabricmc.example.ExampleMod" | ||||
|     ] | ||||
|   }, | ||||
|   "mixins": [ | ||||
|     "modid.mixins.json" | ||||
|   ], | ||||
| 
 | ||||
|   "depends": { | ||||
|     "fabricloader": ">=0.7.4", | ||||
|     "fabric": "*", | ||||
|     "minecraft": "1.16.x" | ||||
|   }, | ||||
|   "suggests": { | ||||
|     "another-mod": "*" | ||||
|   } | ||||
| } | ||||
|  | @ -0,0 +1,14 @@ | |||
| { | ||||
|   "required": true, | ||||
|   "minVersion": "0.8", | ||||
|   "package": "net.fabricmc.example.mixin", | ||||
|   "compatibilityLevel": "JAVA_8", | ||||
|   "mixins": [ | ||||
|   ], | ||||
|   "client": [ | ||||
|     "ExampleMixin" | ||||
|   ], | ||||
|   "injectors": { | ||||
|     "defaultRequire": 1 | ||||
|   } | ||||
| } | ||||
		Loading…
	
		Reference in a new issue