plugins {
	id 'dev.architectury.loom'
	id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

loom {
	mixin {
		useLegacyMixinAp = true
	}
}

dependencies {
	minecraft "com.mojang:minecraft:${project.minecraft_version}"
	mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
}

base {
	archivesName = project.archives_base_name
}

processResources {
	def version = project.version
	inputs.property "version", version

	filesMatching("fabric.mod.json") {
		expand "version": version
	}
}

tasks.withType(JavaCompile).configureEach {
	it.options.encoding = "UTF-8"

	def targetVersion = 8
	if (JavaVersion.current().isJava9Compatible()) {
		it.options.release = targetVersion
	}
}

java {
	withSourcesJar()

	sourceCompatibility = JavaVersion.VERSION_1_8
	targetCompatibility = JavaVersion.VERSION_1_8
}

jar {
	def archivesName = base.archivesName.get()
	from("LICENSE") {
		rename { "${it}_${archivesName}"}
	}
}

remapSourcesJar {
	preserveFileTimestamps = false
	reproducibleFileOrder = true
}