116 lines
3.7 KiB
Groovy
116 lines
3.7 KiB
Groovy
plugins {
|
||
id 'com.android.application'
|
||
}
|
||
|
||
apply from: '../common.gradle'
|
||
|
||
android {
|
||
namespace 'cn.ykbox.dashboard'
|
||
compileSdk 35
|
||
buildToolsVersion "30.0.3"
|
||
|
||
defaultConfig {
|
||
applicationId "cn.ykbox.dashboard"
|
||
minSdk 21
|
||
targetSdk 35
|
||
versionCode gitVersionCode()
|
||
versionName gitVersionTag()
|
||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
}
|
||
|
||
// sign the application
|
||
signingConfigs {
|
||
release {
|
||
storeFile file('..\\sinclass.jks')
|
||
storePassword '=efX!O4i'
|
||
keyAlias 'ScreenClient'
|
||
keyPassword '=efX!O4i'
|
||
|
||
v1SigningEnabled true
|
||
v2SigningEnabled true
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
debug {
|
||
signingConfig signingConfigs.release
|
||
}
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
signingConfig signingConfigs.release
|
||
}
|
||
}
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
}
|
||
buildFeatures {
|
||
viewBinding true
|
||
}
|
||
|
||
android.applicationVariants.all { variant ->
|
||
def docDir = rootProject.getRootDir().getAbsolutePath() + "/../apk/dashboardclient"
|
||
def releaseDir = rootProject.getRootDir().getAbsolutePath() + "/../apk/dashboardclient"
|
||
if (versionName.contains("beta"))
|
||
releaseDir += "/beta"
|
||
|
||
variant.outputs.all {
|
||
// 常规版本不加后缀
|
||
outputFileName = "dashboardclient_${defaultConfig.versionName}.apk"
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
def downloadUrl = "http://thinkdisk.thinkbo.cn/src/web/dashboard/dashboardclient/${outputFileName}"
|
||
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"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
repositories {
|
||
maven { url "https://s01.oss.sonatype.org/content/groups/public" }
|
||
}
|
||
|
||
dependencies {
|
||
implementation libs.appcompat
|
||
implementation libs.material
|
||
implementation libs.activity
|
||
implementation libs.constraintlayout
|
||
implementation libs.preference
|
||
testImplementation libs.junit
|
||
androidTestImplementation libs.ext.junit
|
||
androidTestImplementation libs.espresso.core
|
||
|
||
implementation libs.utilcodex
|
||
|
||
implementation libs.okhttp
|
||
implementation libs.banner
|
||
implementation libs.glide
|
||
annotationProcessor libs.glidecompiler
|
||
|
||
implementation 'io.github.xmaihh:serialport:2.1.1'
|
||
} |