Skip to content

Commit 869f820

Browse files
committed
refactor(cargo): use crate-type flag
1 parent afcb46d commit 869f820

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ name = "iroh"
2121

2222
[lib]
2323
name = "iroh_ffi"
24-
crate-type = ["staticlib", "cdylib"]
2524

2625
[[bin]]
2726
name = "uniffi-bindgen"

Makefile.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ case "$(uname -s)" in
8686
esac
8787
TARGET_DIR=$(cargo metadata --format-version 1 --no-deps | python3 -c 'import json,sys;print(json.load(sys.stdin)["target_directory"])')
8888
LIB="$TARGET_DIR/debug/${LIB_NAME}.${EXT}"
89+
export RUSTFLAGS="--crate-type=staticlib,cdylib"
8990
cargo run --bin uniffi-bindgen generate --language kotlin \
9091
--out-dir kotlin/lib/src/main/kotlin/ --config "$UNIFFI_CONFIG" --library "$LIB"
9192
mkdir -p kotlin/lib/src/main/resources/
@@ -173,6 +174,7 @@ script = '''
173174
set -eu
174175
command -v cargo-ndk >/dev/null 2>&1 || cargo install --version 3.5.4 cargo-ndk --locked
175176
# Host lib only needed so uniffi-bindgen can read metadata.
177+
export RUSTFLAGS="--crate-type=staticlib,cdylib"
176178
cargo build --lib
177179
TARGET_DIR=$(cargo metadata --format-version 1 --no-deps | python3 -c 'import json,sys;print(json.load(sys.stdin)["target_directory"])')
178180
cargo ndk -o ./kotlin/lib/src/main/jniLibs \

make_swift.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export RUSTFLAGS="${RUSTFLAGS:-} \
2020
--remap-path-prefix=${CARGO_PFX}/registry=/cargo/registry \
2121
--remap-path-prefix=${CARGO_PFX}/git=/cargo/git \
2222
--remap-path-prefix=${RUSTUP_PFX}=/rustup \
23-
--remap-path-prefix=${REPO_PFX}=/build"
23+
--remap-path-prefix=${REPO_PFX}=/build \
24+
--crate-type=staticlib,cdylib"
2425
# --remap-path-prefix is Rust-only. Several deps (notably `ring`) compile bundled
2526
# C sources via build.rs + the `cc` crate, and those object files also embed
2627
# absolute source paths. `-ffile-prefix-map` is clang/gcc's analogue. The `cc`

0 commit comments

Comments
 (0)