aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-02-05 22:55:27 +0100
committernea <nea@nea.moe>2023-02-05 22:55:27 +0100
commitea0d8c2c85e29f84ac59b86e20b6a7546db63dd8 (patch)
tree77c9bf3653aa0362170d2b10c4acaf6346d46ef4 /buildSrc/src
parenta321287e85fb577745647d12049fc1d24997717c (diff)
parentd0f024a0cd2525bc4a79308c4f7275ea2a308ab2 (diff)
downloadNotEnoughUpdates-ea0d8c2c85e29f84ac59b86e20b6a7546db63dd8.tar.gz
NotEnoughUpdates-ea0d8c2c85e29f84ac59b86e20b6a7546db63dd8.tar.bz2
NotEnoughUpdates-ea0d8c2c85e29f84ac59b86e20b6a7546db63dd8.zip
Merge remote-tracking branch 'origin/master' into museumthing
Diffstat (limited to 'buildSrc/src')
-rw-r--r--buildSrc/src/main/kotlin/neubs/buildflags.kt23
1 files changed, 11 insertions, 12 deletions
diff --git a/buildSrc/src/main/kotlin/neubs/buildflags.kt b/buildSrc/src/main/kotlin/neubs/buildflags.kt
index 6b7ab489..27c4bbcf 100644
--- a/buildSrc/src/main/kotlin/neubs/buildflags.kt
+++ b/buildSrc/src/main/kotlin/neubs/buildflags.kt
@@ -19,8 +19,13 @@
package neubs
+import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
+import org.gradle.api.file.RegularFileProperty
+import org.gradle.api.provider.MapProperty
+import org.gradle.api.tasks.*
+import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.the
import java.nio.charset.StandardCharsets
import java.util.*
@@ -28,22 +33,16 @@ import java.util.*
const val NEU_BUILDFLAGS_PREFIX = "neu.buildflags."
class NEUBuildFlags : Plugin<Project> {
+
override fun apply(target: Project) {
val props =
target.properties.filterKeys { it.startsWith(NEU_BUILDFLAGS_PREFIX) }.mapValues { it.value as String }
target.extensions.add("buildflags", Extension(props))
- target.tasks.create("generateBuildFlags") {
- outputs.upToDateWhen { false }
- val t = target.layout.buildDirectory.file("buildflags.properties")
- outputs.file(t)
- doLast {
- val p = Properties()
- p.putAll(props)
- t.get().asFile.writer(StandardCharsets.UTF_8).use {
- p.store(it, "Store build time configuration for NEU")
- }
- }
-
+ target.tasks.create<WriteProperties>("generateBuildFlags") {
+ this.encoding = StandardCharsets.UTF_8.name()
+ this.setProperties(props)
+ this.comment = "Store build time configuration for NEU"
+ this.setOutputFile(target.layout.buildDirectory.file("buildflags.properties"))
}
}