Skip to content

Commit 0016e3c

Browse files
committed
Merge #37: chore: remove unneeded uniffi feature
e133ae6 chore: remove unneeded uniffi feature (Steve Myers) Pull request description: ### Description Since #34 we don't need a feature flag for uniffi. It should always be enabled when building the cktap-ffi package. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/notmandatory/rust-cktap/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing Top commit has no ACKs. Tree-SHA512: 81f2361d6de06b05ffcb93ba1807efc1ab3d14212e7e88679bb8da77a3b3ab843a5832bb9901e01ab728e6ee61d3680bbb08fa54116724b5446549de613186a1
2 parents a379451 + e133ae6 commit 0016e3c

4 files changed

Lines changed: 8 additions & 23 deletions

File tree

cktap-ffi/Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ crate-type = ["staticlib", "cdylib"]
1010

1111
[dependencies]
1212
rust-cktap = { path = "../lib" }
13-
uniffi = { version = "0.29", features = ["cli"], optional = true }
13+
uniffi = { version = "0.29", features = ["cli"] }
1414
thiserror = "1.0"
1515

16-
[build-dependencies]
17-
uniffi = { version = "0.29", features = ["build"], optional = true }
18-
1916
[features]
20-
default = []
21-
uniffi = ["dep:uniffi"]
17+
default = []
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
fn main() {
2-
#[cfg(feature = "uniffi")]
32
uniffi::uniffi_bindgen_main()
43
}

cktap-ffi/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#[cfg(feature = "uniffi")]
21
uniffi::setup_scaffolding!();
32

43
use rust_cktap::apdu::{AppletSelect, CommandApdu, ResponseApdu, StatusResponse};
54
use rust_cktap::{rand_nonce as core_rand_nonce, Error as CoreError};
65
use std::fmt::Debug;
76

8-
#[cfg(feature = "uniffi")]
97
#[derive(Debug, thiserror::Error, uniffi::Error)]
108
pub enum Error {
119
#[error("Core Error: {msg}")]
@@ -14,14 +12,12 @@ pub enum Error {
1412
Transport { msg: String },
1513
}
1614

17-
#[cfg(feature = "uniffi")]
1815
impl From<CoreError> for Error {
1916
fn from(e: CoreError) -> Self {
2017
Error::Core { msg: e.to_string() }
2118
}
2219
}
2320

24-
#[cfg(feature = "uniffi")]
2521
#[derive(uniffi::Record)]
2622
pub struct FfiStatusResponse {
2723
pub proto: u64,
@@ -41,7 +37,6 @@ pub struct FfiStatusResponse {
4137
pub auth_delay: Option<u64>,
4238
}
4339

44-
#[cfg(feature = "uniffi")]
4540
impl From<StatusResponse> for FfiStatusResponse {
4641
fn from(sr: StatusResponse) -> Self {
4742
Self {
@@ -63,13 +58,11 @@ impl From<StatusResponse> for FfiStatusResponse {
6358
}
6459
}
6560

66-
#[cfg(feature = "uniffi")]
6761
#[uniffi::export(callback_interface)]
6862
pub trait CkTransportFfi: Send + Sync + Debug + 'static {
6963
fn transmit_apdu(&self, command_apdu: Vec<u8>) -> Result<Vec<u8>, Error>;
7064
}
7165

72-
#[cfg(feature = "uniffi")]
7366
#[uniffi::export]
7467
pub async fn get_status(transport: Box<dyn CkTransportFfi>) -> Result<FfiStatusResponse, Error> {
7568
let cmd = AppletSelect::default();
@@ -81,21 +74,18 @@ pub async fn get_status(transport: Box<dyn CkTransportFfi>) -> Result<FfiStatusR
8174
Ok(response.into())
8275
}
8376

84-
#[cfg(feature = "uniffi")]
8577
#[derive(uniffi::Record)]
8678
pub struct TestRecord {
8779
pub message: String,
8880
pub count: u32,
8981
}
9082

9183
// this is actually a class per Object not Record
92-
#[cfg(feature = "uniffi")]
9384
#[derive(uniffi::Object)]
9485
pub struct TestStruct {
9586
pub value: u32,
9687
}
9788

98-
#[cfg(feature = "uniffi")]
9989
#[uniffi::export]
10090
pub fn rand_nonce() -> Vec<u8> {
10191
core_rand_nonce().to_vec()

cktap-swift/build-xcframework.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ cd ../ || exit
3838

3939
# Target architectures
4040
# macOS Intel
41-
cargo build --package ${FFI_PKG_NAME} --features uniffi --profile ${RELDIR} --target x86_64-apple-darwin
41+
cargo build --package ${FFI_PKG_NAME} --profile ${RELDIR} --target x86_64-apple-darwin
4242
# macOS Apple Silicon
43-
cargo build --package ${FFI_PKG_NAME} --features uniffi --profile ${RELDIR} --target aarch64-apple-darwin
43+
cargo build --package ${FFI_PKG_NAME} --profile ${RELDIR} --target aarch64-apple-darwin
4444
# Simulator on Intel Macs
45-
cargo build --package ${FFI_PKG_NAME} --features uniffi --profile ${RELDIR} --target x86_64-apple-ios
45+
cargo build --package ${FFI_PKG_NAME} --profile ${RELDIR} --target x86_64-apple-ios
4646
# Simulator on Apple Silicon Mac
47-
cargo build --package ${FFI_PKG_NAME} --features uniffi --profile ${RELDIR} --target aarch64-apple-ios-sim
47+
cargo build --package ${FFI_PKG_NAME} --profile ${RELDIR} --target aarch64-apple-ios-sim
4848
# iPhone devices
49-
cargo build --package ${FFI_PKG_NAME} --features uniffi --profile ${RELDIR} --target aarch64-apple-ios
49+
cargo build --package ${FFI_PKG_NAME} --profile ${RELDIR} --target aarch64-apple-ios
5050

5151
# Then run uniffi-bindgen
52-
cargo run --package ${FFI_PKG_NAME} --bin uniffi-bindgen --features uniffi generate \
52+
cargo run --package ${FFI_PKG_NAME} --bin uniffi-bindgen generate \
5353
--library target/aarch64-apple-ios/${RELDIR}/${DYLIB_FILENAME} \
5454
--language swift \
5555
--out-dir cktap-swift/Sources/CKTap \

0 commit comments

Comments
 (0)