File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed
Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ # AndroidRust Gradle Plugin
2+
3+ This plugin helps with building Rust JNI libraries with Cargo for use in Android projects.
4+
5+ # Usage
6+
7+ Add dependencies to the root ` build.gradle.kts ` file
8+
9+ ``` kotlin
10+ buildscript {
11+ repositories {
12+ maven(" https://plugins.gradle.org/m2/" )
13+ }
14+
15+ dependencies {
16+ classpath(" dev.matrix.android-rust:0.1.0" )
17+ }
18+ }
19+ ```
20+
21+ Add plugin to the module's ` build.gradle.kts ` file
22+
23+ ``` kotlin
24+ plugins {
25+ id(" dev.matrix.android-rust" )
26+ }
27+ ```
28+
29+ Add ` androidRust ` configuration
30+
31+ ``` kotlin
32+ androidRust {
33+ path = file(" src/rust_library" ) // path to your rust library
34+ }
35+ ```
36+
37+ # Additional configurations
38+
39+ This is the list of some additional flags that can be configured:
40+
41+ ``` kotlin
42+ androidRust {
43+ path = file(" src/rust_library" )
44+
45+ // default rust profile
46+ profile = " release"
47+
48+ // default abi targets
49+ targets = setOf (Abi .Arm , Abi .Arm64 )
50+
51+ // MSRV, plugin will update rust if installed version is lower than requested
52+ minimumSupportedRustVersion = SemanticVersion (" 1.62.1" )
53+
54+ // "debug" build type specific configuration
55+ buildType(" debug" ) {
56+ // use "dev" profile in rust
57+ it.profile = " dev"
58+
59+ // build only Arm64 version
60+ it.targets = setOf (Abi .Arm64 )
61+ }
62+
63+ // "release" build type specific configuration
64+ buildType(" release" ) {
65+ // build all supported abi versions
66+ it.targets = setOf (Abi .Arm , Abi .Arm64 , Abi .X86 , Abi .X86_64 )
67+ }
68+ }
69+ ```
70+
You can’t perform that action at this time.
0 commit comments