Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:21
Show Gist options
  • Select an option

  • Save dacr/40ddcecfdf21ae54304ccd3a8a4417ca to your computer and use it in GitHub Desktop.

Select an option

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/f6515b711dcb0f0a2964c68d5a83db30c02e72aa
// 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 License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// 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