Move subprojects block into buildSrc

This commit is contained in:
ah-OOG-ah committed 2025-06-20 11:46:48 -04:00
1 parent d0b94d165a
commit 5c92143878
3 files changed
+105 -101

No files matched your search

+1 -101
View File
@@ -1,114 +1,14 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.kotlin.dsl.filter
import xyz.wagyourtail.unimined.api.unimined
// The previous buildscript was spaghetti
// Time will tell if I do better.
// First, we need the mixin module, which means we need Unimixins!
plugins {
id("java")
id("xyz.wagyourtail.unimined") version "1.3.14" apply false
id("com.palantir.git-version") version "3.3.0" apply false
}
// Mod properties
val modid = "unimixins"
group = "io.github.legacymoddingmc"
// Forge properties
val minecraft_version = "1.7.10"
val forge_version = "10.13.4.1614-1.7.10"
subprojects {
apply(plugin = "java")
apply(plugin = "xyz.wagyourtail.unimined")
apply(plugin = "com.palantir.git-version")
apply(plugin = "com.gradleup.shadow")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
dependencies {
// TODO only include IFMLLoadingPlugin, Mod and ComparableVersion
compileOnly("net.minecraftforge:forge:1.12.2-14.23.5.2860:universal")
}
fun getVersion(): String {
val override = System.getenv("VERSION")
if (override != null) {
print("VERSION set! Overriding version to $override")
return override
}
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
// If it exists, grab the last tag. Otherwise it is UNKNOWN
val details = versionDetails()
var ret = details.lastTag
if (details.commitDistance > 0) ret += "-${details.commitDistance}-${details.gitHash}"
if (!details.isCleanTag) ret += "-dirty"
return ret
}
version = getVersion()
base.archivesName = "+unimixins${ if (project.name == "all") "" else "-${project.name}" }-1.7.10"
val generated by sourceSets.creating
val genDir = layout.buildDirectory.file("genResources")
generated.resources.srcDir(genDir)
val generateEmbeddedCorePluginFile by tasks.registering {
if (ext.has("FMLCorePlugin")) {
val corePlugin = ext.get("FMLCorePlugin") as String
val dir = File(genDir.get().asFile, "META-INF")
dir.mkdirs()
val embeddedCorePluginFile =
File(dir, "EmbeddedFMLCorePlugins.txt")
embeddedCorePluginFile.writeText(corePlugin)
}
}
tasks.processResources {
dependsOn(generateEmbeddedCorePluginFile)
files("mcmod.info") {
filter<ReplaceTokens>("tokens" to mapOf(
"minecraftVersion" to minecraft_version,
"uniMixinsVersion" to version.toString(),
"projectUrl" to "https://github.com/LegacyModdingMC/UniMixins"
))
}
}
tasks.named<ShadowJar>("shadowJar") {
from(generated.resources)
if (ext.has("FMLCorePlugin")) {
manifest {
"FMLCorePlugin" to ext.get("FMLCorePlugin")
}
}
}
unimined.minecraft(sourceSets.main.get(), true) {
version = minecraft_version
mappings {
searge()
mcp("stable", "12-1.7.10")
}
minecraftForge {
loader(forge_version)
}
}
apply(plugin = "unimixins")
}
+6
View File
@@ -5,9 +5,15 @@ plugins {
repositories {
gradlePluginPortal()
maven {
url = uri("https://maven.wagyourtail.xyz/releases")
}
}
dependencies {
implementation("xyz.wagyourtail.unimined:xyz.wagyourtail.unimined.gradle.plugin:1.3.14")
implementation("com.palantir.git-version:com.palantir.git-version.gradle.plugin:3.3.0")
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.6")
implementation("com.google.code.gson:gson:2.13.1")
implementation("org.apache.ant:ant:1.10.15")
@@ -0,0 +1,98 @@
import org.apache.tools.ant.filters.ReplaceTokens
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("java")
id("xyz.wagyourtail.unimined")
id("com.palantir.git-version")
id("com.gradleup.shadow")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
dependencies {
// TODO only include IFMLLoadingPlugin, Mod and ComparableVersion
compileOnly("net.minecraftforge:forge:1.12.2-14.23.5.2860:universal")
}
// Forge properties
val minecraft_version = "1.7.10"
val forge_version = "10.13.4.1614-1.7.10"
fun getVersion(): String {
val override = System.getenv("VERSION")
if (override != null) {
print("VERSION set! Overriding version to $override")
return override
}
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
// If it exists, grab the last tag. Otherwise it is UNKNOWN
val details = versionDetails()
var ret = details.lastTag
if (details.commitDistance > 0) ret += "-${details.commitDistance}-${details.gitHash}"
if (!details.isCleanTag) ret += "-dirty"
return ret
}
version = getVersion()
base.archivesName = "+unimixins${ if (project.name == "all") "" else "-${project.name}" }-1.7.10"
val generated by sourceSets.creating
val genDir = layout.buildDirectory.file("genResources")
generated.resources.srcDir(genDir)
val generateEmbeddedCorePluginFile by tasks.registering {
if (ext.has("FMLCorePlugin")) {
val corePlugin = ext.get("FMLCorePlugin") as String
val dir = File(genDir.get().asFile, "META-INF")
dir.mkdirs()
val embeddedCorePluginFile =
File(dir, "EmbeddedFMLCorePlugins.txt")
embeddedCorePluginFile.writeText(corePlugin)
}
}
tasks.processResources {
dependsOn(generateEmbeddedCorePluginFile)
files("mcmod.info") {
filter<ReplaceTokens>("tokens" to mapOf(
"minecraftVersion" to minecraft_version,
"uniMixinsVersion" to version.toString(),
"projectUrl" to "https://github.com/LegacyModdingMC/UniMixins"
))
}
}
tasks.named<ShadowJar>("shadowJar") {
from(generated.resources)
if (ext.has("FMLCorePlugin")) {
manifest {
"FMLCorePlugin" to ext.get("FMLCorePlugin")
}
}
}
unimined.minecraft(sourceSets.main.get(), true) {
version = minecraft_version
mappings {
searge()
mcp("stable", "12-1.7.10")
}
minecraftForge {
loader(forge_version)
}
}