add option to disable adding the build date to the jar manifest
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
This commit is contained in:
parent
78e7bdf68a
commit
3196b6db93
|
@ -7,7 +7,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "dev.frogmc"
|
||||
version = "0.0.1-alpha.30" + ("+local".takeUnless { project.hasProperty("FrogMCSnapshotsMavenPassword") } ?: "")
|
||||
version = "0.0.1-alpha.31" + ("+local".takeUnless { project.hasProperty("FrogMCSnapshotsMavenPassword") } ?: "")
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.nio.file.FileSystems
|
|||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.StandardCopyOption
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.io.path.*
|
||||
|
||||
|
||||
|
@ -179,7 +178,6 @@ class PhytotelmaPlugin : Plugin<Project> {
|
|||
Built-By: Phytotelma ${this.javaClass.`package`.implementationVersion}
|
||||
Target-Namespace: Mojmap
|
||||
Built-For: Minecraft ${data.minecraftVersion}
|
||||
Build-Date: ${LocalDateTime.now()}
|
||||
""".trimIndent()
|
||||
).plus(data.jarManifestProperties.entries.joinToString("\n") { it.key + ": " + it.value })
|
||||
manifest.writeLines(lines, StandardCharsets.UTF_8)
|
||||
|
|
12
src/main/kotlin/dev/frogmc/phytotelma/ext/BuildExtension.kt
Normal file
12
src/main/kotlin/dev/frogmc/phytotelma/ext/BuildExtension.kt
Normal file
|
@ -0,0 +1,12 @@
|
|||
package dev.frogmc.phytotelma.ext
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.provider.Property
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class BuildExtension @Inject constructor(project: Project, objects: ObjectFactory) {
|
||||
|
||||
val includeDate: Property<Boolean> = objects.property(Boolean::class.java).convention(true)
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package dev.frogmc.phytotelma.ext.datagen
|
||||
package dev.frogmc.phytotelma.ext
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.model.ObjectFactory
|
|
@ -1,6 +1,5 @@
|
|||
package dev.frogmc.phytotelma.ext
|
||||
|
||||
import dev.frogmc.phytotelma.ext.datagen.DatagenExtension
|
||||
import org.gradle.api.Action
|
||||
|
||||
@Suppress("unused")
|
||||
|
@ -13,4 +12,6 @@ interface PhytotelmaGradleExtension {
|
|||
fun froglib(action: Action<VersionConfiguration>)
|
||||
|
||||
fun datagen(action: Action<DatagenExtension>)
|
||||
|
||||
fun build(action: Action<BuildExtension>)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import dev.frogmc.phytotelma.Constants
|
|||
import dev.frogmc.phytotelma.ProjectStorage
|
||||
import dev.frogmc.phytotelma.VersionChecker
|
||||
import dev.frogmc.phytotelma.accesswidener.AccessWidener
|
||||
import dev.frogmc.phytotelma.ext.datagen.DatagenExtension
|
||||
import dev.frogmc.phytotelma.run.AssetDownloader
|
||||
import dev.frogmc.phytotelma.run.RunConfigGenerator
|
||||
import dev.frogmc.phytotelma.run.datagen.DatagenConfigGenerator
|
||||
|
@ -19,6 +18,7 @@ import org.gradle.api.model.ObjectFactory
|
|||
import org.gradle.api.plugins.JavaPlugin
|
||||
import java.nio.file.*
|
||||
import java.nio.file.attribute.BasicFileAttributes
|
||||
import java.time.LocalDateTime
|
||||
import java.util.function.Consumer
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.copyTo
|
||||
|
@ -168,4 +168,12 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
DatagenConfigGenerator.generate(project, conf)
|
||||
project.tasks.register("runDatagen", DatagenTask::class.java, conf)
|
||||
}
|
||||
|
||||
override fun build(action: Action<BuildExtension>) {
|
||||
val conf = objects.newInstance(BuildExtension::class.java)
|
||||
action.execute(conf)
|
||||
if (conf.includeDate.get()) {
|
||||
ProjectStorage.get(project).jarManifestProperties["Build-Date"] = LocalDateTime.now().toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package dev.frogmc.phytotelma.run.datagen
|
||||
|
||||
import dev.frogmc.phytotelma.ProjectStorage
|
||||
import dev.frogmc.phytotelma.ext.datagen.DatagenExtension
|
||||
import dev.frogmc.phytotelma.ext.DatagenExtension
|
||||
import dev.frogmc.phytotelma.run.RunConfigGenerator
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.logging.configuration.ConsoleOutput
|
||||
|
|
|
@ -3,7 +3,7 @@ package dev.frogmc.phytotelma.run.datagen
|
|||
import com.electronwill.nightconfig.toml.TomlParser
|
||||
import dev.frogmc.phytotelma.Constants
|
||||
import dev.frogmc.phytotelma.common.Env
|
||||
import dev.frogmc.phytotelma.ext.datagen.DatagenExtension
|
||||
import dev.frogmc.phytotelma.ext.DatagenExtension
|
||||
import dev.frogmc.phytotelma.run.task.RunGameTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
|
|
Loading…
Reference in a new issue