Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add buildconfig and git metadata #52

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading