-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
/
build.gradle.kts
90 lines (77 loc) · 3 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android")
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
}
setupCore()
android {
defaultConfig {
consumerProguardFiles("proguard-rules.pro")
externalNativeBuild.ndkBuild {
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
arguments("-j${Runtime.getRuntime().availableProcessors()}")
}
kapt.arguments {
arg("room.incremental", true)
arg("room.schemaLocation", "$projectDir/schemas")
}
}
externalNativeBuild.ndkBuild.path("src/main/jni/Android.mk")
sourceSets.getByName("androidTest") {
assets.setSrcDirs(assets.srcDirs + files("$projectDir/schemas"))
}
}
cargo {
module = "src/main/rust/shadowsocks-rust"
libname = "sslocal"
targets = listOf("arm", "arm64", "x86", "x86_64")
profile = findProperty("CARGO_PROFILE")?.toString() ?: currentFlavor
extraCargoBuildArguments = listOf("--bin", libname!!)
featureSpec.noDefaultBut(arrayOf(
"stream-cipher",
"logging",
"local-flow-stat",
"local-dns"))
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")
dependencies {
val coroutinesVersion = "1.4.2"
val roomVersion = "2.3.0-rc01"
val workVersion = "2.5.0"
api(project(":plugin"))
api("androidx.core:core-ktx:1.5.0-rc01")
api("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion")
api("androidx.lifecycle:lifecycle-livedata-core-ktx:$lifecycleVersion")
api("androidx.preference:preference:1.1.1")
api("androidx.room:room-runtime:$roomVersion")
api("androidx.work:work-multiprocess:$workVersion")
api("androidx.work:work-runtime-ktx:$workVersion")
api("com.google.android.gms:play-services-oss-licenses:17.0.0")
api("com.google.code.gson:gson:2.8.6")
api("com.google.firebase:firebase-analytics-ktx:18.0.3")
api("com.google.firebase:firebase-crashlytics:17.4.1")
api("com.jakewharton.timber:timber:4.7.1")
api("dnsjava:dnsjava:3.3.1")
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
api("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion")
kapt("androidx.room:room-compiler:$roomVersion")
androidTestImplementation("androidx.room:room-testing:$roomVersion")
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.2")
}