plugins {
	id 'fabric-loom'
	id 'maven-publish'
}

version = "1.0.0"
group = "com.example"

repositories {
	maven {
		url = "http://localhost:${System.getProperty("loom.test.mavenPort")}/"
		allowInsecureProtocol = true
	}
}

configurations {
	testConfig
	modImplementation.extendsFrom testConfig
}

dependencies {
	minecraft "com.mojang:minecraft:1.16.5"
	mappings "net.fabricmc:yarn:1.16.5+build.5:v2"
	modImplementation "net.fabricmc:fabric-loader:0.11.2"

	testConfig System.getProperty("loom.test.resolve")
}

base {
	archivesName = "fabric-example-mod"
}

afterEvaluate {
	// Check that only compileClasspath contains the biome API and only runtimeClasspath contains the command API.
	// See https://github.com/FabricMC/fabric-loom/issues/801.

	def compile = configurations.compileClasspath.resolve().collect { it.name }
	def runtime = configurations.runtimeClasspath.resolve().collect { it.name }

	if (!compile.any { it.contains('biome-api') }) {
		throw new RuntimeException('No biome API on compile classpath')
	}

	if (compile.any { it.contains('command-api') }) {
		throw new RuntimeException('Command API on compile classpath')
	}

	if (!runtime.any { it.contains('command-api') }) {
		throw new RuntimeException('No command API on runtime classpath')
	}

	if (runtime.any { it.contains('biome-api') }) {
		throw new RuntimeException('Biome API on runtime classpath')
	}
}
