Create tag v1.0.0 and place in AboutPage on version
This commit is contained in:
parent
22a4c4bdf6
commit
4d79ec5fff
3 changed files with 46 additions and 9 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
import java.util.Properties
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
|
|
@ -13,7 +12,9 @@ plugins {
|
|||
alias(libs.plugins.kotlinSerialization)
|
||||
}
|
||||
|
||||
val appVersion = "1.0.0"
|
||||
val gitVersionCode = getGitCommitCount()
|
||||
val gitVersionName = getGVN()
|
||||
val desktopVersionName = getCleanDesktopVersion(gitVersionName)
|
||||
kotlin {
|
||||
/*linuxX64 {
|
||||
binaries {
|
||||
|
|
@ -114,8 +115,8 @@ android {
|
|||
applicationId = "mg.dot.feufaro"
|
||||
minSdk = libs.versions.android.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||||
versionCode = 1
|
||||
versionName = appVersion
|
||||
versionCode = gitVersionCode
|
||||
versionName = gitVersionName
|
||||
}
|
||||
packaging {
|
||||
resources {
|
||||
|
|
@ -144,8 +145,8 @@ compose.desktop {
|
|||
nativeDistributions {
|
||||
targetFormats(TargetFormat.Exe, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||
packageName = "Feufaro"
|
||||
packageVersion = appVersion
|
||||
jvmArgs("-Dapp.version=$appVersion")
|
||||
packageVersion = desktopVersionName
|
||||
jvmArgs("-Dapp.version=$gitVersionName")
|
||||
modules("java.base", "java.desktop", "jdk.unsupported", "java.naming")
|
||||
|
||||
windows {
|
||||
|
|
@ -231,3 +232,34 @@ tasks.register<Copy>("exportLibs") {
|
|||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
fun getGitCommitCount(): Int {
|
||||
return try {
|
||||
val execResult = providers.exec {
|
||||
commandLine("git", "rev-list", "--count", "HEAD")
|
||||
}
|
||||
val countStr = execResult.standardOutput.asText.get().trim()
|
||||
val count = countStr.toIntOrNull() ?: 1
|
||||
if (count > 0) count else 1
|
||||
} catch (e: Exception) {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
fun getGVN(): String {
|
||||
val execResult = providers.exec {
|
||||
commandLine("git", "describe", "--tags", "--always", "--abbrev=0")
|
||||
}
|
||||
val rawVersion = execResult.standardOutput.asText.get().trim()
|
||||
|
||||
return if (rawVersion.isNotEmpty()) {
|
||||
rawVersion
|
||||
} else {
|
||||
"v1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
fun getCleanDesktopVersion(versionName: String): String {
|
||||
val regex = Regex("""^\d+(\.\d+)*""")
|
||||
return regex.find(versionName)?.value ?: "1.0.0"
|
||||
}
|
||||
|
|
@ -125,9 +125,14 @@ class AndroidFileRepository(private val context: Context) : FileRepository {
|
|||
} else {
|
||||
val shortDisplayPath = longPathToShort(displayPath)
|
||||
|
||||
val message = if (shortDisplayPath.endsWith(".json", ignoreCase = true)) {
|
||||
"Playlist mise à jour"
|
||||
} else {
|
||||
"Sauvegarde réussie dans : $shortDisplayPath"
|
||||
}
|
||||
Toast.makeText(
|
||||
context.applicationContext,
|
||||
"Sauvegarde réussie dans : $shortDisplayPath",
|
||||
message,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
|||
modifier = Modifier.padding(top = 4.dp, bottom = 16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Version $appVersion",
|
||||
text = appVersion,
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = MaterialTheme.colorScheme.onSecondaryContainer
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue