Skip to content

Commit

Permalink
Fix android not working properly (#518)
Browse files Browse the repository at this point in the history
It seems for uniffi to properly parse the uniffi.toml files it has to be
a direct dependency and not transient like generators previously were.
  • Loading branch information
Hinton authored Jan 19, 2024
1 parent ef09397 commit b5b2c5c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/bitwarden-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ bitwarden = { path = "../bitwarden", features = ["mobile", "internal"] }
bitwarden-crypto = { path = "../bitwarden-crypto", version = "=0.1.0", features = [
"mobile",
] }
bitwarden-generators = { path = "../bitwarden-generators", version = "=0.1.0", features = [
"mobile",
] }

[build-dependencies]
uniffi = { version = "=0.25.2", features = ["build"] }
7 changes: 4 additions & 3 deletions crates/bitwarden/src/tool/client_generator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bitwarden_generators::{
passphrase, password, username, PassphraseGeneratorRequest, PasswordGeneratorRequest,
UsernameGeneratorRequest,
use bitwarden_generators::{passphrase, password, username};

use crate::generators::{
PassphraseGeneratorRequest, PasswordGeneratorRequest, UsernameGeneratorRequest,
};

use crate::{error::Result, Client};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import com.bitwarden.core.Folder
import com.bitwarden.core.InitOrgCryptoRequest
import com.bitwarden.core.InitUserCryptoMethod
import com.bitwarden.core.InitUserCryptoRequest
import com.bitwarden.core.Kdf
import com.bitwarden.core.Uuid
import com.bitwarden.crypto.HashPurpose
import com.bitwarden.crypto.Kdf
import com.bitwarden.myapplication.ui.theme.MyApplicationTheme
import com.bitwarden.sdk.Client
import io.ktor.client.HttpClient
Expand Down
10 changes: 3 additions & 7 deletions languages/swift/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ cargo run -p uniffi-bindgen generate \
--out-dir tmp/bindings

# Move generated swift bindings
mv ./tmp/bindings/BitwardenCore.swift ./Sources/BitwardenSdk/
mv ./tmp/bindings/BitwardenCrypto.swift ./Sources/BitwardenSdk/
mv ./tmp/bindings/BitwardenSDK.swift ./Sources/BitwardenSdk/
mv ./tmp/bindings/*.swift ./Sources/BitwardenSdk/

# Massage the generated files to fit xcframework
mkdir tmp/Headers
mv ./tmp/bindings/BitwardenCoreFFI.h ./tmp/Headers/
mv ./tmp/bindings/BitwardenCryptoFFI.h ./tmp/Headers/
mv ./tmp/bindings/BitwardenFFI.h ./tmp/Headers/
cat ./tmp/bindings/BitwardenFFI.modulemap ./tmp/bindings/BitwardenCoreFFI.modulemap ./tmp/bindings/BitwardenCryptoFFI.modulemap > ./tmp/Headers/module.modulemap
mv ./tmp/bindings/*.h ./tmp/Headers/
cat ./tmp/bindings/*.modulemap > ./tmp/Headers/module.modulemap

# Build xcframework
xcodebuild -create-xcframework \
Expand Down

0 comments on commit b5b2c5c

Please sign in to comment.