2025-07-31 17:09:18 +08:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
2025-05-02 02:24:12 +08:00
|
|
|
|
2025-04-09 16:46:14 +08:00
|
|
|
plugins {
|
|
|
|
|
id("com.android.library")
|
|
|
|
|
id("org.jetbrains.kotlin.android")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
namespace = "com.follow.clash.core"
|
2025-07-31 17:09:18 +08:00
|
|
|
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
|
|
|
ndkVersion = libs.versions.ndkVersion.get()
|
2025-04-09 16:46:14 +08:00
|
|
|
|
|
|
|
|
defaultConfig {
|
2025-07-31 17:09:18 +08:00
|
|
|
minSdk = libs.versions.minSdk.get().toInt()
|
2025-04-09 16:46:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
|
getByName("main") {
|
|
|
|
|
jniLibs.srcDirs("src/main/jniLibs")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
|
cmake {
|
|
|
|
|
path("src/main/cpp/CMakeLists.txt")
|
|
|
|
|
version = "3.22.1"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-18 17:50:46 +08:00
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
2025-04-09 16:46:14 +08:00
|
|
|
}
|
2025-07-31 17:09:18 +08:00
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
release {
|
|
|
|
|
proguardFiles(
|
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
|
"proguard-rules.pro"
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-09 16:46:14 +08:00
|
|
|
}
|
2025-07-31 17:09:18 +08:00
|
|
|
|
|
|
|
|
kotlin {
|
|
|
|
|
compilerOptions {
|
|
|
|
|
jvmTarget.set(JvmTarget.JVM_17)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-04-18 17:50:46 +08:00
|
|
|
dependencies {
|
2025-07-31 17:09:18 +08:00
|
|
|
implementation(libs.annotation.jvm)
|
2025-04-18 17:50:46 +08:00
|
|
|
}
|
2025-04-09 16:46:14 +08:00
|
|
|
|
|
|
|
|
val copyNativeLibs by tasks.register<Copy>("copyNativeLibs") {
|
|
|
|
|
doFirst {
|
|
|
|
|
delete("src/main/jniLibs")
|
|
|
|
|
}
|
|
|
|
|
from("../../libclash/android")
|
|
|
|
|
into("src/main/jniLibs")
|
2025-07-31 17:09:18 +08:00
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
val includesDir = file("src/main/jniLibs/includes")
|
|
|
|
|
val targetDir = file("src/main/cpp/includes")
|
|
|
|
|
if (includesDir.exists()) {
|
|
|
|
|
copy {
|
|
|
|
|
from(includesDir)
|
|
|
|
|
into(targetDir)
|
|
|
|
|
}
|
|
|
|
|
delete(includesDir)
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-09 16:46:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
|
tasks.named("preBuild") {
|
|
|
|
|
dependsOn(copyNativeLibs)
|
|
|
|
|
}
|
|
|
|
|
}
|