2021-09-11 19:43:32 +03:00
|
|
|
import com.github.kr328.golang.GolangBuildTask
|
2021-09-11 09:53:09 +03:00
|
|
|
import com.github.kr328.golang.GolangPlugin
|
2021-05-14 19:51:08 +03:00
|
|
|
import java.io.FileOutputStream
|
|
|
|
import java.net.URL
|
|
|
|
import java.time.Duration
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
kotlin("android")
|
2021-09-11 09:53:09 +03:00
|
|
|
id("com.android.library")
|
2021-05-14 19:51:08 +03:00
|
|
|
id("kotlinx-serialization")
|
2021-09-11 09:53:09 +03:00
|
|
|
id("golang-android")
|
2021-05-14 19:51:08 +03:00
|
|
|
}
|
|
|
|
|
2021-09-11 19:43:32 +03:00
|
|
|
val golangSource = file("src/main/golang/native")
|
2021-05-14 19:51:08 +03:00
|
|
|
|
2021-09-11 09:53:09 +03:00
|
|
|
golang {
|
|
|
|
sourceSets {
|
2024-09-12 05:53:54 +03:00
|
|
|
create("alpha") {
|
2024-01-16 18:21:27 +03:00
|
|
|
tags.set(listOf("foss","with_gvisor","cmfa"))
|
2021-09-11 19:39:59 +03:00
|
|
|
srcDir.set(file("src/foss/golang"))
|
2021-05-14 19:51:08 +03:00
|
|
|
}
|
2023-05-10 13:10:50 +03:00
|
|
|
create("meta") {
|
2024-01-16 18:21:27 +03:00
|
|
|
tags.set(listOf("foss","with_gvisor","cmfa"))
|
2023-05-10 13:10:50 +03:00
|
|
|
srcDir.set(file("src/foss/golang"))
|
|
|
|
}
|
2021-09-11 09:53:09 +03:00
|
|
|
all {
|
|
|
|
fileName.set("libclash.so")
|
2021-09-11 19:39:59 +03:00
|
|
|
packageName.set("cfa/native")
|
2021-05-14 19:51:08 +03:00
|
|
|
}
|
|
|
|
}
|
2021-09-11 09:53:09 +03:00
|
|
|
}
|
2021-05-14 19:51:08 +03:00
|
|
|
|
2021-09-11 09:53:09 +03:00
|
|
|
android {
|
|
|
|
productFlavors {
|
|
|
|
all {
|
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
2021-09-11 19:43:32 +03:00
|
|
|
arguments("-DGO_SOURCE:STRING=${golangSource}")
|
2021-09-11 09:53:09 +03:00
|
|
|
arguments("-DGO_OUTPUT:STRING=${GolangPlugin.outputDirOf(project, null, null)}")
|
|
|
|
arguments("-DFLAVOR_NAME:STRING=$name")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-14 19:51:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
path = file("src/main/cpp/CMakeLists.txt")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-09-11 09:53:09 +03:00
|
|
|
implementation(project(":common"))
|
2021-05-14 19:51:08 +03:00
|
|
|
|
2022-03-22 08:48:02 +03:00
|
|
|
implementation(libs.androidx.core)
|
|
|
|
implementation(libs.kotlin.coroutine)
|
|
|
|
implementation(libs.kotlin.serialization.json)
|
2021-05-14 19:51:08 +03:00
|
|
|
}
|
|
|
|
|
2021-09-11 19:43:32 +03:00
|
|
|
afterEvaluate {
|
|
|
|
tasks.withType(GolangBuildTask::class.java).forEach {
|
2021-09-11 20:33:52 +03:00
|
|
|
it.inputs.dir(golangSource)
|
2021-09-11 19:43:32 +03:00
|
|
|
}
|
2024-09-11 09:41:22 +03:00
|
|
|
}
|