File tree 4 files changed +20
-2
lines changed
commonMain/kotlin/top/ntutn/common/ui
desktopMain/kotlin/top/ntutn/common
4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 18
18
distribution : ' temurin'
19
19
cache : gradle
20
20
21
+ - name : Select CHANNEL
22
+ run : mkdir build; echo release > build/CHANNEL
21
23
- name : Grant execute permission for gradlew
22
24
run : chmod +x gradlew
23
25
- name : Build with Gradle
46
48
distribution : ' temurin'
47
49
cache : gradle
48
50
51
+ - name : Select CHANNEL
52
+ run : mkdir build; echo release > build/CHANNEL
49
53
- name : Grant execute permission for gradlew
50
54
run : chmod +x gradlew
51
55
- name : Build with Gradle
74
78
distribution : ' temurin'
75
79
cache : gradle
76
80
81
+ - name : Select CHANNEL
82
+ run : mkdir build; echo release > build/CHANNEL
77
83
- name : Grant execute permission for gradlew
78
84
run : chmod +x gradlew
79
85
- name : Build with Gradle
@@ -102,6 +108,8 @@ jobs:
102
108
distribution : ' temurin'
103
109
cache : gradle
104
110
111
+ - name : Select CHANNEL
112
+ run : mkdir build; echo release > build/CHANNEL
105
113
- name : Grant execute permission for gradlew
106
114
run : chmod +x gradlew
107
115
- name : Build with Gradle
Original file line number Diff line number Diff line change @@ -11,6 +11,14 @@ plugins {
11
11
12
12
val appVersionCode: String by ext
13
13
val appVersionName: String by ext
14
+ val channel by lazy {
15
+ try {
16
+ File (rootProject.projectDir, " build/CHANNEL" ).readText().trim().ifBlank { " local_test" }
17
+ } catch (e: Exception ) {
18
+ e.printStackTrace()
19
+ " local_test"
20
+ }
21
+ }
14
22
15
23
group = " top.ntutn"
16
24
version = appVersionName
@@ -94,6 +102,7 @@ val generateAppInfoFile = tasks.register("generateAppInfoFile") {
94
102
object AppInfo {
95
103
const val VERSION_CODE = $appVersionCode
96
104
const val VERSION_NAME = "$appVersionName "
105
+ const val CHANNEL = "$channel "
97
106
}
98
107
""" .trimIndent()
99
108
val appInfoDir = File (project.buildDir, " generated/source/appInfo" )
Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ import androidx.compose.ui.Modifier
10
10
@Composable
11
11
fun AboutPage () {
12
12
Column (modifier = Modifier .fillMaxSize()) {
13
- Text (" 海瑞待办 ${AppInfo .VERSION_NAME } " )
13
+ Text (" 海瑞待办 ${AppInfo .VERSION_NAME } , channel= ${ AppInfo . CHANNEL } " )
14
14
}
15
15
}
Original file line number Diff line number Diff line change 1
1
package top.ntutn.common
2
2
3
+ import AppInfo
3
4
import com.google.auto.service.AutoService
4
5
import com.squareup.sqldelight.db.SqlDriver
5
6
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
@@ -22,7 +23,7 @@ class DriverFactory: IDriverFactory {
22
23
configFolder
23
24
}
24
25
25
- private val sqliteFile get() = File (currentConfigDir, " todo.db" )
26
+ private val sqliteFile get() = File (currentConfigDir, if ( AppInfo . CHANNEL == " local_test " ) " todo_test.db " else " todo.db" )
26
27
private val sqliteUrl get() = " jdbc:sqlite:${sqliteFile.canonicalPath} "
27
28
28
29
override fun createDriver (): SqlDriver {
You can’t perform that action at this time.
0 commit comments