Skip to content

Commit d62ebcd

Browse files
committed
delete old server
1 parent 1633268 commit d62ebcd

343 files changed

Lines changed: 72 additions & 3650 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,43 @@
1-
2-
# =========================
31
# IDE & Editor
4-
# =========================
52
.idea/
63
.vscode/
74
*.iml
85
*.swp
96
*.swo
107
*~
118

12-
# =========================
13-
# OS Generated Files
14-
# =========================
9+
# OS generated files
1510
.DS_Store
1611
.DS_Store?
1712
._*
1813
Thumbs.db
19-
ehthumbs.db
2014

21-
# =========================
22-
# Client (Android)
23-
# =========================
24-
client/.gradle/
25-
client/build/
26-
client/app/build/
27-
client/app/schemas/
28-
client/local.properties
29-
client/*.keystore
30-
!client/heji.keystore
15+
# Gradle / Android build outputs
16+
.gradle/
17+
.kotlin/
18+
build/
19+
.cxx/
20+
.externalNativeBuild/
21+
captures/
22+
app/schemas/
3123

32-
# =========================
33-
# Server (Go)
34-
# =========================
35-
server/build/
36-
server/logs/
37-
server/cmd/logs/
38-
server/cmd/*.exe
39-
server/*.log
40-
server/*.log_symlink
24+
# Local machine / secrets
25+
local.properties
26+
*.jks
27+
*.keystore
28+
*.secret
29+
.env
30+
.env.local
31+
.env.*.local
4132

42-
# =========================
43-
# Proto
44-
# =========================
45-
proto/.idea/
33+
# Build artifacts
34+
*.apk
35+
*.aab
36+
*.ap_
37+
*.hprof
4638

47-
# =========================
48-
# Logs & Temporary Files
49-
# =========================
39+
# Logs & temporary files
5040
*.log
5141
logs/
5242
tmp/
5343
temp/
54-
55-
# =========================
56-
# Environment & Secrets
57-
# =========================
58-
.env
59-
.env.local
60-
.env.*.local
61-
*.secret
62-
secrets/
Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,52 @@
1+
import java.io.File
12
import java.text.SimpleDateFormat
23
import java.util.Date
4+
import java.util.Properties
35
import java.util.TimeZone
46

57
plugins {
68
alias(libs.plugins.android.application)
7-
alias(libs.plugins.kotlin.android)
8-
alias(libs.plugins.kotlin.kapt)
99
alias(libs.plugins.kotlin.parcelize)
1010
alias(libs.plugins.kotlin.serialization)
1111
alias(libs.plugins.navigation.safeargs)
1212
alias(libs.plugins.ksp)
1313
alias(libs.plugins.sentry)
1414
}
1515

16+
val localProperties = Properties().apply {
17+
val localPropertiesFile = rootProject.file("local.properties")
18+
check(localPropertiesFile.exists()) {
19+
"Missing local.properties at ${localPropertiesFile.path}"
20+
}
21+
localPropertiesFile.inputStream().use(::load)
22+
}
23+
24+
fun requireLocalProperty(name: String): String =
25+
localProperties.getProperty(name)
26+
?: error("Missing $name in local.properties")
27+
28+
val gitVersion = providers.exec {
29+
commandLine("git", "rev-parse", "--short", "HEAD")
30+
}.standardOutput.asText.get().trim()
31+
32+
fun configureApkRename(versionName: String) {
33+
tasks.withType(com.android.build.gradle.tasks.PackageApplication::class.java).configureEach {
34+
doLast {
35+
val dateFormat = SimpleDateFormat("yyyyMMddHHmm")
36+
dateFormat.timeZone = TimeZone.getTimeZone("GMT+08:00")
37+
val time = dateFormat.format(Date())
38+
val outputDir = outputDirectory.get().asFile
39+
outputDir.listFiles()
40+
?.filter { it.name.endsWith(".apk") }
41+
?.forEach { apk ->
42+
val buildTypeName = name.removePrefix("package")
43+
.replaceFirstChar { it.lowercase() }
44+
apk.renameTo(File(apk.parentFile, "$buildTypeName-$versionName-$gitVersion-$time.apk"))
45+
}
46+
}
47+
}
48+
}
49+
1650
android {
1751
namespace = "com.hao.heji"
1852
compileSdk = 36
@@ -39,10 +73,10 @@ android {
3973

4074
signingConfigs {
4175
create("single") {
42-
storeFile = file("../heji.keystore")
43-
storePassword = "password"
44-
keyPassword = "password"
45-
keyAlias = "heji"
76+
storeFile = rootProject.file(requireLocalProperty("KEYSTORE_PATH"))
77+
storePassword = requireLocalProperty("KEYSTORE_PASSWORD")
78+
keyAlias = requireLocalProperty("KEY_ALIAS")
79+
keyPassword = requireLocalProperty("KEY_PASSWORD")
4680
}
4781
}
4882

@@ -84,22 +118,14 @@ android {
84118
buildFeatures {
85119
viewBinding = true
86120
buildConfig = true
121+
resValues = true
87122
}
88123

89-
applicationVariants.all {
90-
val variant = this
91-
outputs.all {
92-
val output = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl
93-
val dateFormat = SimpleDateFormat("yyyyMMddHHmm")
94-
dateFormat.timeZone = TimeZone.getTimeZone("GMT+08:00")
95-
val time = dateFormat.format(Date())
96-
val buildTypes = variant.buildType.name
97-
val versionName = variant.versionName
98-
val gitVersion = "git rev-parse --short HEAD".runCommand() ?: "unknown"
99-
output.outputFileName = "$buildTypes-$versionName-$gitVersion-$time.apk"
100-
println(output.outputFileName)
101-
}
102-
}
124+
}
125+
126+
afterEvaluate {
127+
val apkVersionName = android.defaultConfig.versionName ?: "1.0"
128+
configureApkRename(apkVersionName)
103129
}
104130

105131
configurations.all {
@@ -189,18 +215,3 @@ dependencies {
189215
// Debug
190216
debugImplementation(libs.glance)
191217
}
192-
193-
// Helper function to run shell commands
194-
fun String.runCommand(): String? {
195-
return try {
196-
val process = ProcessBuilder(*split(" ").toTypedArray())
197-
.directory(projectDir)
198-
.redirectOutput(ProcessBuilder.Redirect.PIPE)
199-
.redirectError(ProcessBuilder.Redirect.PIPE)
200-
.start()
201-
process.waitFor()
202-
process.inputStream.bufferedReader().readText().trim()
203-
} catch (e: Exception) {
204-
null
205-
}
206-
}

client/app/src/androidTest/java/com/hao/heji/ConfigTest.kt renamed to app/src/androidTest/java/com/hao/heji/ConfigTest.kt

File renamed without changes.

client/app/src/androidTest/java/com/hao/heji/ExampleInstrumentedTest.kt renamed to app/src/androidTest/java/com/hao/heji/ExampleInstrumentedTest.kt

File renamed without changes.

client/app/src/androidTest/java/com/hao/heji/TestBillChange.kt renamed to app/src/androidTest/java/com/hao/heji/TestBillChange.kt

File renamed without changes.

client/app/src/androidTest/java/com/hao/heji/data/DataRepositoryTest.kt renamed to app/src/androidTest/java/com/hao/heji/data/DataRepositoryTest.kt

File renamed without changes.

client/app/src/androidTest/java/com/hao/heji/data/db/BillWithImageDaoTest.kt renamed to app/src/androidTest/java/com/hao/heji/data/db/BillWithImageDaoTest.kt

File renamed without changes.

client/app/src/androidTest/java/com/hao/heji/data/db/BookTest.kt renamed to app/src/androidTest/java/com/hao/heji/data/db/BookTest.kt

File renamed without changes.

0 commit comments

Comments
 (0)