You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add plugin to the module's `build.gradle.kts` file
25
+
26
+
```kotlin
27
+
plugins {
28
+
id("io.github.MatrixDev.android-rust")
29
+
}
30
+
```
31
+
32
+
Add `androidRust` configuration
33
+
34
+
```kotlin
35
+
androidRust {
36
+
module("rust-library") {
37
+
path = file("src/rust_library")
38
+
}
39
+
}
40
+
```
41
+
42
+
# Additional configurations
43
+
44
+
This is the list of some additional flags that can be configured:
45
+
46
+
```kotlin
47
+
androidRust {
48
+
// MSRV, plugin will update rust if installed version is lower than requested
49
+
minimumSupportedRustVersion ="1.62.1"
50
+
51
+
module("rust-library") {
52
+
// path to your rust library
53
+
path = file("src/rust_library")
54
+
55
+
// default rust profile
56
+
profile ="release"
57
+
58
+
// default abi targets
59
+
targets =listOf("arm", "arm64")
60
+
61
+
// "debug" build type specific configuration
62
+
buildType("debug") {
63
+
// use "dev" profile in rust
64
+
profile ="dev"
65
+
}
66
+
67
+
// "release" build type specific configuration
68
+
buildType("release") {
69
+
// run rust tests before build
70
+
runTests =true
71
+
72
+
// build all supported abi versions
73
+
targets =listOf("arm", "arm64", "x86", "x86_64")
74
+
}
75
+
}
76
+
77
+
// more than one library can be added
78
+
module("additional-library") {
79
+
// ...
80
+
}
81
+
}
82
+
```
83
+
84
+
85
+
# Development support
86
+
Plugin will check for a magic property `android.injected.build.abi` set by Android Studio when
87
+
running application on device. This will limit ABI targets to only required by the device and
88
+
should speedup development quite a bit.
89
+
90
+
In theory this should behave the same as a built-in support for the NdkBuild / CMake.
91
+
92
+
93
+
# Goals
94
+
- Building multiple rust libraries with ease
95
+
- Allow builds to be configurable for common scenarios
96
+
97
+
98
+
# Non-goals
99
+
- Supporting all Gradle versions
100
+
- Allow builds to be configurable for exotic scenarios
101
+
102
+
103
+
# IDE Enviroment PATH Workaround
104
+
On some systems (notably MacOS) gradle task might fail to locate rust binaries. At this moment there are multiple issues/discussions for both gradle and IntelliJ IDEs.
105
+
106
+
To solve this problem cargo path can be provided in `local.properties` file:
0 commit comments