From 4ef32d803766e950adeea1baf17e1ff7b18c3f19 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Tue, 25 May 2021 19:23:47 +0430 Subject: [PATCH] build type --- .github/workflows/build_push.yml | 2 ++ .github/workflows/publish.yml | 2 ++ server/build.gradle.kts | 10 ++++------ .../kotlin/ir/armor/tachidesk/server/ServerSetup.kt | 2 +- .../ir/armor/tachidesk/server/impl_internal/About.kt | 6 ++++-- .../ir/armor/tachidesk/server/util/SystemTray.kt | 4 ++-- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 3719a68..a664a67 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -61,6 +61,8 @@ jobs: - name: Build and copy webUI, Build Jar uses: eskatos/gradle-command-action@v1 + env: + TachideskBuildType: "Preview" with: build-root-directory: master wrapper-directory: master diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bf51c95..65f0acd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,6 +60,8 @@ jobs: - name: Build and copy webUI, Build Jar uses: eskatos/gradle-command-action@v1 + env: + TachideskBuildType: "Stable" with: build-root-directory: master wrapper-directory: master diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 4bf57de..606cf9b 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -109,16 +109,14 @@ val tachideskRevision = Runtime } buildConfig { - appName = rootProject.name clsName = "BuildConfig" packageName = "ir.armor.tachidesk.server" - version = tachideskVersion - buildConfigField("String", "name", rootProject.name) // alias for BuildConfig.NAME - buildConfigField("String", "version", tachideskVersion) // alias for BuildConfig.VERSION - buildConfigField("String", "revision", tachideskRevision) - buildConfigField("boolean", "debug", project.hasProperty("debugApp").toString()) + buildConfigField("String", "NAME", rootProject.name) + buildConfigField("String", "VERSION", tachideskVersion) + buildConfigField("String", "REVISION", tachideskRevision) + buildConfigField("String", "BUILD_TYPE", if (System.getenv("TachideskBuildType") == "Stable") "Stable" else "Preview") } tasks { diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt b/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt index a08c4a5..699a518 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt @@ -40,7 +40,7 @@ val systemTrayInstance by lazy { systemTray() } val androidCompat by lazy { AndroidCompat() } fun applicationSetup() { - logger.info("Running Tachidesk ${BuildConfig.version} revision ${BuildConfig.revision}") + logger.info("Running Tachidesk ${BuildConfig.VERSION} revision ${BuildConfig.REVISION}") // Application dirs val applicationDirs = ApplicationDirs() diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt b/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt index b991aae..4b6dfd4 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/server/impl_internal/About.kt @@ -12,13 +12,15 @@ import ir.armor.tachidesk.server.BuildConfig data class AboutDataClass( val version: String, val revision: String, + val buildType: String, ) object About { fun getAbout(): AboutDataClass { return AboutDataClass( - BuildConfig.version, - BuildConfig.revision, + BuildConfig.VERSION, + BuildConfig.REVISION, + BuildConfig.BUILD_TYPE, ) } } diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt b/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt index c0e8530..c6356e3 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/server/util/SystemTray.kt @@ -22,9 +22,9 @@ object SystemTray { // ref: https://github.com/dorkbox/SystemTray/blob/master/test/dorkbox/TestTray.java SystemTray.DEBUG = serverConfig.debugLogsEnabled - CacheUtil.clear(BuildConfig.name) + CacheUtil.clear(BuildConfig.NAME) - val systemTray = SystemTray.get(BuildConfig.name) ?: return null + val systemTray = SystemTray.get(BuildConfig.NAME) ?: return null val mainMenu = systemTray.menu mainMenu.add(