178 lines
5.7 KiB
Plaintext
178 lines
5.7 KiB
Plaintext
import java.net.URL
|
|
import java.nio.file.Files
|
|
import java.nio.file.StandardCopyOption
|
|
|
|
plugins {
|
|
kotlin("android")
|
|
kotlin("kapt")
|
|
id("com.android.application")
|
|
id("kotlin-parcelize")
|
|
id("com.google.devtools.ksp")
|
|
id("kotlinx-serialization")
|
|
}
|
|
|
|
dependencies {
|
|
implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar"))))
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
|
implementation(files("src/main/libs/openinstall.jar"))
|
|
|
|
// compileOnly(project(":hideapi"))
|
|
// implementation(project(":core"))
|
|
// implementation(project(":service"))
|
|
// implementation(project(":common"))
|
|
ksp(libs.kaidl.compiler)
|
|
ksp(libs.androidx.room.compiler)
|
|
implementation(libs.kotlin.coroutine)
|
|
implementation(libs.kotlin.serialization.json)
|
|
implementation(libs.androidx.core)
|
|
implementation(libs.androidx.room.runtime)
|
|
implementation(libs.androidx.room.ktx)
|
|
implementation(libs.kaidl.runtime)
|
|
implementation(libs.rikkax.multiprocess)
|
|
val commonAar = file("libs/common.aar")
|
|
val coreAar = file("libs/core.aar")
|
|
val hideapiAar = file("libs/hideapi.aar")
|
|
val serviceAar = file("libs/service.aar")
|
|
|
|
|
|
if (commonAar.exists()) {
|
|
implementation(files(commonAar))
|
|
} else {
|
|
println("common.aar does not exist")
|
|
}
|
|
|
|
if (coreAar.exists()) {
|
|
implementation(files(coreAar))
|
|
} else {
|
|
println("core.aar does not exist")
|
|
}
|
|
|
|
if (hideapiAar.exists()) {
|
|
implementation(files(hideapiAar))
|
|
} else {
|
|
println("hideapi.aar does not exist")
|
|
}
|
|
if (serviceAar.exists()) {
|
|
implementation(files(serviceAar))
|
|
} else {
|
|
println("service.aar does not exist")
|
|
}
|
|
|
|
implementation(libs.kotlin.coroutine)
|
|
implementation(libs.androidx.core)
|
|
// implementation(libs.androidx.activity)
|
|
// implementation(libs.androidx.fragment)
|
|
implementation(libs.androidx.appcompat)
|
|
implementation(libs.androidx.coordinator)
|
|
implementation(libs.androidx.recyclerview)
|
|
implementation(libs.google.material)
|
|
|
|
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
|
|
|
|
// https://mvnrepository.com/artifact/com.tencent/mmkv-static
|
|
implementation("com.tencent:mmkv-static:1.2.10")
|
|
|
|
implementation("com.afollestad.material-dialogs:core:3.2.1")
|
|
//Retrofit 网络请求库
|
|
api("com.squareup.retrofit2:retrofit:2.9.0")
|
|
api("com.squareup.retrofit2:converter-gson:2.9.0")
|
|
api("com.squareup.retrofit2:converter-scalars:2.9.0")
|
|
api("com.orhanobut:logger:2.2.0")
|
|
api("com.google.code.gson:gson:2.10.1")
|
|
api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
|
|
|
|
// define any required OkHttp artifacts without version
|
|
api("com.squareup.okhttp3:okhttp")
|
|
api("com.squareup.okhttp3:logging-interceptor")
|
|
//// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
|
// api("com.google.code.gson:gson:2.10.1")
|
|
api("org.yaml:snakeyaml:1.29")
|
|
|
|
// https://mvnrepository.com/artifact/com.al\ipay.sdk/alipaysdk-android
|
|
implementation("com.alipay.sdk:alipaysdk-android:15.8.17")
|
|
// https://mvnrepository.com/artifact/com.journeyapps/zxing-android-embedded
|
|
implementation("com.journeyapps:zxing-android-embedded:3.6.0")
|
|
|
|
// https://mvnrepository.com/artifact/com.google.zxing/core
|
|
implementation("com.google.zxing:core:3.5.3")
|
|
implementation("com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4")
|
|
// https://mvnrepository.com/artifact/com.airbnb.android/lottie
|
|
implementation("com.airbnb.android:lottie:5.2.0")
|
|
// https://mvnrepository.com/artifact/com.github.bumptech.glide/glide
|
|
implementation("com.github.bumptech.glide:glide:4.13.2")
|
|
// implementation("com.luozm.captcha:captcha:1.1.2")
|
|
implementation("com.aliyun.dpa:oss-android-sdk:2.9.19")
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
tasks.getByName("clean", type = Delete::class) {
|
|
delete(file("release"))
|
|
}
|
|
|
|
val geoFilesDownloadDir = "src/main/assets"
|
|
|
|
task("downloadGeoFiles") {
|
|
|
|
val geoFilesUrls = mapOf(
|
|
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb" to "geoip.metadb",
|
|
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" to "geosite.dat",
|
|
// "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb" to "country.mmdb",
|
|
)
|
|
|
|
doLast {
|
|
geoFilesUrls.forEach { (downloadUrl, outputFileName) ->
|
|
val url = URL(downloadUrl)
|
|
val outputPath = file("$geoFilesDownloadDir/$outputFileName")
|
|
if (!outputPath.exists()) {
|
|
outputPath.parentFile.mkdirs()
|
|
url.openStream().use { input ->
|
|
Files.copy(input, outputPath.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
|
println("$outputFileName downloaded to $outputPath")
|
|
}
|
|
} else {
|
|
println("$outputFileName exists $outputPath")
|
|
//如果存在就从该文件复制
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
afterEvaluate {
|
|
val downloadGeoFilesTask = tasks["downloadGeoFiles"]
|
|
|
|
tasks.forEach {
|
|
if (it.name.startsWith("assemble")) {
|
|
it.dependsOn(downloadGeoFilesTask)
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.getByName("clean", type = Delete::class) {
|
|
delete(file(geoFilesDownloadDir + "/geoip.metadb"))
|
|
delete(file(geoFilesDownloadDir + "/geosite.dat"))
|
|
}
|
|
android {
|
|
defaultConfig {
|
|
ndk {
|
|
abiFilters.add("arm64-v8a")
|
|
abiFilters.add("armeabi-v7a")
|
|
}
|
|
}
|
|
// sourceSets.all {
|
|
// jniLibs.srcDir("src/main/jniLibs")
|
|
// }
|
|
|
|
}
|
|
repositories {
|
|
flatDir {
|
|
dirs("src/main/libs")
|
|
}
|
|
mavenCentral()
|
|
}
|