Scaffold native Android build and enforce Rust boundaries (#89)
Dependency security audit / rustsec (push) Failing after 22s
Dependency security audit / rustsec (push) Failing after 22s
This commit is contained in:
1 parent
30d9119302
commit
e079b82b15
62 files changed
+5822
No files matched your search
@@ -0,0 +1,77 @@
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "de.rfc1437.ironstorage.core"
|
||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||
ndkVersion = libs.versions.ndk.get()
|
||||
defaultConfig {
|
||||
minSdk = libs.versions.minSdk.get().toInt()
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
defaultConfig { consumerProguardFiles("consumer-rules.pro") }
|
||||
lint {
|
||||
abortOnError = true
|
||||
warningsAsErrors = true
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(25)
|
||||
compilerOptions { jvmTarget.set(JvmTarget.JVM_17) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":rust-bridge"))
|
||||
implementation(libs.coroutines.android)
|
||||
testImplementation(libs.coroutines.test)
|
||||
testImplementation(libs.junit)
|
||||
}
|
||||
|
||||
val fixtureOutput = layout.buildDirectory.file(
|
||||
"generated/fixtures/de/rfc1437/ironstorage/core/ShellFixtures.kt"
|
||||
)
|
||||
val cargoExecutable = providers.environmentVariable("CARGO")
|
||||
.orElse(
|
||||
providers.environmentVariable("PATH").map { path ->
|
||||
path.split(File.pathSeparatorChar)
|
||||
.map { File(it, "cargo") }
|
||||
.firstOrNull { it.isFile && it.canExecute() }?.absolutePath
|
||||
?: error("Cargo is required: put it in PATH or set CARGO to its absolute path")
|
||||
}
|
||||
)
|
||||
val workspace = rootProject.layout.projectDirectory.dir("..").asFile
|
||||
val generateShellFixtures = tasks.register<Exec>("generateShellFixtures") {
|
||||
workingDir = workspace
|
||||
inputs.files(
|
||||
workspace.resolve("Cargo.toml"),
|
||||
workspace.resolve("Cargo.lock"),
|
||||
workspace.resolve("tools/android-build/Cargo.toml"),
|
||||
workspace.resolve("tools/android-build/src/main.rs"),
|
||||
workspace.resolve("crates/storage/src/mobile.rs")
|
||||
)
|
||||
outputs.file(fixtureOutput)
|
||||
commandLine(
|
||||
cargoExecutable.get(),
|
||||
"run",
|
||||
"--locked",
|
||||
"--package",
|
||||
"ironstorage-android-build",
|
||||
"--",
|
||||
"fixtures",
|
||||
fixtureOutput.get().asFile.absolutePath
|
||||
)
|
||||
}
|
||||
androidComponents.onVariants(androidComponents.selector().withBuildType("debug")) { variant ->
|
||||
variant.sources.kotlin!!.addStaticSourceDirectory(
|
||||
layout.buildDirectory.dir("generated/fixtures").get().asFile.absolutePath
|
||||
)
|
||||
}
|
||||
tasks.matching { it.name == "preDebugBuild" }.configureEach { dependsOn(generateShellFixtures) }
|
||||
Reference in new issue
Block a user