2024-03-16 13:23:52 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
id 'com.android.application'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-12 14:23:33 +08:00
|
|
|
|
apply from: '../common.gradle'
|
|
|
|
|
|
|
2024-03-16 13:23:52 +08:00
|
|
|
|
android {
|
2025-09-11 14:31:36 +08:00
|
|
|
|
namespace 'cn.ykbox.dashboard'
|
|
|
|
|
|
compileSdk 35
|
2024-03-16 13:23:52 +08:00
|
|
|
|
buildToolsVersion "30.0.3"
|
|
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
2025-09-11 14:31:36 +08:00
|
|
|
|
applicationId "cn.ykbox.dashboard"
|
2024-03-16 13:23:52 +08:00
|
|
|
|
minSdk 21
|
2025-09-11 14:31:36 +08:00
|
|
|
|
targetSdk 35
|
2025-09-12 14:23:33 +08:00
|
|
|
|
versionCode gitVersionCode()
|
|
|
|
|
|
versionName gitVersionTag()
|
2024-03-16 13:23:52 +08:00
|
|
|
|
|
|
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-12 14:56:08 +08:00
|
|
|
|
// sign the application
|
|
|
|
|
|
signingConfigs {
|
|
|
|
|
|
release {
|
|
|
|
|
|
storeFile file('..\\sinclass.jks')
|
|
|
|
|
|
storePassword '=efX!O4i'
|
|
|
|
|
|
keyAlias 'ScreenClient'
|
|
|
|
|
|
keyPassword '=efX!O4i'
|
|
|
|
|
|
|
|
|
|
|
|
v1SigningEnabled true
|
|
|
|
|
|
v2SigningEnabled true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-16 13:23:52 +08:00
|
|
|
|
buildTypes {
|
2025-09-12 14:23:33 +08:00
|
|
|
|
debug {
|
|
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
|
|
}
|
2024-03-16 13:23:52 +08:00
|
|
|
|
release {
|
|
|
|
|
|
minifyEnabled false
|
|
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2025-09-12 14:23:33 +08:00
|
|
|
|
signingConfig signingConfigs.release
|
2024-03-16 13:23:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
|
|
}
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
|
viewBinding true
|
|
|
|
|
|
}
|
2025-09-12 14:23:33 +08:00
|
|
|
|
|
|
|
|
|
|
android.applicationVariants.all { variant ->
|
2025-10-11 08:45:08 +08:00
|
|
|
|
def docDir = rootProject.getRootDir().getAbsolutePath() + "/../apk/dashboardclient"
|
|
|
|
|
|
def releaseDir = rootProject.getRootDir().getAbsolutePath() + "/../apk/dashboardclient"
|
2025-09-12 14:23:33 +08:00
|
|
|
|
if (versionName.contains("beta"))
|
|
|
|
|
|
releaseDir += "/beta"
|
|
|
|
|
|
|
|
|
|
|
|
variant.outputs.all {
|
|
|
|
|
|
// 常规版本不加后缀
|
2025-10-11 08:45:08 +08:00
|
|
|
|
outputFileName = "dashboardclient_${defaultConfig.versionName}.apk"
|
2025-09-12 14:23:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// assemble 结束后,将apk复制到指定目录
|
|
|
|
|
|
variant.assembleProvider.get().doLast {
|
|
|
|
|
|
variant.outputs.all {
|
|
|
|
|
|
if (variant.buildType.name == 'release') {
|
|
|
|
|
|
copy {
|
|
|
|
|
|
from "${project.getProjectDir().path}/build/outputs/apk/${variant.buildType.name}/${outputFileName}"
|
|
|
|
|
|
into releaseDir
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-11 09:47:04 +08:00
|
|
|
|
def downloadUrl = "http://thinkdisk.thinkbo.cn/src/web/dashboardclient/${outputFileName}"
|
2025-09-12 14:23:33 +08:00
|
|
|
|
genUpdateJson(downloadUrl, releaseDir, outputFileName, 'changelog.md', defaultConfig, variant)
|
|
|
|
|
|
|
|
|
|
|
|
File file = new File("${project.getProjectDir().path}/changelog.md")
|
|
|
|
|
|
replaceText(file, 'VERSION_CODE', "${defaultConfig.versionCode}")
|
|
|
|
|
|
|
|
|
|
|
|
// 用 pandoc 将 changelog.md 导出为 html 格式
|
|
|
|
|
|
exec {
|
|
|
|
|
|
workingDir project.getProjectDir().getAbsolutePath()
|
|
|
|
|
|
commandLine 'pandoc', '--standalone', '--embed-resources',
|
|
|
|
|
|
'--css', rootProject.getRootDir().getAbsolutePath() + '/doc/themes/blue/blue.css',
|
|
|
|
|
|
'changelog.md', '-f',
|
|
|
|
|
|
'markdown', '-t', 'html', '-s',
|
|
|
|
|
|
'-o', "${docDir}/changelog.html"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-16 13:23:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
|
|
maven { url "https://s01.oss.sonatype.org/content/groups/public" }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
2025-09-11 14:31:36 +08:00
|
|
|
|
implementation libs.appcompat
|
|
|
|
|
|
implementation libs.material
|
|
|
|
|
|
implementation libs.activity
|
|
|
|
|
|
implementation libs.constraintlayout
|
2025-09-11 18:27:44 +08:00
|
|
|
|
implementation libs.preference
|
2025-09-11 14:31:36 +08:00
|
|
|
|
testImplementation libs.junit
|
|
|
|
|
|
androidTestImplementation libs.ext.junit
|
|
|
|
|
|
androidTestImplementation libs.espresso.core
|
|
|
|
|
|
|
|
|
|
|
|
implementation libs.utilcodex
|
|
|
|
|
|
|
2025-09-12 10:27:57 +08:00
|
|
|
|
implementation libs.okhttp
|
2025-09-11 14:31:36 +08:00
|
|
|
|
implementation libs.banner
|
|
|
|
|
|
implementation libs.glide
|
|
|
|
|
|
annotationProcessor libs.glidecompiler
|
2025-09-12 08:45:31 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'io.github.xmaihh:serialport:2.1.1'
|
2024-03-16 13:23:52 +08:00
|
|
|
|
}
|