Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/melts. Idk where this will go but I got an encrypted database in SQLite in Rust on andro
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129import java.util.Locale
plugins { id("com.android.library") id("org.jetbrains.kotlin.android") id("org.mozilla.rust-android-gradle.rust-android")}
android { namespace = "com.example.simple_counter.shared" compileSdk = 34
ndkVersion = "27.0.11902837"
defaultConfig { minSdk = 33 targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") }
buildTypes { release { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" }
sourceSets {// main.java.srcDirs += "${projectDir}/../../shared_types/generated/java" named("main") { java.srcDirs("${projectDir}/../../shared_types/generated/java") } }}
dependencies { implementation("net.java.dev.jna:jna:5.14.0@aar")
implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.appcompat:appcompat:1.7.0") implementation("com.google.android.material:material:1.12.0") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.2.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")}
//apply plugin: "org.mozilla.rust-android-gradle.rust-android"apply(plugin = "org.mozilla.rust-android-gradle.rust-android")cargo { module = "../.." libname = "shared" // these are the four recommended targets for Android that will ensure your library works on all mainline android devices // make sure you have included the rust toolchain for each of these targets: \ // `rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android` targets = listOf("arm", "arm64", "x86", "x86_64") extraCargoBuildArguments = listOf("--package", "shared") pythonCommand = "python3"}
afterEvaluate { // The `cargoBuild` task isn"t available until after evaluation. android.libraryVariants.configureEach { var productFlavor = "" productFlavors.forEach { flavor -> productFlavor += flavor.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase( Locale.getDefault() ) else it.toString() } } val buildType = buildType.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }
tasks.named("compileDebugKotlin") { dependsOn(tasks.named("typesGen"), tasks.named("bindGen")) }
tasks.named("generate${productFlavor}${buildType}Assets") { dependsOn(tasks.named("cargoBuild")) } }}
tasks.register<Exec>("bindGen") { val outDir = "${projectDir}/../../shared_types/generated/java" workingDir = File("../../") if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("windows")) { commandLine( "cmd", "/c", "cargo build -p shared && " + "target\\debug\\uniffi-bindgen generate shared\\src\\shared.udl " + "--language kotlin " + "--out-dir " + outDir.replace( "/", "\\" ) ) } else { commandLine( "sh", "-c", """\ cargo build -p shared && \ target/debug/uniffi-bindgen generate shared/src/shared.udl \ --language kotlin \ --out-dir $outDir """ ) }}
tasks.register<Exec>("typesGen") { workingDir = File("../../") if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("windows")) { commandLine("cmd", "/c", "cargo build -p shared_types") } else { commandLine("sh", "-c", "cargo build -p shared_types") }}