Chore: 切换 clash 内核到自有仓库并补全本地构建
- .gitmodules: clash-foss 指向 tongtongstudio/Dreamacro_clash,premium 条目注释保留 - 移除 premium gitlink,premium 变体仍由 variantFilter 自动跳过 - 新增 scripts/build-clash-core.ps1,本地构建 4 个 ABI 的 libclash.so - kaidl 改用本地 mavenLocal 的 1.15;CMake 传入 GO_OUTPUT 并通过 jniLibs 打包 libclash.so
This commit is contained in:
1 parent
8506303693
commit
dce9562944
10 files changed
+166
-39
No files matched your search
+30
-23
@@ -1,5 +1,5 @@
|
||||
import com.github.kr328.golang.GolangBuildTask
|
||||
import com.github.kr328.golang.GolangPlugin
|
||||
//import com.github.kr328.golang.GolangBuildTask
|
||||
//import com.github.kr328.golang.GolangPlugin
|
||||
import java.io.FileOutputStream
|
||||
import java.net.URL
|
||||
import java.time.Duration
|
||||
@@ -8,7 +8,7 @@ plugins {
|
||||
kotlin("android")
|
||||
id("com.android.library")
|
||||
id("kotlinx-serialization")
|
||||
id("golang-android")
|
||||
// id("golang-android")
|
||||
}
|
||||
|
||||
val geoipDatabaseUrl =
|
||||
@@ -17,22 +17,22 @@ val geoipInvalidate = Duration.ofDays(7)!!
|
||||
val geoipOutput = buildDir.resolve("intermediates/golang_blob")
|
||||
val golangSource = file("src/main/golang/native")
|
||||
|
||||
golang {
|
||||
sourceSets {
|
||||
create("foss") {
|
||||
tags.set(listOf("foss"))
|
||||
srcDir.set(file("src/foss/golang"))
|
||||
}
|
||||
create("premium") {
|
||||
tags.set(listOf("premium", "without_gvisor", "without_system"))
|
||||
srcDir.set(file("src/premium/golang"))
|
||||
}
|
||||
all {
|
||||
fileName.set("libclash.so")
|
||||
packageName.set("cfa/native")
|
||||
}
|
||||
}
|
||||
}
|
||||
//golang {
|
||||
// sourceSets {
|
||||
// create("foss") {
|
||||
// tags.set(listOf("foss"))
|
||||
// srcDir.set(file("src/foss/golang"))
|
||||
// }
|
||||
// create("premium") {
|
||||
// tags.set(listOf("premium", "without_gvisor", "without_system"))
|
||||
// srcDir.set(file("src/premium/golang"))
|
||||
// }
|
||||
// all {
|
||||
// fileName.set("libclash.so")
|
||||
// packageName.set("cfa/native")
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
android {
|
||||
productFlavors {
|
||||
@@ -40,7 +40,7 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments("-DGO_SOURCE:STRING=${golangSource}")
|
||||
arguments("-DGO_OUTPUT:STRING=${GolangPlugin.outputDirOf(project, null, null)}")
|
||||
arguments("-DGO_OUTPUT:STRING=${rootProject.buildDir}/golang")
|
||||
arguments("-DFLAVOR_NAME:STRING=$name")
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,13 @@ android {
|
||||
path = file("src/main/cpp/CMakeLists.txt")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
// 手动构建的 libclash.so 通过 jniLibs 打包进 APK(原 golang 插件被禁用后需手工提供)
|
||||
jniLibs.srcDir(rootProject.buildDir.resolve("golang/fossDebug"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -63,9 +70,9 @@ dependencies {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.withType(GolangBuildTask::class.java).forEach {
|
||||
it.inputs.dir(golangSource)
|
||||
}
|
||||
// tasks.withType(GolangBuildTask::class.java).forEach {
|
||||
// it.inputs.dir(golangSource)
|
||||
// }
|
||||
}
|
||||
|
||||
task("downloadGeoipDatabase") {
|
||||
|
||||
Reference in new issue
Block a user