ru.astrainteractive.gradleplugin.processor.platform.FabricResourceProcessor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minecraft Show documentation
Show all versions of minecraft Show documentation
GradlePlugin for my kotlin projects
The newest version!
package ru.astrainteractive.gradleplugin.processor.platform
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.kotlin.dsl.named
import org.gradle.language.jvm.tasks.ProcessResources
import ru.astrainteractive.gradleplugin.processor.core.ResourceProcessor
import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo
internal class FabricResourceProcessor(private val project: Project) : ResourceProcessor {
data class Info(
val version: String,
) : ResourceProcessor.ProcessorInfo
override fun getProcessorInfo(): Info {
val projectInfo = project.requireProjectInfo
return Info(
version = projectInfo.versionString,
)
}
override fun getDefaultProperties(): Map {
val processorInfo = getProcessorInfo()
return mapOf(
"version" to processorInfo.version
)
}
override fun process(
customProperties: Map,
configuration: ProcessResources.() -> Unit
) {
project.tasks.named("processResources") {
filteringCharset = "UTF-8"
duplicatesStrategy = DuplicatesStrategy.WARN
filesMatching("fabric.mod.json") {
expand(getDefaultProperties().plus(customProperties))
}
configuration.invoke(this)
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy