Treader-open/app/build.gradle

345 lines
11 KiB
Groovy

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("org.jetbrains.kotlin.plugin.compose")
// id 'com.google.gms.google-services'
}
def taskName = getGradle().getStartParameter().getTaskRequests().toString()
android {
compileSdk 36
namespace = "com.dev.pdf.info"
defaultConfig {
namespace = "com.dev.pdf.info"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "0.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86' // 只包含需要的架构
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
configurations {
configureEach {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
lint {
abortOnError = true
ignoreWarnings = true
checkReleaseBuilds = taskName.contains("Pro")
}
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
signingConfigs {
release {
storeFile file("keystore.pkcs12")
storePassword "123456"
keyAlias "1"
keyPassword "1"
}
}
buildTypes {
release {
minifyEnabled = true
signingConfig = signingConfigs.release
debuggable = false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable = true
}
}
buildFeatures {
compose true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
//compileOptions {
//coreLibraryDesugaringEnabled true
//sourceCompatibility JavaVersion.VERSION_1_8
//targetCompatibility JavaVersion.VERSION_1_8
//}
splits {
abi {
enable = true
reset()
include "x86", "armeabi-v7a", "arm64-v8a"
universalApk = true
}
}
// flavorDimensions.add("version")
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86': 2, 'x86_64': 3]
// applicationVariants.all { variant ->
//
// variant.outputs.all { output ->
//
// def flavor = variant.productFlavors[0].name.capitalize()
// def abiName = getFilter("ABI")
///* if (abiName == "armeabi-v7a") {
// variant.mergedFlavor.manifestPlaceholders.appSafeMode = "true"
// //variant.resValue "string", "[appSafeMode]", "true"
// println abiName + " : appSafeMode true "
// } else {
// variant.mergedFlavor.manifestPlaceholders.appSafeMode = "true"
// //variant.resValue "string", "[appSafeMode]", "false"
// println abiName + " : appSafeMode false"
// }
//*/
// if (abiName != null) {
// def code = abiCodes.get(abiName, 0) + variant.versionCode
// abiName = abiName.replace("arm64-v8a", "arm64").replace("armeabi-v7a", "arm")
//
// output.versionCodeOverride = code
// //def fullName = "Librera ${flavor}-${versionNumber}-c${code}-d${db}-${abiName}.apk"
//
// def fullName = "Librera ${flavor}-${versionNumber}-${abiName}.apk"
//
// output.outputFileName = fullName
// } else {
// //def fullName = "Librera ${flavor}-${versionNumber}-c${codeNumber}-d${db}-universal.apk"
// //def fullName = "Librera ${flavor}-${versionNumber}-universal.apk"
// def fullName = "Librera ${flavor}-${versionNumber}-uni.apk"
// output.versionCodeOverride = codeNumber
// output.outputFileName = fullName
// }
// }
// }
// sourceSets {
// fdroid { assets.srcDirs = ['src/fdroid/assets', 'src/fdroid/assets/'] }
// }
packagingOptions {
resources {
excludes.addAll(
'META-INF/DEPENDENCIES',
'META-INF/NOTICE',
'META-INF/LICENSE',
'META-INF/LICENSE.txt',
'META-INF/NOTICE.txt',
)
}
}
kotlinOptions {
jvmTarget = '11'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// proImplementation project(':libPro')
// fdroidImplementation project(':libPro')
implementation project(':libReflow')
//compose
implementation project(':appLibDrive')
// curl
implementation("io.github.oleksandrbalan:pagecurl:1.5.1")
/** AndroidX **/
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.work:work-runtime:2.10.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
/** Third-party **/
//implementation 'com.github.axet:lame:1.0.9'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation('org.greenrobot:greendao:3.3.0') {
exclude group: 'org.greenrobot.greendao.rx'
}
implementation 'org.greenrobot:greendao-api:3.3.0'
implementation 'org.jsoup:jsoup:1.21.1'
implementation 'com.github.albfernandez:juniversalchardet:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.6'
implementation 'io.github.rburgst:okhttp-digest:1.21'
implementation 'com.squareup.okio:okio-parent:1.17.6'
implementation 'com.github.joniles:rtfparserkit:1.16.0'
implementation 'org.zwobble.mammoth:mammoth:1.5.0'
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'net.lingala.zip4j:zip4j:2.11.5'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation("com.github.bumptech.glide:compose:1.0.0-beta01")
implementation 'androidx.core:core-ktx:1.16.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.2'
implementation 'androidx.activity:activity-compose:1.10.1'
implementation platform('androidx.compose:compose-bom:2024.09.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.activity:activity:1.10.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.09.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
//implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
//conflict with worker
implementation "commons-logging:commons-logging-api:1.1"
implementation "com.github.junrar:junrar:4.0.0"
implementation 'androidx.work:work-runtime:2.10.2'
implementation 'com.google.guava:guava:33.4.8-android'
//implementation "it.unimi.dsi:fastutil-core:8.5.12"
//implementation "androidx.car.app:app:1.4.0-rc01"
//implementation("androidx.media3:media3-ui:1.1.1")
//implementation('androidx.media3:media3-session:1.3.0')
//implementation "org.nanohttpd:nanohttpd:2.3.1"
/** Testing **/
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.6.2'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
//androidTestImplementation 'androidx.test:core:1.5.2'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
task copyApks() {
if (project.hasProperty('beta') || project.hasProperty("release")) {
println "My Task: [copy apks]"
//delete fileTree("/home/dev/Dropbox/FREE_PDF_APK/testing").include("*.apk")
//delete fileTree("/home/dev/Nextcloud/LibreraBeta").include("*.apk")
delete fileTree("/Users/ivanivanenko/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing").include("*.apk")
delete fileTree("/Users/ivanivanenko/Library/CloudStorage/Dropbox/FREE_PDF_APK/$versionNumber").include("*.apk")
//delete fileTree("/home/dev/Dropbox/FREE_PDF_APK/testing/$versionNumber").include("*.apk")
android.applicationVariants.all { variant ->
if ("release" == variant.buildType.name) {
def flavor = variant.productFlavors[0].name
//println "==== " + variant.buildType.name + " " + flavor
def list = []
if (project.hasProperty("beta")) {
//list.add("/home/dev/Nextcloud/LibreraBeta")
list.add("/Users/ivanivanenko/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing")
//list.add("/home/dev/Dropbox/FREE_PDF_APK/testing")
}
if (project.hasProperty("release")) {
//list.add("/home/dev/Dropbox/FREE_PDF_APK/testing/$versionNumber")
list.add("/Users/ivanivanenko/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing/$versionNumber")
}
list.each { dest ->
copy {
from file(
"build/outputs/apk/${flavor}/release/"
)
include "*.apk"
into file(dest)
println "Copy: '" + flavor + "' to " + dest
eachFile {
project.file(dest).mkdirs()
if (!file(dest).exists()) {
it.exclude()
}
}
}
}
}
}
//File file = new File('/home/data/Dropbox/FREE_PDF_APK/testing/version.txt')
//file.write versionNumber
}
}
task incVersion() {
doLast {
Properties props = new Properties()
File progejectDir = layout.projectDirectory.getAsFile()
println "progejectDir :" + progejectDir
File propsFile = new File(progejectDir, 'gradle.properties')
props.load(propsFile.newDataInputStream())
int appCodeNumber = Integer.parseInt(props.getProperty('appCodeNumber'))
appCodeNumber += 4
int appVersionNumberIndex = Integer.parseInt(props.getProperty('appVersionNumberIndex'))
appVersionNumberIndex += 1
props.setProperty('appCodeNumber', "" + appCodeNumber)
props.setProperty('appVersionNumberIndex', "" + appVersionNumberIndex)
props.store(propsFile.newWriter(), null)
println "My Task: [incVersion]"
}
}
//if (!taskName.contains("Fdroid")) {
// dependencies {
// implementation "com.github.junrar:junrar:4.0.0"
//
// }
//}