TiebaLite/app/build.gradle

235 lines
8.9 KiB
Groovy

plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id 'com.google.protobuf'
id 'dagger.hilt.android.plugin'
}
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties")))
def applicationProperties = new Properties()
applicationProperties.load(new FileInputStream(rootProject.file("application.properties")))
def buildId = System.getenv("APPCENTER_BUILD_ID")
def isSelfBuild = buildId == null
def applicationVersionCode = applicationProperties["versionCode"].toInteger()
def applicationVersionName = applicationProperties["versionName"]
def isPerVersion = applicationProperties["isPerRelease"] == "true"
if (!isSelfBuild) {
applicationVersionName = applicationVersionName + ".${buildId}"
}
if (isPerVersion) {
applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}"
}
android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
defaultConfig {
applicationId "com.huanchengfly.tieba.post"
minSdkVersion 21
//noinspection OldTargetApi
targetSdkVersion 32
versionCode applicationVersionCode
versionName applicationVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
manifestPlaceholders = [
is_self_build: "$isSelfBuild"
]
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.2.0'
}
signingConfigs {
release {
keyAlias keystoreProperties["releaseKeyAlias"]
keyPassword keystoreProperties["releaseKeyPassword"]
storeFile file(rootDir.getCanonicalPath() + "/" + keystoreProperties["releaseKeyStore"])
storePassword keystoreProperties["releaseStorePassword"]
v2SigningEnabled true
enableV3Signing true
enableV4Signing true
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
zipAlignEnabled true
multiDexEnabled true
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += ["-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"]
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
sourceSets {
main {
proto {
srcDir 'src/main/proto'
}
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
def fileName = "${variant.buildType.name}-${applicationVersionName}(${applicationVersionCode}).apk"
output.outputFileName = new File(outputFile.parent, fileName).name
}
}
}
dependencies {
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
def accompanist_version = "0.25.0"
implementation "com.google.accompanist:accompanist-insets-ui:$accompanist_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
implementation "com.google.accompanist:accompanist-placeholder-material:$accompanist_version"
implementation 'io.coil-kt:coil-compose:2.1.0'
def compose_version = '1.2.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
implementation 'androidx.activity:activity-compose:1.5.1'
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.animation:animation:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "com.google.android.material:compose-theme-adapter:1.1.15"
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1"
implementation 'com.google.protobuf:protobuf-java:3.21.1'
implementation 'com.github.gzu-liyujiang:Android_CN_OAID:4.2.4'
implementation 'org.jetbrains:annotations:23.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
api 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
//Local Files
implementation fileTree(include: ["*.jar"], dir: "libs")
//兼容 Glide
implementation "com.android.support:support-annotations:28.0.0"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
kapt "com.android.support:support-annotations:28.0.0"
//AndroidX
implementation "androidx.appcompat:appcompat:1.4.2"
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.annotation:annotation:1.4.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.browser:browser:1.4.0"
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.window:window:1.0.0"
implementation "androidx.startup:startup-runtime:1.1.1"
implementation "androidx.datastore:datastore-preferences:1.0.0"
//Test
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test:core:1.4.0"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
//Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
implementation "com.google.android.material:material:1.6.1"
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit_version"
implementation 'com.google.code.gson:gson:2.9.1'
implementation "cn.dreamtobe.kpswitch:library:1.6.2"
implementation "org.litepal.android:kotlin:3.0.0"
implementation 'cn.jzvd:jiaozivideoplayer:7.7.2.3300'
implementation "com.jrummyapps:colorpicker:2.1.7"
implementation "com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0"
implementation "com.bm.photoview:library:2.0.7"
implementation 'com.github.piasy:BigImageViewer:1.8.1'
implementation 'com.github.piasy:GlideImageLoader:1.8.1'
implementation 'com.github.piasy:GlideImageViewFactory:1.8.1'
implementation "com.scwang.smart:refresh-layout-kernel:2.0.1"
implementation "com.scwang.smart:refresh-header-material:2.0.1"
implementation 'com.github.lwj1994:Matisse:0.5.3-20220115'
implementation 'com.github.getActivity:XXPermissions:13.6'
implementation "com.gyf.immersionbar:immersionbar:3.0.0"
implementation "com.github.yalantis:ucrop:2.2.8"
implementation "com.billy.android:pre-loader:2.1.0"
implementation "com.jakewharton:butterknife:10.2.3"
kapt "com.jakewharton:butterknife-compiler:10.2.3"
//noinspection GradleDependency
implementation ('com.alibaba.android:vlayout:1.2.40@aar') {
transitive = true
}
def appCenterSdkVersion = '4.4.5'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.21.1'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
// outputSubDir = "../" // 能通过该参数将生成文件从 debug / release 目录中移出
}
}
}
}
}