1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-14 21:30:13 +01:00
NekoX/ss-rust/build.gradle.kts

52 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-06-25 06:14:31 +02:00
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android")
}
android {
ndkVersion = rootProject.extra.get("ndkVersion").toString()
2020-07-27 06:49:42 +02:00
compileSdkVersion(30)
2020-06-25 06:14:31 +02:00
defaultConfig {
2020-07-27 06:49:42 +02:00
minSdkVersion(23)
targetSdkVersion(30)
2020-06-25 06:14:31 +02:00
}
2020-07-27 06:49:42 +02:00
buildToolsVersion = "30.0.1"
2020-06-25 06:14:31 +02:00
}
cargo {
module = "src/main/rust/shadowsocks-rust"
libname = "ss-local"
targets = listOf("arm", "arm64", "x86", "x86_64")
profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
extraCargoBuildArguments = listOf("--bin", "sslocal")
featureSpec.noDefaultBut(arrayOf(
"sodium",
"rc4",
"aes-cfb",
"aes-ctr",
"camellia-cfb",
"openssl-vendored"))
exec = { spec, toolchain ->
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
}
}
tasks.whenTaskAdded {
when (name) {
"mergeDebugJniLibFolders", "mergeReleaseJniLibFolders" -> dependsOn("cargoBuild")
}
}
tasks.register<Exec>("cargoClean") {
executable("cargo") // cargo.cargoCommand
args("clean")
workingDir("$projectDir/${cargo.module}")
}
tasks.clean.dependsOn("cargoClean")