plugins {
	id "java"
	id "java-library"
	id 'fabric-loom' apply false
}

allprojects {
	apply plugin: "fabric-loom"

	version = "1.0.0"

	tasks.withType(JavaCompile).configureEach {
		def targetVersion = 8
		if (JavaVersion.current().isJava9Compatible()) {
			it.options.release = targetVersion
		} else {
			sourceCompatibility = JavaVersion.toVersion(targetVersion)
			targetCompatibility = JavaVersion.toVersion(targetVersion)
		}

		it.options.encoding = "UTF-8"
	}

	dependencies {
		// To change the versions see the gradle.properties file
		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"

		modImplementation "net.fabricmc.fabric-api:fabric-api:0.31.0+1.16"
	}

	jar {
		archiveClassifier.set "dev"
	}

	java {
		withSourcesJar()
	}
}

loom {
	mods {
		core {
			sourceSet project(':core').sourceSets.main
		}
		example {
			sourceSet project(':example').sourceSets.main
		}
		root {
			sourceSet sourceSets.main
		}
	}
}

dependencies {
	afterEvaluate {
		subprojects.each {
			include project("${it.name}:")
		}
	}

	include fabricApi.module("fabric-api-base", "0.31.0+1.16")
}

base {
	archivesName = "multiproject"
}
version = "1.0.0"