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.compose.desktop.application.dsl.TargetFormat
|
||||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
import java.io.ByteArrayOutputStream
|
||||||
import java.util.Properties
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlinMultiplatform)
|
alias(libs.plugins.kotlinMultiplatform)
|
||||||
|
|
@ -13,7 +12,9 @@ plugins {
|
||||||
alias(libs.plugins.kotlinSerialization)
|
alias(libs.plugins.kotlinSerialization)
|
||||||
}
|
}
|
||||||
|
|
||||||
val appVersion = "1.0.0"
|
val gitVersionCode = getGitCommitCount()
|
||||||
|
val gitVersionName = getGVN()
|
||||||
|
val desktopVersionName = getCleanDesktopVersion(gitVersionName)
|
||||||
kotlin {
|
kotlin {
|
||||||
/*linuxX64 {
|
/*linuxX64 {
|
||||||
binaries {
|
binaries {
|
||||||
|
|
@ -114,8 +115,8 @@ android {
|
||||||
applicationId = "mg.dot.feufaro"
|
applicationId = "mg.dot.feufaro"
|
||||||
minSdk = libs.versions.android.minSdk.get().toInt()
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
||||||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||||||
versionCode = 1
|
versionCode = gitVersionCode
|
||||||
versionName = appVersion
|
versionName = gitVersionName
|
||||||
}
|
}
|
||||||
packaging {
|
packaging {
|
||||||
resources {
|
resources {
|
||||||
|
|
@ -144,8 +145,8 @@ compose.desktop {
|
||||||
nativeDistributions {
|
nativeDistributions {
|
||||||
targetFormats(TargetFormat.Exe, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
targetFormats(TargetFormat.Exe, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||||
packageName = "Feufaro"
|
packageName = "Feufaro"
|
||||||
packageVersion = appVersion
|
packageVersion = desktopVersionName
|
||||||
jvmArgs("-Dapp.version=$appVersion")
|
jvmArgs("-Dapp.version=$gitVersionName")
|
||||||
modules("java.base", "java.desktop", "jdk.unsupported", "java.naming")
|
modules("java.base", "java.desktop", "jdk.unsupported", "java.naming")
|
||||||
|
|
||||||
windows {
|
windows {
|
||||||
|
|
@ -231,3 +232,34 @@ tasks.register<Copy>("exportLibs") {
|
||||||
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
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 {
|
} else {
|
||||||
val shortDisplayPath = longPathToShort(displayPath)
|
val shortDisplayPath = longPathToShort(displayPath)
|
||||||
|
|
||||||
|
val message = if (shortDisplayPath.endsWith(".json", ignoreCase = true)) {
|
||||||
|
"Playlist mise à jour"
|
||||||
|
} else {
|
||||||
|
"Sauvegarde réussie dans : $shortDisplayPath"
|
||||||
|
}
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context.applicationContext,
|
context.applicationContext,
|
||||||
"Sauvegarde réussie dans : $shortDisplayPath",
|
message,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
||||||
modifier = Modifier.padding(top = 4.dp, bottom = 16.dp)
|
modifier = Modifier.padding(top = 4.dp, bottom = 16.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Version $appVersion",
|
text = appVersion,
|
||||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
|
modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondaryContainer
|
color = MaterialTheme.colorScheme.onSecondaryContainer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue