|
|
|
apply plugin: 'com.android.application'
|
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
apply plugin: 'kotlin-android-extensions'
|
|
|
|
apply plugin: 'kotlin-kapt'
|
|
|
|
apply plugin: 'de.timfreiheit.resourceplaceholders'
|
|
|
|
apply plugin: 'com.google.firebase.crashlytics'
|
|
|
|
|
|
|
|
androidExtensions {
|
|
|
|
experimental = true
|
|
|
|
}
|
|
|
|
|
|
|
|
static def releaseTime() {
|
|
|
|
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8"))
|
|
|
|
}
|
|
|
|
|
|
|
|
def name = "legado"
|
|
|
|
def version = "3." + releaseTime()
|
|
|
|
def gitCommits = Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion 30
|
|
|
|
signingConfigs {
|
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
myConfig {
|
|
|
|
storeFile file(RELEASE_STORE_FILE)
|
|
|
|
storePassword RELEASE_STORE_PASSWORD
|
|
|
|
keyAlias RELEASE_KEY_ALIAS
|
|
|
|
keyPassword RELEASE_KEY_PASSWORD
|
|
|
|
v1SigningEnabled true
|
|
|
|
v2SigningEnabled true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "io.legado.app"
|
|
|
|
minSdkVersion 21
|
|
|
|
targetSdkVersion 30
|
|
|
|
versionCode gitCommits
|
|
|
|
versionName version
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
project.ext.set("archivesBaseName", name + "_" + version)
|
|
|
|
multiDexEnabled true
|
|
|
|
javaCompileOptions {
|
|
|
|
annotationProcessorOptions {
|
|
|
|
arguments = [
|
|
|
|
"room.incremental" : "true",
|
|
|
|
"room.expandProjection": "true",
|
|
|
|
"room.schemaLocation" : "$projectDir/schemas".toString()
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
signingConfig signingConfigs.myConfig
|
|
|
|
}
|
|
|
|
applicationIdSuffix '.release'
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
debug {
|
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
signingConfig signingConfigs.myConfig
|
|
|
|
}
|
|
|
|
applicationIdSuffix '.debug'
|
|
|
|
versionNameSuffix 'debug'
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all {
|
|
|
|
def flavor = variant.productFlavors[0].name
|
|
|
|
outputFileName = "${name}_${flavor}_${defaultConfig.versionName}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flavorDimensions "mode"
|
|
|
|
productFlavors {
|
|
|
|
app {
|
|
|
|
dimension "mode"
|
|
|
|
manifestPlaceholders = [APP_CHANNEL_VALUE: "app"]
|
|
|
|
}
|
|
|
|
google {
|
|
|
|
dimension "mode"
|
|
|
|
applicationId "io.legado.play"
|
|
|
|
manifestPlaceholders = [APP_CHANNEL_VALUE: "google"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compileOptions {
|
|
|
|
// Flag to enable support for the new language APIs
|
|
|
|
coreLibraryDesugaringEnabled true
|
|
|
|
// Sets Java compatibility to Java 8
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resourcePlaceholders {
|
|
|
|
files = ['xml/shortcuts.xml']
|
|
|
|
}
|
|
|
|
|
|
|
|
kapt {
|
|
|
|
arguments {
|
|
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
testImplementation 'junit:junit:4.13.1'
|
|
|
|
androidTestImplementation 'androidx.test:runner:1.3.0'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
|
|
|
implementation "com.android.support:multidex:1.0.3"
|
|
|
|
//kotlin
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
|
|
|
|
|
|
//fireBase
|
|
|
|
implementation 'com.google.firebase:firebase-analytics-ktx:18.0.0'
|
|
|
|
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.2'
|
|
|
|
|
|
|
|
//androidX
|
|
|
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
|
|
implementation 'androidx.media:media:1.2.0'
|
|
|
|
implementation 'androidx.preference:preference-ktx:1.1.1'
|
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
|
|
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
|
|
|
implementation 'androidx.viewpager2:viewpager2:1.0.0'
|
|
|
|
implementation 'com.google.android.material:material:1.2.1'
|
|
|
|
implementation 'com.google.android:flexbox:1.1.0'
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.6'
|
|
|
|
|
|
|
|
//lifecycle
|
|
|
|
def lifecycle_version = '2.2.0'
|
|
|
|
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
|
|
|
|
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
|
|
|
|
|
|
|
|
//room
|
|
|
|
def room_version = '2.2.5'
|
|
|
|
implementation "androidx.room:room-runtime:$room_version"
|
|
|
|
kapt "androidx.room:room-compiler:$room_version"
|
|
|
|
testImplementation "androidx.room:room-testing:2.2.5"
|
|
|
|
|
|
|
|
//paging
|
|
|
|
implementation 'androidx.paging:paging-runtime-ktx:2.1.2'
|
|
|
|
|
|
|
|
//anko
|
|
|
|
def anko_version = '0.10.8'
|
|
|
|
implementation "org.jetbrains.anko:anko-sdk27:$anko_version"
|
|
|
|
implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"
|
|
|
|
|
|
|
|
//liveEventBus
|
|
|
|
implementation 'com.jeremyliao:live-event-bus-x:1.5.7'
|
|
|
|
|
|
|
|
//协程
|
|
|
|
def coroutines_version = '1.3.7'
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
|
|
|
|
|
|
|
//规则相关
|
|
|
|
implementation 'org.jsoup:jsoup:1.13.1'
|
|
|
|
implementation 'cn.wanghaomiao:JsoupXpath:2.3.2'
|
|
|
|
implementation 'com.jayway.jsonpath:json-path:2.4.0'
|
|
|
|
|
|
|
|
//JS rhino
|
|
|
|
implementation 'com.github.gedoor:rhino-android:1.4'
|
|
|
|
|
|
|
|
//网络
|
|
|
|
//noinspection GradleDependency
|
|
|
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
|
|
|
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
|
|
|
|
|
|
|
|
//Glide
|
|
|
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
|
|
|
|
|
|
|
//webServer
|
|
|
|
implementation 'org.nanohttpd:nanohttpd:2.3.1'
|
|
|
|
implementation 'org.nanohttpd:nanohttpd-websocket:2.3.1'
|
|
|
|
|
|
|
|
//二维码
|
|
|
|
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
|
|
|
|
|
|
|
|
//颜色选择
|
|
|
|
implementation 'com.jaredrummler:colorpicker:1.1.0'
|
|
|
|
|
|
|
|
//apache
|
|
|
|
implementation 'org.apache.commons:commons-lang3:3.11'
|
|
|
|
implementation 'org.apache.commons:commons-text:1.9'
|
|
|
|
|
|
|
|
//字符串比较
|
|
|
|
implementation 'net.ricecode:string-similarity:1.0.0'
|
|
|
|
|
|
|
|
//MarkDown
|
|
|
|
implementation 'io.noties.markwon:core:4.6.0'
|
|
|
|
implementation 'io.noties.markwon:image-glide:4.6.0'
|
|
|
|
|
|
|
|
//转换繁体
|
|
|
|
implementation 'com.hankcs:hanlp:portable-1.7.8'
|
|
|
|
|
|
|
|
//epub
|
|
|
|
implementation('com.positiondev.epublib:epublib-core:3.1') {
|
|
|
|
exclude group: 'org.slf4j'
|
|
|
|
exclude group: 'xmlpull'
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'com.google.gms.google-services'
|