project re-organisation, and rename

This commit is contained in:
Adam 2021-12-01 16:57:46 +01:00
parent 53862ef1b5
commit 633e898f3c
52 changed files with 525 additions and 387 deletions

View file

@ -8,9 +8,6 @@ plugins {
group = "${rootProject.group}.${project.name}"
version = rootProject.version
val projectId by extra("fwm-${project.name}")
//val modBuildDir by extra(layout.buildDirectory.dir(projectId).get())
val licenseFile: RegularFile by extra(rootProject.layout.projectDirectory.file("LICENSE"))
val tokens: Map<String, String> by extra(

View file

@ -0,0 +1,23 @@
package dev.adamko.factoriowebmap.archetype
plugins {
id("dev.adamko.factoriowebmap.archetype.base")
}
val processRunnerTaskGroup: String by extra("processes")
val processRun by tasks.registering {
group = processRunnerTaskGroup
}
val processKill by tasks.registering {
group = processRunnerTaskGroup
}
val processRestart by tasks.registering {
group = processRunnerTaskGroup
processKill.get().state
dependsOn(processKill)
finalizedBy(processRun)
}

View file

@ -0,0 +1,20 @@
package dev.adamko.factoriowebmap.configurations
import org.gradle.api.artifacts.Configuration
import org.gradle.api.attributes.AttributeContainer
import org.gradle.api.attributes.Bundling
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.named
fun Configuration.factorioModAttributes(objects: ObjectFactory) =
attributes { factorioMod(objects) }
fun AttributeContainer.factorioMod(objects: ObjectFactory) {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("factorio"))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.CLASSES_AND_RESOURCES))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EMBEDDED))
}

View file

@ -0,0 +1,21 @@
package dev.adamko
import java.io.ByteArrayOutputStream
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.specs.Spec
import org.gradle.kotlin.dsl.invoke
operator fun <T> Spec<T>.not(): Spec<T> = Spec<T> { !this(it) }
fun Project.isProcessRunning(process: String, ignoreCase: Boolean = true): Spec<Task> =
Spec<Task> {
ByteArrayOutputStream().use { outputStream ->
project.exec {
commandLine("tasklist")
standardOutput = outputStream
}
outputStream.toString()
.contains(process, ignoreCase)
}
}