[build] Utilize jf.codegen to replace manual file creation

This commit is contained in:
Johannes Frohnmeyer 2022-10-13 19:37:55 +02:00
parent 5459a313c2
commit 6bc0209815
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 9 additions and 7 deletions

View File

@ -1 +0,0 @@
src/main/java/io/gitlab/jfronny/libjf/config/plugin/BuildMetadata.java

View File

@ -3,6 +3,7 @@ import io.gitlab.jfronny.scripts.*
plugins {
id("java-gradle-plugin")
id("jf.maven-publish")
id("jf.codegen")
}
group = rootProject.group
@ -38,10 +39,12 @@ gradlePlugin {
tasks.publish.get().dependsOn(tasks.build.get())
rootProject.tasks.deployDebug.dependsOn(tasks.publish.get())
projectDir.resolve("src/main/java/io/gitlab/jfronny/libjf/config/plugin/BuildMetadata.java").writeText("""
package io.gitlab.jfronny.libjf.config.plugin;
public class BuildMetadata {
public static final boolean isRelease = ${project.hasProperty("release")};
sourceSets {
main {
generate(project) {
`class`("io.gitlab.jfronny.libjf.config.plugin", "BuildMetadata") {
field("IS_RELEASE", project.hasProperty("release"), "public static final")
}
}
}
""".trimIndent())
}