|
|
|
/*
|
|
|
|
* This file is part of FYReader.
|
|
|
|
* FYReader is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FYReader is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with FYReader. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 - 2022 fengyuecanzhu
|
|
|
|
*/
|
|
|
|
|
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
apply plugin: 'org.greenrobot.greendao'
|
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
|
|
|
|
def releaseTime() {
|
|
|
|
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+08:00"))
|
|
|
|
}
|
|
|
|
|
|
|
|
def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim())
|
|
|
|
|
|
|
|
def getVersionCode() {
|
|
|
|
def versionCodeFile = file('version_code.properties')
|
|
|
|
if (versionCodeFile.canRead()) {
|
|
|
|
Properties properties = new Properties()
|
|
|
|
properties.load(new FileInputStream(versionCodeFile))
|
|
|
|
def versionCode = properties['VERSION_CODE'].toInteger()//读取version_code.properties文件存放的版本号。
|
|
|
|
def runTasks = gradle.startParameter.taskNames
|
|
|
|
def task = ':app:assembleRelease'
|
|
|
|
if (task in runTasks) {
|
|
|
|
properties['VERSION_CODE'] = (++versionCode).toString()
|
|
|
|
properties.store(versionCodeFile.newWriter(), null)
|
|
|
|
}
|
|
|
|
return versionCode
|
|
|
|
} else {
|
|
|
|
throw new FileNotFoundException("无法读取version_code.properties文件!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def getVersionCodeNotIncrease() {
|
|
|
|
def versionCodeFile = file('version_code.properties')
|
|
|
|
if (versionCodeFile.canRead()) {
|
|
|
|
Properties properties = new Properties()
|
|
|
|
properties.load(new FileInputStream(versionCodeFile))
|
|
|
|
def versionCode = properties['VERSION_CODE'].toInteger()//读取version_code.properties文件存放的版本号。
|
|
|
|
return versionCode
|
|
|
|
} else {
|
|
|
|
throw new FileNotFoundException("无法读取version_code.properties文件!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def name = "风月读书"
|
|
|
|
def version = getVersionCode()
|
|
|
|
|
|
|
|
def getVersionName(){
|
|
|
|
def version = getVersionCodeNotIncrease()
|
|
|
|
def hun = (version / 100).toInteger()
|
|
|
|
def ten = (version / 10).toInteger() % 10
|
|
|
|
def one = version % 10
|
|
|
|
return hun + "." + ten + "." + one
|
|
|
|
}
|
|
|
|
|
|
|
|
def versionN = getVersionName()
|
|
|
|
|
|
|
|
// 读取keystore.properties
|
|
|
|
def keyProps = new Properties()
|
|
|
|
def keyPropsFile = rootProject.file('keystore/keystore.properties')
|
|
|
|
if (keyPropsFile.exists()) {
|
|
|
|
keyProps.load(new FileInputStream(keyPropsFile))
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion 29
|
|
|
|
buildToolsVersion '29.0.3'
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "xyz.fycz.myreader"
|
|
|
|
minSdkVersion 21
|
|
|
|
targetSdkVersion 29
|
|
|
|
versionCode version
|
|
|
|
versionName versionN
|
|
|
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
myConifg {
|
|
|
|
keyAlias keyProps['keyAlias']
|
|
|
|
keyPassword keyProps['keyPassword']
|
|
|
|
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
|
|
|
|
storePassword keyProps['storePassword']
|
|
|
|
v1SigningEnabled true
|
|
|
|
v2SigningEnabled true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
if (keyPropsFile.exists()) {
|
|
|
|
signingConfig signingConfigs.myConifg
|
|
|
|
}
|
|
|
|
ndk {
|
|
|
|
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
debug {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
if (keyPropsFile.exists()) {
|
|
|
|
signingConfig signingConfigs.myConifg
|
|
|
|
}
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
versionNameSuffix "-" + gitCommits
|
|
|
|
ndk {
|
|
|
|
abiFilters "arm64-v8a"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
variant.outputs.all {
|
|
|
|
outputFileName = "${name}v${defaultConfig.versionName}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sourceSets.main {
|
|
|
|
jni.srcDirs = []
|
|
|
|
jniLibs.srcDir "libs/"
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
|
|
|
|
}
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
|
|
|
|
productFlavors {
|
|
|
|
}
|
|
|
|
packagingOptions {
|
|
|
|
// pickFirsts:当出现重复文件,会使用第一个匹配的文件打包进入apk
|
|
|
|
pickFirst 'lib/*/libRSSupport.so'
|
|
|
|
pickFirst 'lib/*/librsjni.so'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
flatDir {
|
|
|
|
dirs 'libs'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
implementation project(path: ':DialogX')
|
|
|
|
testImplementation 'junit:junit:4.13.2'
|
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
|
|
|
|
|
|
|
// androidx
|
|
|
|
implementation "androidx.core:core-ktx:$kotlin_version"
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
|
|
|
|
|
|
|
//anko
|
|
|
|
def anko_version = '0.10.8'
|
|
|
|
implementation "org.jetbrains.anko:anko-sdk27:$anko_version"
|
|
|
|
implementation "org.jetbrains.anko:anko-sdk27-listeners:$anko_version"
|
|
|
|
|
|
|
|
//Glide
|
|
|
|
implementation 'com.github.bumptech.glide:glide:4.13.1'
|
|
|
|
|
|
|
|
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
|
|
|
|
|
|
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
|
|
|
|
|
|
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
|
|
|
|
|
|
|
|
implementation 'org.greenrobot:greendao:3.3.0'
|
|
|
|
implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.2.1'
|
|
|
|
|
|
|
|
//JSoup
|
|
|
|
implementation 'org.jsoup:jsoup:1.14.3'
|
|
|
|
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
|
|
|
|
implementation 'com.jayway.jsonpath:json-path:2.7.0'
|
|
|
|
|
|
|
|
//SmartRefreshLayout
|
|
|
|
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.2'
|
|
|
|
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.2'
|
|
|
|
|
|
|
|
|
|
|
|
implementation 'com.google.android.material:material:1.4.0'
|
|
|
|
|
|
|
|
//Scroller
|
|
|
|
implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
|
|
|
|
|
|
|
|
//Toasty
|
|
|
|
implementation 'com.github.GrenderG:Toasty:1.5.0'
|
|
|
|
|
|
|
|
//字符串比较
|
|
|
|
implementation 'net.ricecode:string-similarity:1.0.0'
|
|
|
|
|
|
|
|
implementation 'com.jayway.jsonpath:json-path:2.7.0'
|
|
|
|
//RxAndroid
|
|
|
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
|
|
|
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
|
|
|
|
|
|
|
//ImmersionBar
|
|
|
|
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
|
|
|
|
|
|
|
//简繁转换
|
|
|
|
implementation 'com.luhuiguo:chinese-utils:1.0'
|
|
|
|
|
|
|
|
//颜色选择
|
|
|
|
implementation 'com.jaredrummler:colorpicker:1.1.0'
|
|
|
|
|
|
|
|
//二维码
|
|
|
|
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
|
|
|
|
|
|
|
|
//编码识别
|
|
|
|
implementation 'com.github.albfernandez:juniversalchardet:2.4.0'
|
|
|
|
|
|
|
|
// 标签 https://github.com/hongyangAndroid/FlowLayout
|
|
|
|
implementation 'com.hyman:flowlayout-lib:1.1.2'
|
|
|
|
|
|
|
|
implementation 'com.liulishuo.filedownloader:library:1.7.7'
|
|
|
|
|
|
|
|
//SwipeBackLayout
|
|
|
|
implementation 'me.imid.swipebacklayout.lib:library:1.1.0'
|
|
|
|
|
|
|
|
//JS
|
|
|
|
//noinspection GradleDependency
|
|
|
|
implementation 'com.github.gedoor:rhino-android:1.6'
|
|
|
|
|
|
|
|
//XXPermissions
|
|
|
|
implementation 'com.github.getActivity:XXPermissions:11.2'
|
|
|
|
|
|
|
|
//epub
|
|
|
|
implementation('com.positiondev.epublib:epublib-core:3.1') {
|
|
|
|
exclude group: 'org.slf4j'
|
|
|
|
exclude group: 'xmlpull'
|
|
|
|
}
|
|
|
|
|
|
|
|
implementation 'com.nshmura:recyclertablayout:1.5.0'
|
|
|
|
|
|
|
|
// https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j
|
|
|
|
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.9.1'
|
|
|
|
|
|
|
|
|
|
|
|
//协程
|
|
|
|
def coroutines_version = '1.5.1'
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
|
|
|
|
|
|
|
|
//apache
|
|
|
|
implementation('org.apache.commons:commons-text:1.9')
|
|
|
|
|
|
|
|
//DDSDK
|
|
|
|
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
|
|
|
|
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
|
|
|
|
implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
|
|
|
|
implementation 'com.lzy.net:okgo:3.0.4'
|
|
|
|
implementation 'com.pangle.cn:ads-sdk-pro:4.2.5.2'
|
|
|
|
implementation('com.facebook.fresco:fresco:0.12.0') {
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude group: 'com.android.support'
|
|
|
|
}
|
|
|
|
implementation('com.facebook.fresco:animated-gif:0.12.0') {
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude group: 'com.android.support'
|
|
|
|
}
|
|
|
|
implementation('com.facebook.fresco:animated-webp:0.12.0') {
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude group: 'com.android.support'
|
|
|
|
}
|
|
|
|
implementation('com.facebook.fresco:webpsupport:0.12.0') {
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude group: 'com.android.support'
|
|
|
|
}
|
|
|
|
|
|
|
|
//https://github.com/fengyuecanzhu/Maple
|
|
|
|
implementation("me.fycz.maple:maple:1.8")
|
|
|
|
}
|
|
|
|
|
|
|
|
greendao {
|
|
|
|
schemaVersion 35
|
|
|
|
daoPackage 'xyz.fycz.myreader.greendao.gen'
|
|
|
|
// targetGenDir 'src/main/java'
|
|
|
|
}
|