mirror of
https://github.com/LegacyModdingMC/UniMixins.git
synced 2026-10-26 14:34:00 +00:00
Rename buildSrc
Apparently, IntelliJ just *dies* when the plugin is in buildSrc, as opposed to a manually included build
This commit is contained in:
1 parent
22dc439dfd
commit
763020eec6
8 files changed
+61
-40
No files matched your search
@@ -0,0 +1,2 @@
|
||||
.gradle
|
||||
.idea
|
||||
@@ -1,11 +1,11 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version "2.1.21"
|
||||
`java-gradle-plugin`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
|
||||
maven {
|
||||
url = uri("https://maven.wagyourtail.xyz/releases")
|
||||
}
|
||||
@@ -18,3 +18,24 @@ dependencies {
|
||||
implementation("com.google.code.gson:gson:2.13.1")
|
||||
implementation("org.apache.ant:ant:1.10.15")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("unimixins") {
|
||||
id = "unimixins"
|
||||
implementationClass = "UniMixinsPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(21)
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = "UniMixinsPlugin"
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
|
||||
import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonNull
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import com.google.gson.JsonPrimitive
|
||||
import org.gradle.api.file.FileTreeElement
|
||||
import java.io.InputStreamReader
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonPrimitive
|
||||
import org.apache.tools.zip.ZipOutputStream
|
||||
import org.apache.tools.zip.ZipEntry
|
||||
import com.google.gson.JsonNull
|
||||
import org.gradle.api.logging.Logging
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ class McmodInfoMerger(private val parentModid: String) : Transformer {
|
||||
private val comparisonModid = "\"$parentModid\""
|
||||
|
||||
override fun canTransformResource(element: FileTreeElement?): Boolean {
|
||||
return targetFile.equals(element?.relativePath.toString(), ignoreCase = true)
|
||||
return targetFile == element?.relativePath.toString()
|
||||
}
|
||||
|
||||
override fun transform(context: TransformerContext?) {
|
||||
+25
-32
@@ -1,19 +1,16 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.palantir.gradle.gitversion.GitVersionCacheService
|
||||
import com.palantir.gradle.gitversion.VersionDetails
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.plugins.BasePluginExtension
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import com.palantir.gradle.gitversion.VersionDetails
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import xyz.wagyourtail.unimined.api.UniminedExtension
|
||||
import groovy.lang.Closure
|
||||
import java.io.File
|
||||
|
||||
class UniMixinsPlugin : Plugin<Project> {
|
||||
@@ -28,26 +25,23 @@ class UniMixinsPlugin : Plugin<Project> {
|
||||
val forgeVersion = "10.13.4.1614-1.7.10"
|
||||
|
||||
project.extensions.configure<JavaPluginExtension>("java") {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(8))
|
||||
it.sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
it.targetCompatibility = JavaVersion.VERSION_1_8
|
||||
it.toolchain {
|
||||
it.languageVersion.set(JavaLanguageVersion.of(8))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
project.dependencies {
|
||||
add("compileOnly", "net.minecraftforge:forge:1.12.2-14.23.5.2860:universal")
|
||||
}
|
||||
project.dependencies.add("compileOnly", "net.minecraftforge:forge:1.12.2-14.23.5.2860:universal")
|
||||
|
||||
val versionDetails: Closure<VersionDetails> by project.extra
|
||||
|
||||
project.version = getGitVersion(versionDetails)
|
||||
val gitVersionService = GitVersionCacheService.getSharedGitVersionCacheService(project)
|
||||
project.version = getGitVersion(gitVersionService.get().getVersionDetails(project.projectDir, null))
|
||||
project.group = "io.github.legacymoddingmc"
|
||||
|
||||
val nameSuffix = if (project.name == "all") "" else "-${project.name}"
|
||||
project.extensions.configure<BasePluginExtension>("base") {
|
||||
archivesName.set("+unimixins$nameSuffix-1.7.10")
|
||||
it.archivesName.set("+unimixins$nameSuffix-1.7.10")
|
||||
}
|
||||
|
||||
val sourceSets = project.extensions.getByName("sourceSets") as SourceSetContainer
|
||||
@@ -57,7 +51,7 @@ class UniMixinsPlugin : Plugin<Project> {
|
||||
generated.resources.srcDir(genDir)
|
||||
|
||||
val generateEmbeddedCorePluginFile = project.tasks.register("generateEmbeddedCorePluginFile") {
|
||||
doLast {
|
||||
it.doLast {
|
||||
if (project.hasProperty("FMLCorePlugin")) {
|
||||
val corePlugin = project.property("FMLCorePlugin") as String
|
||||
val dir = File(genDir.get().asFile, "META-INF")
|
||||
@@ -70,10 +64,10 @@ class UniMixinsPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
project.tasks.named("processResources", ProcessResources::class.java) {
|
||||
dependsOn(generateEmbeddedCorePluginFile)
|
||||
it.dependsOn(generateEmbeddedCorePluginFile)
|
||||
|
||||
from("mcmod.info") {
|
||||
filter(mapOf("tokens" to mapOf(
|
||||
it.from("mcmod.info") {
|
||||
it.filter(mapOf("tokens" to mapOf(
|
||||
"minecraftVersion" to minecraftVersion,
|
||||
"uniMixinsVersion" to project.version.toString(),
|
||||
"projectUrl" to "https://github.com/LegacyModdingMC/UniMixins")
|
||||
@@ -82,17 +76,17 @@ class UniMixinsPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
project.tasks.withType(ShadowJar::class.java).configureEach {
|
||||
from(generated.resources)
|
||||
it.from(generated.resources)
|
||||
|
||||
manifest {
|
||||
attributes(mapOf(
|
||||
it.manifest {
|
||||
it.attributes(mapOf(
|
||||
"FMLCorePlugin" to project.findProperty("FMLCorePlugin")
|
||||
).filterValues { it != null })
|
||||
}
|
||||
}
|
||||
|
||||
project.extensions.configure<UniminedExtension>("unimined") {
|
||||
minecraft(sourceSets.getByName("main"), true) {
|
||||
it.minecraft(sourceSets.getByName("main"), true) {
|
||||
version = minecraftVersion
|
||||
|
||||
mappings {
|
||||
@@ -107,17 +101,16 @@ class UniMixinsPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getGitVersion(versionDetails: Closure<VersionDetails>): String {
|
||||
private fun getGitVersion(versionDetails: VersionDetails): String {
|
||||
val override = System.getenv("VERSION")
|
||||
if (override != null) {
|
||||
println("VERSION set! Overriding version to $override")
|
||||
return override
|
||||
}
|
||||
|
||||
val details = versionDetails()
|
||||
var ret = details.lastTag
|
||||
if (details.commitDistance > 0) ret += "-${details.commitDistance}-${details.gitHash}"
|
||||
if (!details.isCleanTag) ret += "-dirty"
|
||||
var ret = versionDetails.lastTag
|
||||
if (versionDetails.commitDistance > 0) ret += "-${versionDetails.commitDistance}-${versionDetails.gitHash}"
|
||||
if (!versionDetails.isCleanTag) ret += "-dirty"
|
||||
return ret
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
// The previous buildscript was spaghetti
|
||||
// Time will tell if I do better.
|
||||
plugins {
|
||||
id("unimixins") apply false
|
||||
}
|
||||
|
||||
// See buildSrc/src/main/kotlin/UniMixinsPlugin for shared config logic.
|
||||
subprojects {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
implementation-class=UniMixinsPlugin
|
||||
@@ -22,6 +22,8 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
includeBuild("UniMixinsPlugin")
|
||||
}
|
||||
|
||||
rootProject.name = "UniMixins"
|
||||
|
||||
Reference in new issue
Block a user