From 267c98be556adad55e71b71c49e312a183936c37 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 29 Jan 2020 21:45:44 +0200 Subject: [PATCH] Resolved #1757 - Can now see version when running from a desktop Jar --- android/build.gradle | 4 ++-- build.gradle | 3 +++ desktop/build.gradle | 1 + desktop/src/com/unciv/app/desktop/DesktopLauncher.kt | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 38619841..24b625e3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 369 - versionName "3.5.7" + versionCode appCodeNumber + versionName appVersion archivesBaseName = "Unciv" } diff --git a/build.gradle b/build.gradle index ec936260..3e006992 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,9 @@ allprojects { version = '1.0.1' ext { appName = "Unciv" + appCodeNumber = 369 + appVersion = "3.5.7" + gdxVersion = '1.9.10' roboVMVersion = '2.3.1' box2DLightsVersion = '1.4' diff --git a/desktop/build.gradle b/desktop/build.gradle index e111ceb6..f8af688c 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -40,6 +40,7 @@ task dist(dependsOn: classes, type: Jar) { // Compiles the jar file manifest { attributes 'Main-Class': project.mainClassName + attributes 'Specification-Version': appVersion } } diff --git a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt index 3a345217..af661873 100644 --- a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt @@ -27,7 +27,9 @@ internal object DesktopLauncher { config.title = "Unciv" config.useHDPI = true - val game = UncivGame("Desktop", null){exitProcess(0)} + val versionFromJar = DesktopLauncher.javaClass.`package`.specificationVersion + + val game = UncivGame(if (versionFromJar != null) versionFromJar else "Desktop", null){exitProcess(0)} if(!RaspberryPiDetector.isRaspberryPi()) // No discord RPC for Raspberry Pi, see https://github.com/yairm210/Unciv/issues/1624 tryActivateDiscord(game)