mirror of
https://github.com/architectury/architectury-plugin.git
synced 2026-03-28 04:07:01 -05:00
Arch Plugin 3.5
This commit is contained in:
1
.github/workflows/gradle.yml
vendored
1
.github/workflows/gradle.yml
vendored
@@ -6,6 +6,7 @@ on:
|
||||
- master
|
||||
- 3.3
|
||||
- 3.4
|
||||
- 3.5
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
15
build.gradle
15
build.gradle
@@ -1,7 +1,7 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm" version "1.6.10"
|
||||
id "org.jetbrains.kotlin.jvm" version "2.2.20"
|
||||
id "java"
|
||||
id "idea"
|
||||
id "eclipse"
|
||||
@@ -84,6 +84,14 @@ sourceSets {
|
||||
runtimeClasspath += main.output
|
||||
}
|
||||
}
|
||||
loom114 {
|
||||
java {
|
||||
compileClasspath += main.compileClasspath
|
||||
runtimeClasspath += main.runtimeClasspath
|
||||
compileClasspath += main.output
|
||||
runtimeClasspath += main.output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -100,6 +108,7 @@ dependencies {
|
||||
loom011CompileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10"
|
||||
loom011CompileOnly "org.jetbrains.kotlin:kotlin-reflect:1.5.10"
|
||||
loom11CompileOnly "dev.architectury:architectury-loom:$loom_version_11"
|
||||
loom114CompileOnly "dev.architectury:architectury-loom:$loom_version_114"
|
||||
implementation "dev.architectury:tiny-remapper:1.1.0"
|
||||
implementation "com.google.code.gson:gson:2.8.5"
|
||||
}
|
||||
@@ -107,7 +116,7 @@ dependencies {
|
||||
tasks.withType(KotlinCompile) {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs = ['-Xjvm-default=compatibility']
|
||||
freeCompilerArgs = ['-Xjvm-default=all-compatibility']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +125,7 @@ jar {
|
||||
attributes 'Implementation-Version': project.version
|
||||
}
|
||||
|
||||
from sourceSets.loom06.output + sourceSets.loom09.output + sourceSets.loom010Legacy.output + sourceSets.loom010.output + sourceSets.loom011.output + sourceSets.loom11.output
|
||||
from sourceSets.loom06.output + sourceSets.loom09.output + sourceSets.loom010Legacy.output + sourceSets.loom010.output + sourceSets.loom011.output + sourceSets.loom11.output + sourceSets.loom114.output
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
|
||||
@@ -5,5 +5,6 @@ loom_version_010Legacy=0.10.0.171
|
||||
loom_version_010=0.10.0.188
|
||||
loom_version_011=0.11.0.217
|
||||
loom_version_11=1.1.313
|
||||
transformer_version=5.2.87
|
||||
base_version=3.4
|
||||
loom_version_114=1.14.471
|
||||
transformer_version=5.2.89
|
||||
base_version=3.5
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package dev.architectury.plugin.loom
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension
|
||||
import net.fabricmc.loom.build.mixin.AnnotationProcessorInvoker
|
||||
import net.fabricmc.loom.configuration.ide.RunConfig
|
||||
import net.fabricmc.loom.task.RemapJarTask
|
||||
import net.fabricmc.loom.util.gradle.GradleUtils
|
||||
import net.fabricmc.loom.util.gradle.SourceSetHelper
|
||||
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 LoomInterface114(private val project: Project) : LoomInterface {
|
||||
private val extension: LoomGradleExtension
|
||||
get() = LoomGradleExtension.get(project)
|
||||
|
||||
override val allMixinMappings: Collection<File>
|
||||
get() {
|
||||
val files = mutableListOf<File>()
|
||||
GradleUtils.allLoomProjects(project.gradle) { project: Project ->
|
||||
val extension = LoomGradleExtension.get(project)
|
||||
if (!this.extension.mappingConfiguration.mappingsIdentifier.equals(extension.mappingConfiguration.mappingsIdentifier)) {
|
||||
// Only find mixin mappings that are from other projects with the same mapping id.
|
||||
return@allLoomProjects
|
||||
}
|
||||
for (sourceSet in SourceSetHelper.getSourceSets(project)) {
|
||||
val mixinMappings: File = AnnotationProcessorInvoker.getMixinMappingsForSourceSet(project, sourceSet)
|
||||
if (!mixinMappings.exists()) {
|
||||
continue
|
||||
}
|
||||
files.add(mixinMappings)
|
||||
}
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
override val tinyMappingsWithSrg: Path
|
||||
get() = extension.mappingConfiguration.tinyMappingsWithSrg
|
||||
|
||||
override val refmapName: String
|
||||
get() = extension.mixin.defaultRefmapName.get()
|
||||
|
||||
override var generateSrgTiny: Boolean
|
||||
get() = extension.shouldGenerateSrgTiny()
|
||||
set(value) {
|
||||
extension.setGenerateSrgTiny(value)
|
||||
}
|
||||
|
||||
override val legacyMixinApEnabled: Boolean
|
||||
get() = extension.mixin.useLegacyMixinAp.get()
|
||||
|
||||
|
||||
override val addRefmapForForge: Boolean
|
||||
// Awful hack to check if the version >= 1.20.5, we don't get any info of forge version in common
|
||||
get() = !extension.minecraftProvider.versionInfo.isVersionOrNewer("2024-04-23T00:00:00+00:00")
|
||||
|
||||
override val generateTransformerPropertiesInTask = true
|
||||
|
||||
override val disableObfuscation: Boolean
|
||||
get() = extension.disableObfuscation()
|
||||
|
||||
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 fun addVmArg(vmArg: String) {
|
||||
config.vmArgs.add(vmArg)
|
||||
}
|
||||
|
||||
override fun escape(arg: String): String = arg
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import java.util.jar.JarOutputStream
|
||||
import java.util.jar.Manifest
|
||||
|
||||
open class ArchitectPluginExtension(val project: Project) {
|
||||
var transformerVersion = "5.2.87"
|
||||
var transformerVersion = "5.2.89"
|
||||
var injectablesVersion = "1.0.10"
|
||||
var minecraft = ""
|
||||
private var compileOnly = false
|
||||
@@ -100,7 +100,6 @@ open class ArchitectPluginExtension(val project: Project) {
|
||||
|
||||
fun properties(platform: String): Map<String, String> {
|
||||
val map = mutableMapOf(
|
||||
BuiltinProperties.MIXIN_MAPPINGS to loom.allMixinMappings.joinToString(File.pathSeparator),
|
||||
BuiltinProperties.INJECT_INJECTABLES to injectInjectables.toString(),
|
||||
BuiltinProperties.UNIQUE_IDENTIFIER to project.projectUniqueIdentifier(),
|
||||
BuiltinProperties.COMPILE_CLASSPATH to getCompileClasspath().joinToString(File.pathSeparator),
|
||||
@@ -115,8 +114,14 @@ open class ArchitectPluginExtension(val project: Project) {
|
||||
map[BuiltinProperties.REFMAP_NAME] = loom.refmapName
|
||||
}
|
||||
|
||||
if (!loom.disableObfuscation) {
|
||||
map[BuiltinProperties.MAPPINGS_WITH_SRG] = loom.tinyMappingsWithSrg.toString()
|
||||
}
|
||||
}
|
||||
|
||||
if (!loom.disableObfuscation) {
|
||||
map[BuiltinProperties.MIXIN_MAPPINGS] = loom.allMixinMappings.joinToString(File.pathSeparator)
|
||||
}
|
||||
|
||||
return map
|
||||
}
|
||||
@@ -442,7 +447,7 @@ open class ArchitectPluginExtension(val project: Project) {
|
||||
transformProductionTask.get().archiveFile.get().asFile.takeUnless { it.exists() }?.createEmptyJar()
|
||||
}
|
||||
|
||||
val remapJarTask = project.tasks.getByName("remapJar") {
|
||||
project.tasks.findByName("remapJar")?.also {
|
||||
it as Jar
|
||||
|
||||
it.archiveClassifier.set("")
|
||||
@@ -464,7 +469,7 @@ open class ArchitectPluginExtension(val project: Project) {
|
||||
}
|
||||
}
|
||||
})
|
||||
} as Jar
|
||||
}
|
||||
}
|
||||
|
||||
fun forgeLike(action: Action<CommonSettings>) {
|
||||
|
||||
@@ -41,8 +41,8 @@ open class ModLoader(
|
||||
}
|
||||
this += TransformPlatformOnly::class.java
|
||||
},
|
||||
transformProduction = { _, settings ->
|
||||
this += RemapMixinVariables()
|
||||
transformProduction = { loom, settings ->
|
||||
if (!loom.disableObfuscation) this += RemapMixinVariables()
|
||||
add(TransformExpectPlatform()) { file ->
|
||||
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
|
||||
settings.platformPackages[valueOf("fabric")]?.let { platformPackage ->
|
||||
@@ -170,8 +170,8 @@ open class ModLoader(
|
||||
this += TransformPlatformOnly::class.java
|
||||
envAnnotationProvider = "org.quiltmc:quilt-loader:+"
|
||||
},
|
||||
transformProduction = { _, settings ->
|
||||
this += RemapMixinVariables()
|
||||
transformProduction = { loom, settings ->
|
||||
if (!loom.disableObfuscation) this += RemapMixinVariables()
|
||||
add(TransformExpectPlatform()) { file ->
|
||||
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
|
||||
settings.platformPackages[valueOf("quilt")]?.let { platformPackage ->
|
||||
|
||||
@@ -26,6 +26,9 @@ interface LoomInterface {
|
||||
}
|
||||
|
||||
return useIfFound(
|
||||
"net.fabricmc.loom.util.service.ServiceType",
|
||||
"dev.architectury.plugin.loom.LoomInterface114" // 1.14
|
||||
) ?: useIfFound(
|
||||
"net.fabricmc.loom.util.service.ScopedServiceFactory",
|
||||
"dev.architectury.plugin.loom.LoomInterface11" // 1.8
|
||||
) ?: useIfFound(
|
||||
@@ -48,11 +51,12 @@ interface LoomInterface {
|
||||
}
|
||||
|
||||
val allMixinMappings: Collection<File>
|
||||
val tinyMappingsWithSrg: Path
|
||||
val tinyMappingsWithSrg: Path?
|
||||
val refmapName: String
|
||||
var generateSrgTiny: Boolean
|
||||
val legacyMixinApEnabled: Boolean get() = false
|
||||
val addRefmapForForge: Boolean get() = true
|
||||
val disableObfuscation: Boolean get() = false
|
||||
|
||||
/**
|
||||
* Loom 0.11+ has to generate the runtime transformer properties file
|
||||
|
||||
Reference in New Issue
Block a user