Skip to content

Commit 43f97c9

Browse files
author
matrixdev
committed
updated documentation
1 parent 0ab60d4 commit 43f97c9

File tree

2 files changed

+47
-19
lines changed

2 files changed

+47
-19
lines changed

README.md

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Add `androidRust` configuration
3030

3131
```kotlin
3232
androidRust {
33-
path = file("src/rust_library") // path to your rust library
33+
module("rust-library") {
34+
path = file("src/rust_library")
35+
}
3436
}
3537
```
3638

@@ -40,28 +42,54 @@ This is the list of some additional flags that can be configured:
4042

4143
```kotlin
4244
androidRust {
43-
path = file("src/rust_library")
44-
45-
// default rust profile
46-
profile = "release"
47-
48-
// default abi targets
49-
targets = setOf("arm", "arm64")
50-
5145
// MSRV, plugin will update rust if installed version is lower than requested
5246
minimumSupportedRustVersion = "1.62.1"
53-
54-
// "debug" build type specific configuration
55-
buildType("debug") {
56-
// use "dev" profile in rust
57-
profile = "dev"
47+
48+
module("rust-library") {
49+
// path to your rust library
50+
path = file("src/rust_library")
51+
52+
// default rust profile
53+
profile = "release"
54+
55+
// default abi targets
56+
targets = setOf("arm", "arm64")
57+
58+
// "debug" build type specific configuration
59+
buildType("debug") {
60+
// use "dev" profile in rust
61+
profile = "dev"
62+
}
63+
64+
// "release" build type specific configuration
65+
buildType("release") {
66+
// run rust tests before build
67+
runTests = true
68+
69+
// build all supported abi versions
70+
targets = setOf("arm", "arm64", "x86", "x86_64")
71+
}
5872
}
5973

60-
// "release" build type specific configuration
61-
buildType("release") {
62-
// build all supported abi versions
63-
targets = setOf("arm", "arm64", "x86", "x86_64")
74+
// more than one library can be added
75+
module("additional-library") {
76+
// ...
6477
}
6578
}
6679
```
6780

81+
# Development support
82+
83+
Plugin will check for a magic property `android.injected.build.abi` set by Android Studio when
84+
running application on device. This will limit ABI targets to only required by the device and
85+
should speedup development quite a bit.
86+
87+
In theory this should behave the same as a built-in support for the NdkBuild / CMake.
88+
89+
# Goals
90+
- Building multiple rust libraries with ease
91+
- Allow builds to be configurable for common scenarios
92+
93+
# Non-goals
94+
- Supporting all Gradle versions
95+
- Allow builds to be configurable for exotic scenarios

plugin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ gradlePlugin {
3030
id = "io.github.MatrixDev.android-rust"
3131
implementationClass = "dev.matrix.agp.rust.AndroidRustPlugin"
3232
displayName = "Plugin for building Rust with Cargo in Android projects"
33-
description = "A plugin that helps build Rust JNI libraries with Cargo for use in Android projects."
33+
description = "This plugin helps with building Rust JNI libraries with Cargo for use in Android projects."
3434
}
3535
}
3636
}

0 commit comments

Comments
 (0)