Last active
April 2, 2023 10:13
-
-
Save dacr/40ddcecfdf21ae54304ccd3a8a4417ca to your computer and use it in GitHub Desktop.
Generate build medata data and inject them into the packaging process as properties file / published by https://github.com/dacr/code-examples-manager #bc0aa5a3-4380-4099-abe0-701969cfea6d/b98ef6e658f7fefc03bc21e609a115cb8de022a3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : Generate build medata data and inject them into the packaging process as properties file | |
// keywords : scala, sbt, metadata, tracing | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : bc0aa5a3-4380-4099-abe0-701969cfea6d | |
// created-on : 2021-06-15T12:05:02Z | |
// managed-by : https://github.com/dacr/code-examples-manager | |
Compile / resourceGenerators += Def.task { | |
val dir = (Compile / sourceManaged).value | |
val projectName = name.value | |
val projectGroup = organization.value | |
val projectPage=homepage.value.map(_.toString).getOrElse("https://github.com/dacr") | |
val projectVersion = version.value | |
val buildDateTime = java.time.Instant.now().toString | |
val buildUUID = java.util.UUID.randomUUID.toString | |
val file = dir / "app-meta.conf" | |
IO.write(file, | |
s"""application-config { | |
| meta-info { | |
| project-name = "$projectName" | |
| project-code = "cem" | |
| project-group = "$projectGroup" | |
| project-page = "$projectPage" | |
| build-version = "$projectVersion" | |
| build-date-time = "$buildDateTime" | |
| build-uuid = "$buildUUID" | |
| } | |
|}""".stripMargin | |
) | |
Seq(file) | |
}.taskValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment