update FactorioModPlugin
This commit is contained in:
parent
71422218aa
commit
c81564ad6c
2 changed files with 44 additions and 22 deletions
|
|
@ -1,22 +0,0 @@
|
||||||
package dev.adamko.factorio_gradle
|
|
||||||
|
|
||||||
import org.gradle.api.Plugin
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.kotlin.dsl.create
|
|
||||||
|
|
||||||
abstract class FactorioModPlugin : Plugin<Project> {
|
|
||||||
|
|
||||||
override fun apply(target: Project) {
|
|
||||||
target.createSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Project.createSettings(): FactorioModSettings {
|
|
||||||
return extensions.create<FactorioModSettings>(FACTORIO_GRADLE_EXTENSION_NAME).apply {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val FACTORIO_GRADLE_EXTENSION_NAME = "factorio"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package dev.adamko.gradle.factorio
|
||||||
|
|
||||||
|
import javax.inject.Inject
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.model.ObjectFactory
|
||||||
|
import org.gradle.kotlin.dsl.create
|
||||||
|
|
||||||
|
|
||||||
|
abstract class FactorioModPlugin @Inject constructor(
|
||||||
|
private val objects: ObjectFactory,
|
||||||
|
) : Plugin<Project> {
|
||||||
|
|
||||||
|
override fun apply(target: Project) {
|
||||||
|
target.createSettings()
|
||||||
|
|
||||||
|
|
||||||
|
val factorioModConfiguration =
|
||||||
|
target.configurations.register(FACTORIO_GRADLE_CONFIGURATION_NAME) {
|
||||||
|
asConsumer()
|
||||||
|
factorioModAttributes(objects)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Project.createSettings(): FactorioModSettings {
|
||||||
|
return extensions.create<FactorioModSettings>(FACTORIO_GRADLE_EXTENSION_NAME).apply {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val FACTORIO_GRADLE_EXTENSION_NAME = "factorioMod"
|
||||||
|
const val FACTORIO_GRADLE_CONFIGURATION_NAME = "factorioMod"
|
||||||
|
|
||||||
|
const val TASK_GROUP = "factorioMod"
|
||||||
|
|
||||||
|
/** Lifecycle task for publishing the mod locally */
|
||||||
|
const val PUBLISH_MOD_LOCAL_TASK_NAME = "publishModLocal"
|
||||||
|
|
||||||
|
const val PUBLISH_MOD_TASK_NAME = "publishMod"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue