-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I have a toy android app for which I implement as much functionality as I can in Rust, with a Kotlin UI on the top. I use the rust-android-gradle plugin to make the build work in Android Studio, which has been relatively smooth sailing for several years now.
I am not at all a gradle expert, so I had to fight a bit (with the help of ChatGPT π¬) to get some configuration for rust-android-gradle to feed the right environment for duchess.
I thought I'd share it here in case anyone has better ideas on how to integrate a project using duchess into an android app, and also in case anyone else is trying this sort of thing. Also feel free to treat this just as informational and close the issue π
cargo {
module = "../../client-lib"
libname = "toyproject"
targets = ["arm64"]
targetDirectory = "../../target"
exec { spec, toolchain ->
// Classpath of the android SDK
def classPath = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
// Classpath of the build outputs
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
// Java outputs (if you have any java files)
classPath += ";${variant.javaCompileProvider.get().destinationDir}"
// Kotlin outputs (if you have any kotlin files)
def kotlinTaskName = "compile${variant.name.capitalize()}Kotlin"
def kotlinTask = tasks.named(kotlinTaskName).get()
if (kotlinTask) {
classPath += ";${kotlinTask.outputs.files.join(";")}"
}
}
}
spec.environment("CLASSPATH", classPath)
// Set JAVA_HOME so that duchess can find javap
spec.environment("JAVA_HOME", System.getProperty('java.home'))
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels