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

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

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"
}

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

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

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

java {
	withSourcesJar()
}

publishing {
	publications {
		mavenJava(MavenPublication) {
			from components.java
			artifact(remapJar) {
				builtBy remapJar
				classifier "classifier"
			}
		}
	}

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

signing {
	def privateKey = System.getProperty("loom.test.secretKey") ?: "no key!"
	useInMemoryPgpKeys(privateKey, 'password')
	sign publishing.publications.mavenJava
}
