forked from SagerNet/SagerNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
49 lines (41 loc) · 1.26 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android")
}
android {
compileSdkVersion(30)
defaultConfig {
minSdkVersion(21)
targetSdkVersion(30)
}
buildToolsVersion = "30.0.3"
}
cargo {
module = "src/main/rust/shadowsocks-rust"
libname = "sslocal"
targets = listOf("arm", "arm64", "x86", "x86_64")
profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
extraCargoBuildArguments = listOf("--bin", "sslocal")
featureSpec.noDefaultBut(arrayOf(
"local",
"stream-cipher",
"logging"))
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")