Skip to content

Commit

Permalink
Temp 14: Remove cargo workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Oct 2, 2023
1 parent 5a823de commit 905c016
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 58 deletions.
12 changes: 0 additions & 12 deletions Cargo.toml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ internal class UniFfiAndroidPlugin : Plugin<Project> {
into("${project.projectDir}/../lib/src/main/jniLibs/")

into("arm64-v8a") {
from("${project.projectDir}/../../target/aarch64-linux-android/release-smaller/libbdkffi.so")
from("${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so")
}

into("x86_64") {
from("${project.projectDir}/../../target/x86_64-linux-android/release-smaller/libbdkffi.so")
from("${project.projectDir}/../../bdk-ffi/target/x86_64-linux-android/release-smaller/libbdkffi.so")
}

into("armeabi-v7a") {
from("${project.projectDir}/../../target/armv7-linux-androideabi/release-smaller/libbdkffi.so")
from("${project.projectDir}/../../bdk-ffi/target/armv7-linux-androideabi/release-smaller/libbdkffi.so")
}

doLast {
Expand All @@ -137,8 +137,10 @@ internal class UniFfiAndroidPlugin : Plugin<Project> {
val generateAndroidBindings by tasks.register<Exec>("generateAndroidBindings") {
dependsOn(moveNativeAndroidLibs)

val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so"
workingDir("${project.projectDir}/../../bdk-ffi")
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")

val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")

executable("cargo")
args(cargoArgs)
Expand Down
87 changes: 48 additions & 39 deletions Cargo.lock → bdk-ffi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions bdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ uniffi = { version = "0.24.3", features = ["build"] }
[dev-dependencies]
uniffi = { version = "0.24.3", features = ["bindgen-tests"] }
assert_matches = "1.5.0"

[profile.release-smaller]
inherits = "release"
opt-level = 'z' # Optimize for size.
lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = "abort" # Abort on panic
strip = "debuginfo" # Partially strip symbols from binary
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
doFirst {
copy {
with(it) {
from("${project.projectDir}/../../target/${this.targetDir}/release-smaller/${libName}.${this.ext}")
from("${project.projectDir}/../../bdk-ffi/target/${this.targetDir}/release-smaller/${libName}.${this.ext}")
into("${project.projectDir}/../../bdk-jvm/lib/src/main/resources/${this.resDir}/")
}
}
Expand All @@ -119,8 +119,8 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
else -> throw Exception("Unsupported OS")
}

workingDir("${project.projectDir}/../../")
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "./bdk-jvm/lib/src/main/kotlin/", "--no-format")
workingDir("${project.projectDir}/../../bdk-ffi/")
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin/", "--no-format")

executable("cargo")
args(cargoArgs)
Expand Down

0 comments on commit 905c016

Please sign in to comment.