mirror of
https://github.com/architectury/architectury-plugin.git
synced 2026-03-28 04:07:01 -05:00
Add support for Loom 0.10
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
15
build.gradle
15
build.gradle
@@ -52,6 +52,14 @@ sourceSets {
|
|||||||
runtimeClasspath += main.output
|
runtimeClasspath += main.output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loom010 {
|
||||||
|
java {
|
||||||
|
compileClasspath += main.compileClasspath
|
||||||
|
runtimeClasspath += main.runtimeClasspath
|
||||||
|
compileClasspath += main.output
|
||||||
|
runtimeClasspath += main.output
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -60,8 +68,9 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72"
|
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72"
|
||||||
implementation "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.10"
|
implementation "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.10"
|
||||||
implementation "dev.architectury:architectury-transformer:$transformer_version"
|
implementation "dev.architectury:architectury-transformer:$transformer_version"
|
||||||
loom06CompileOnly "me.shedaniel:forgified-fabric-loom:$loom_version_old"
|
loom06CompileOnly "me.shedaniel:forgified-fabric-loom:$loom_version_06"
|
||||||
loom09CompileOnly "dev.architectury:architectury-loom:$loom_version_new"
|
loom09CompileOnly "dev.architectury:architectury-loom:$loom_version_09"
|
||||||
|
loom010CompileOnly "dev.architectury:architectury-loom:$loom_version_010"
|
||||||
implementation "dev.architectury:tiny-remapper:1.1.0"
|
implementation "dev.architectury:tiny-remapper:1.1.0"
|
||||||
implementation "com.google.code.gson:gson:2.8.5"
|
implementation "com.google.code.gson:gson:2.8.5"
|
||||||
}
|
}
|
||||||
@@ -78,7 +87,7 @@ jar {
|
|||||||
attributes 'Implementation-Version': project.version
|
attributes 'Implementation-Version': project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from sourceSets.loom06.output + sourceSets.loom09.output
|
from sourceSets.loom06.output + sourceSets.loom09.output + sourceSets.loom010.output
|
||||||
}
|
}
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
loom_version_old=0.6.96
|
loom_version_06=0.6.96
|
||||||
loom_version_new=0.9.0.158
|
loom_version_09=0.9.0.158
|
||||||
|
loom_version_010=0.10.0.171
|
||||||
transformer_version=5.1.55
|
transformer_version=5.1.55
|
||||||
base_version=3.4
|
base_version=3.4
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package dev.architectury.plugin.loom
|
||||||
|
|
||||||
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
|
import net.fabricmc.loom.configuration.ide.RunConfig
|
||||||
|
import net.fabricmc.loom.task.RemapJarTask
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.file.RegularFile
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
|
import org.gradle.jvm.tasks.Jar
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.file.Path
|
||||||
|
import java.util.function.Consumer
|
||||||
|
|
||||||
|
class LoomInterface010(private val project: Project) : LoomInterface {
|
||||||
|
private val extension: LoomGradleExtension
|
||||||
|
get() = LoomGradleExtension.get(project)
|
||||||
|
|
||||||
|
override val allMixinMappings: Collection<File>
|
||||||
|
get() = extension.allMixinMappings
|
||||||
|
|
||||||
|
override val tinyMappingsWithSrg: Path
|
||||||
|
get() = extension.mappingsProvider.tinyMappingsWithSrg
|
||||||
|
|
||||||
|
override val refmapName: String
|
||||||
|
get() = extension.mixin.defaultRefmapName.get()
|
||||||
|
|
||||||
|
override var generateSrgTiny: Boolean
|
||||||
|
get() = extension.shouldGenerateSrgTiny()
|
||||||
|
set(value) {
|
||||||
|
extension.setGenerateSrgTiny(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun settingsPostEdit(action: (config: LoomInterface.LoomRunConfig) -> Unit) {
|
||||||
|
extension.settingsPostEdit.add(Consumer { c -> action(LoomRunConfigImpl(c)) })
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setIdeConfigGenerated() {
|
||||||
|
extension.runConfigs.forEach { it.isIdeConfigGenerated = true }
|
||||||
|
extension.runConfigs.whenObjectAdded { it.isIdeConfigGenerated = true }
|
||||||
|
extension.addTaskBeforeRun("\$PROJECT_DIR\$/${project.name}:classes")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setRemapJarInput(task: Jar, archiveFile: Provider<RegularFile>) {
|
||||||
|
task as RemapJarTask
|
||||||
|
task.input.set(archiveFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoomRunConfigImpl(private val config: RunConfig) : LoomInterface.LoomRunConfig {
|
||||||
|
override var mainClass: String
|
||||||
|
get() = config.mainClass
|
||||||
|
set(value) {
|
||||||
|
config.mainClass = value
|
||||||
|
}
|
||||||
|
|
||||||
|
override var vmArgs: String
|
||||||
|
get() = config.vmArgs
|
||||||
|
set(value) {
|
||||||
|
config.vmArgs = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,14 +58,21 @@ open class ArchitectPluginExtension(val project: Project) {
|
|||||||
|
|
||||||
private val loom: LoomInterface by lazy {
|
private val loom: LoomInterface by lazy {
|
||||||
try {
|
try {
|
||||||
Class.forName("net.fabricmc.loom.api.LoomGradleExtensionAPI")
|
Class.forName("net.fabricmc.loom.api.MixinExtensionAPI")
|
||||||
return@lazy Class.forName("dev.architectury.plugin.loom.LoomInterface09")
|
return@lazy Class.forName("dev.architectury.plugin.loom.LoomInterface010")
|
||||||
.getDeclaredConstructor(Project::class.java)
|
.getDeclaredConstructor(Project::class.java)
|
||||||
.newInstance(project) as LoomInterface
|
.newInstance(project) as LoomInterface
|
||||||
} catch (ignored: ClassNotFoundException) {
|
} catch (ignored: ClassNotFoundException) {
|
||||||
return@lazy Class.forName("dev.architectury.plugin.loom.LoomInterface06")
|
try {
|
||||||
.getDeclaredConstructor(Project::class.java)
|
Class.forName("net.fabricmc.loom.api.LoomGradleExtensionAPI")
|
||||||
.newInstance(project) as LoomInterface
|
return@lazy Class.forName("dev.architectury.plugin.loom.LoomInterface09")
|
||||||
|
.getDeclaredConstructor(Project::class.java)
|
||||||
|
.newInstance(project) as LoomInterface
|
||||||
|
} catch (ignored: ClassNotFoundException) {
|
||||||
|
return@lazy Class.forName("dev.architectury.plugin.loom.LoomInterface06")
|
||||||
|
.getDeclaredConstructor(Project::class.java)
|
||||||
|
.newInstance(project) as LoomInterface
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user