Skip to content

Commit

Permalink
add buildconfig and git metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Nov 20, 2023
1 parent 87ca805 commit e7eb20f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.de.undercouch.gradle.tasks.download.Download
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle

plugins {
kotlin("jvm")
// kotlin("multiplatform")
id("org.jetbrains.compose")
id("com.github.gmazzo.buildconfig") version "4.2.0"
id("org.ajoberstar.grgit") version "4.1.0"
}

group = "com.zoffcc.applications.trifa_material"
Expand All @@ -17,6 +21,24 @@ repositories {
google()
}

buildConfig {
buildConfigField("String", "APP_NAME", "\"${project.name}\"")
buildConfigField("String", "APP_VERSION", provider { "\"${project.version}\"" })
try
{
buildConfigField("String", "GIT_COMMIT_HASH", "\"" + grgit.head().abbreviatedId + "\"")
buildConfigField("String", "GIT_COMMIT_DATE", "\"" + grgit.head().dateTime.
format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "\"")
buildConfigField("String", "GIT_COMMIT_MSG", "\"" + grgit.head().shortMessage.replace("\"", "_") + "\"")
}
catch (e: Exception)
{
buildConfigField("String", "GIT_COMMIT_HASH", "\"" + "????" + "\"")
buildConfigField("String", "GIT_COMMIT_DATE", "\"" + "????" + "\"")
buildConfigField("String", "GIT_COMMIT_MSG", "\"" + "????" + "\"")
}
}

dependencies {
// Note, if you develop a library, you should use compose.desktop.common.
// compose.desktop.currentOs should be used in launcher-sourceSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.ui.semantics.text
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.unit.dp
import com.zoffcc.applications.trifa_material.trifa_material.BuildConfig
import org.briarproject.briar.desktop.utils.InternationalizationUtils.i18n
import java.time.Instant
import java.time.ZoneId
Expand Down Expand Up @@ -110,7 +111,12 @@ private fun GeneralInfo() {
// add(Entry("Git branch/tag", "None detected")) // NON-NLS
// add(Entry("Git hash", BuildData.GIT_HASH)) // NON-NLS
// add(Entry("Commit time", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(commitTime))) // NON-NLS
add(Entry(i18n("about.version"), BuildConfig.APP_VERSION))
add(Entry(i18n("about.git_commit_hash"), BuildConfig.GIT_COMMIT_HASH))
add(Entry(i18n("about.git_commit_date"), BuildConfig.GIT_COMMIT_DATE))
add(Entry(i18n("about.git_commit_msg"), BuildConfig.GIT_COMMIT_MSG))
add(Entry(i18n("about.website"), "https://github.com/Zoxcore/trifa_material", true))

// add(Entry(i18n("about.contact"), Strings.EMAIL, true))
}

Expand Down

0 comments on commit e7eb20f

Please sign in to comment.