Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set crate-type depending on target #4881

Closed
fschutt opened this issue Dec 31, 2017 · 20 comments
Closed

Ability to set crate-type depending on target #4881

fschutt opened this issue Dec 31, 2017 · 20 comments
Labels
A-crate-types Area: crate-type declaration (lib, staticlib, dylib, cdylib, etc.) C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@fschutt
Copy link
Contributor

fschutt commented Dec 31, 2017

This is an issue that currently blocks me from porting a library to WASM:

I have a library called proj5, which I use in a backend server (in a regular Rust program). I wanted to port the library to wasm (the wasm32-unknown-unknown target) that is now available on nightly and found it to be impossible to do it while still being able to use it in the backend:

The only way to get a WASM binary is by setting the crate-type to "cdylib" in the Cargo.toml file. However, if I do this, I can't use the crate in my regular rust program anymore! And if I leave it out, there is not WASM output.

So currently a crate can be compiled either for WASM or for use in a regular Rust program, not both (controlled by the target). I tried the following so far:

  1. Setting the crate-type in Cargo.toml
[target.'cfg(target_arch = "wasm32")']
crate-type = ["dylib"]

This doesn't work, the argument goes unused:

warning: unused manifest key: target.cfg(target_arch = "wasm32").crate-type

I also tried:

[target.wasm32-unknown-unknown]
crate-type = ["dylib"]

Same thing, same error message. The crate builds, but doesn't produce a WASM binary.

  1. Setting RUSTFLAGS (in the .cargo/config) does not seem to have any effect. I tried:
[target.wasm32-unknown-unknown]
rustflags = [ "--crate-type=cdylib" ]

This just gives a cryptic error, and sets the crate-type twice:

error: unexpected character in cfg `/`, expected parens, a comma, an identifier, or a string

No line number, no column number, nothing. Not sure where it failed - the error message could be heavily improved upon.

I also tried it with crate_type, -- --crate-type, --crate-type dylib. None of which work. I expected --crate-type=dylib to work, because it is documented this way, however I suspect that the documentation is incorrect or out of date.

  1. Setting the crate type in lib.rs

So the last thing I tried was to override the crate type via cfg_attr:

// lib.rs
#![cfg_attr(target_arch = "wasm32", crate_type = "cdylib")]

This is simply ignored by cargo. I still get a .rlib file, not a .wasm file.

So right now I'm out of options. Why is is so hard to build a library for both regular Rust use and WASM? Right now I can only choose either-or.

There is a workaround in that I make a second crate (as cdylib), which just exposes the first one (the rlib), but I don't think this is the way to go. This is important for feature-gating crates so that they can be compiled to WASM without any workarounds.

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 2, 2018
@y-ich
Copy link

y-ich commented Feb 23, 2018

How about adding an example for wasm in Cargo.toml?

...
[[example]]
name = "wasm"
path = "src/lib.rs"
crate-type = ["cdylib"]

And build by

cargo +nightly build --example wasm --target wasm32-unknown-unknown --release

@flukejones
Copy link

flukejones commented Apr 11, 2018

@fschutt I currently have the same issue, my workaround is basically this for WASM and rlib releases:

Cargo.toml

[lib]
crate-type = ["rlib"]

[[bin]]
name = "test_wasm"
path = "src/lib.rs"

src/lib.rs

#[cfg(target_arch = "wasm32")]
fn main() {}

So

cargo build --lib

will build the rlib, and

cargo build --bin test_wasm

builds the WASM.

Seems to work well for all lib types.

fitzgen added a commit to fitzgen/cargo that referenced this issue May 8, 2018
@alvitawa
Copy link

Noob here, but I came here with the same (I think) problem. and solved it by trying

[lib]
crate-type = ["cdylib", "lib"]

Both cargo +nightly build --target wasm32-unknown-unknown and cargo run from a crate including the wasm-compilable crate work, and I am able to use the functionality from wasm_or_lib as wasm and as a rust lib.

"rlib" instead of "lib" works too

@prographo
Copy link

Is it possible to specify create type by target in the .cargo/config file?

Android targets need cdylib
iOS need staticlib

I've tried but it does not seem to accept.

@alexcrichton
Copy link
Member

@prographo no, unfortunately that's not supported by Cargo right now

@J-F-Liu
Copy link

J-F-Liu commented Oct 30, 2018

@alvitawa Specified crate-type = ["cdylib", "lib"], but the generated wasm file size goes from 166KB to 2MB in my case.

redblobgames added a commit to redblobgames/2002-rust-chat-server that referenced this issue Jan 12, 2020
I had previously been building the wasm client the recommended way,
but it seemed to be having trouble once I tried also compiling a
server with the same Cargo file. Most likely I "should" be using
separate Cargo files and maybe workspaces, but I instead changed the
build to follow rust-lang/cargo#4881 , which
says to build the library as "rlib" instead of "cdylib", and then
build a wasm binary out of it.

I also debugged and fixed the Makefile rules:

* Changed the hard-coded path to my own directory structure to instead
  always build the wasm to build/. I can make this a symlink if I want
  to point to my own directory structure instead.
* Changed the servers to use the debug build, but with -O1. For this
  project I don't need a release build.

I added a readme file in preparation for uploading to github.
@dvc94ch
Copy link

dvc94ch commented Feb 13, 2020

Is it possible to specify create type by target in the .cargo/config file?

setting it from the env like CARGO_TARGET_{triple}_CRATE_TYPE would also be nice for tooling.

Android targets need cdylib
iOS need staticlib

any updates?

@getreu
Copy link

getreu commented Aug 31, 2020

Why is is so hard to build a library for both regular Rust use and WASM? Right now I can only choose either-or.

Is there any progress on this?

Proposal: in analogy to:

[target.'cfg(target_arch = "wasm32")'.dependencies]
rand = { version = "0.7.3", features = ["getrandom"] }

This should be allowed:

[target.'cfg(target_arch = "wasm32")'.lib]     
crate-type = ["cdylib", "rlib"]

Unfortunately, at the moment I still get:

$ wasm-pack build  --target web --out-name wasm
Error: crate-type must be cdylib to compile to wasm32-unknown-unknown. Add the following to your Cargo.toml file:

[lib]
crate-type = ["cdylib", "rlib"]

@alex
Copy link
Member

alex commented Feb 11, 2021

This also impacts folks trying to builds Python extension modules for iOS.

Is there consensus that the fix is to support specifying arbitrary keys on a per target basis, or is that merely a proposal and more design is required?

@dvc94ch
Copy link

dvc94ch commented Feb 12, 2021

Last I heard the cargo team is not willing to take a PR to fix this currently and an RFC would need to happen. I think the more deeper problem that makes this hard to fix is that cargo parses the toml and then freezes it by passing around a reference. So there isn't an easy way to adjust the crate-type key in the toml based on information gained later in the compilation.

#7900

Demindiro added a commit to Demindiro/godot_rapier3d that referenced this issue Mar 29, 2021
It looks like there isn't a proper way to toggle this yet:
rust-lang/cargo#4881

I suppose I should set up some script to automatically update a
"cargo-only" branch then.
Slesarew added a commit to novasamatech/parity-signer that referenced this issue May 5, 2021
@str4d
Copy link

str4d commented Jul 7, 2021

A related request I have (which likely would use the same mechanics as a fix for this issue, so I'm mentioning it here, but can open a separate issue if desired) is enabling crate-type to be controlled by feature flags. hyper 0.14.3 added a C FFI behind an ffi feature flag, but to do so they added crate-type = ["lib", "staticlib", "cdylib"] to their Cargo.toml. This breaks cross-compilation for downstream staticlib Rust users such as myself, because even though the ffi feature flag is disabled, the (completely unused) cdylib is still compiled for hyper, and rustc needs to know how to link for the target architecture (which is completely unnecessary for the staticlib I want to compile for use in my C++ binary, so wasn't plumbed in). If hyper could have placed the staticlib, cdylib behind the ffi feature flag, there would have been no downstream effects.

Slesarew added a commit to novasamatech/parity-signer that referenced this issue Sep 22, 2021
* fix: update metadata

* docs: created issue for stock metadata updates

* docs: lint

* feat: add generalized metadata storage mwp

* feat: metadata info on network details page (early stub)

* feat: invalid metadata message

* feat: built-in metadata loaded in constants

feat: metadata versions added to constants

* fix!: metadata is actuallty loaded;
removed som non-essential networks due to metadata loading issues

* fix: annoying hooks warning about updating component from another component fixed

* fix: smoother metadata loading; initiation moved to separate from fetching block

* ref: merged networkscontext and registriescontext

* fix: remove process race on init and small fixes

* fix: infinite useEffect cycle in payload card; probably there is more

* feat: show list of available metadata packages for given network

* feat: choose metadata from network settings submenu

* test: fix typos in unit tests

* test: fix tests and some lint/type errors

* feat: Metadata management scanner (#749)

* feat: MWP fast Rust-processed QR scanner frontend

* build: temporarily switch dependency rust-native to side branch

* feat: implement rust code for fountain parsing. Saving point for partial dependencies upgrade attempts

* feat: add metadata through fountain QR codes! (go to network settings>"network name">ManageMetadata>Fast Qr Scanner)

* fix: lint and types

* fix: typo in constants

* fix: multiple minor bugs

* refactor: return rust native libs where they belong (#751)

* ref: return rust native libs where they belong

* docs: lost gitignore

* refactor: move reference animated qr code generator to external repository

* build: move header files in ios build part

* build: add more memory for ios node build

* build: add more memory for ios node build in a different way

* build: revert ios build changes, modify bitrise script to allocate less memory

* build: duplicate headers for ios

* fix: Transaction parser (#754)

* feat: parse generic transaction. Ugly but now works.

* test: increase e2e timeout

* fix: lint

* feat: automatically generate built-in metadata (#755)

* feat: add rust code to automatically fetch and generate built-in metadata constants

* test: add extra paths for linter to ignore

* feat: automatically update constants/networkSpecs.ts with new metadata info

* fix: add blake2 hash to metadata handles; use it as ID if no spec_name or spec_version is available

* fix: blake2 hash in networkSpecs constants

* fix: add hashes for centrifuge and edgeware

* fix: metadata autogeneration lint

* build: update failure_derive to 1.8.0

* build: convenience reminder in build script

* fix: multiple fixes to allow versionless metadata

* test: fix unit tests to recognize versioned metadata

* refactor: faster metadata queries (#759)

* perf: moved metadata handle generator to rust

* refactor: lint and types

* build: try ti disable flipper

* fix: update metadata

* test: increase alert timeout

* test: typo in consts

* fix: merged last commit that was dropped from last squash for some reason

* feat: Metadata management page (#760)

* build: bump polkadot/api version to latest

* fix: red boxes on registering networks

* build: mess with upgrades and lint

* feat: can delete unused metadata (except for built-in probably)

* build: Upgrade polkadot-js 4 7 2 (#761)

* upgrade polkadot and react-native

* test: disabled failing tests temporarily

* test: restore tests

* fix: lint

* test: fix ts-ignore updated rule

* fix: lint and types

* test: bump nodejs version

* test: bump wasm-crypto needed for tests

* fix: update metadata

* build: bump node version for e2e

* build: bump node version in bitrise.yml

* test: teach signing test to scroll down

* test: fix addNewNetwork signing test with scrolling

* test: forgot to import scrolling tap everywhere it's needed

* fix: update westend metadata

* build: build rust for detox

* build: try to fix comment in macro build issue for zeroize_derive

* fix: typu in NetworkContext file

* build: update synstructure rust dep

* build: disable 32-bit ios targets

* build: remoce macro proc so that cross-compile works

* build: very ugly hack to address ios inability to build dynamic libs and rust-lang/cargo#4881

* fix: update metadata

* feat: loading screen stub

* lint

* fix: import react to splashscreen tab

* fix: metadata qr alignment error

* test: increase e2e timeout

* feat: loaded metadata preview screen

* test: switch ios and android e2e tests order

* test: add waiting for loading in beforeall e2e

* fix: lint

* test: typo

* fix: update metadata

* test: preparing for new e2e tests

* docs: bump license year in ts

* docs: bump license year in ios

* docs: bump version year in rust

* fix: gracefully fail to parse transaction if no metadata is available

* test: fix gradle api for detox

* test: remove waiting for alerts

* fix: lint

* feat: slightly prettier loading screen

* fix: lint

* fix: properly handle networks with unset metadata on loading

* fix: #767 and some lint

* fix: lint and types

* feat: slightly prettier transaction parser

* fix: types and lint

* test: attempt to run e2e on bitrise

* test: bump node version on bitrise

* test: swap ios and android testing again

* build: automatically set NDK_HOME with other variables

* test: download last reasonable config from bitrise

* test: increase verbosity in e2e test

* test: increase verbosity for e2e ci test on github

* test: wait for chooser screen after account creation in e2e

* test: this will be reverted - check that ios really clears memory between tests

* fix: lint and ios build

* test: preparing for new tests

* build: ios version fix attempt

* build: fixing ios build

* build: rename xcode folders

* build: update some deps

* build: remove ios/SubstrateSignTests

* fix: reverse ios module renaming mess

* build: ios folder cleanup

* build: move swift-bridge header around

* fix: Bridging header location

* fix: libsigner.a location

* build: try different places for static ios rust lib

* build: remove ndk address and some file duplicates

* build: ios linking

* test: some unfinished test specs added

* chore: update meta_reading

* chore: bump metadata reading version

* fix: gitignore

* fix: gitignore

* feat: rust transaction parser mwp demo

* fix: accept V13 metadata

* feat: stub for rust transaction parser call

* feat: mwp rust transaction parse demo (stub vor visualization)

* feat: add more cards to transaction renderer

* fix: lint and make some things prettier

* build: manually return linking lines to ios project file

* feat: migrate metadata db to insecure storage

* fix: accept V13 metadata

* chore: update metadata

* feat: add templates for cards: loading and error in transaction

* feat: add error messages cards generation and some refactor

* feat!: remove ethereum support, direct connection to transaction parser. Can't sign at the moment.

* refactor: tidy up transaction parser code

* feat: active SIGN button in details screen and some sanitation to remove legacy

* feat: prepare data transfer for signature and signing pin screen

* feat: signing is back! and with all 3 crypto algorithms as well!

* fix: show error messages on pin entry

* fix: remove silly testing message from really hard to find place

* feat: proper pin code error messages and start of rust storage testing (sled vs sqlite?)

* chore: update metadata

* fix: invalid payload screen crashing

* fix: temporarilty disable mortality check until upstream conforms

* fix: data to sign format correction

* feat: payload details look

* test: remove decoders test from RN suite (moved to Rust tests)

* test: remove units conversion test from RN suite (moved to Rust tests)

* fix: choose sled as db

* fix: lint

* fix: some types, lint and legacy removal

* fix: purge ethereum

* fix: ios support and more legacy purging

* ci: Rework Gitlab (#782)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* feat: move all storage to rust (#780)

* FEAT: MFP sled database for android

* feat: network db handling utils

* docs: signing and parsing modules documentation

* fix: gitignore to ignore temporary db files in db handling tests

* refactor: move network specs constants to rust side

* fix: gitignore typo

* fix: gitignoring properly

* test: cleanup db tests locations

* feat: part of bridge to access new network specs storage from RN

* refactor: organize all cards and errors in transaction parsing into enums

* feat: network selector queries db. And some cleanup.

* test: add test feature to show all payload info cards

* feat: MWP metadata signing app example

* feat: MWP fetch and show derivations for given seed and network

* feat: removed RN data storages; app loads and fetches some data - MWP

* feat: prepare fetched metadata for signing and save to db instead of plaintext

* feat: account creation in db and signed metadata checks

* feat: generate metadata qr codes; also bridge Rust to RN

* feat: load type specs and some refactor

* feat: add hw backed key generation section to android

* fix: gitignore

* feat: automatic fetch chainspecs

* fix: create new seed

* fix: mwp address list screen

* feat: replace ethsign with XSalsa20Poly1305; just to save this state - this will be reverted

* feat: native credential-only unlock screen for Android (defunct)

* fix: unhang app on auth

* feat: HW keys for android (auth screen freezes thread, WIP)

* fix: proper thread locks for biometric prompt (Android)

* fix: fetch all seed names

* feat: add seed button

* feat: POC identity cards render

* fix: recover seed now works similar to create seed

* feat: general look for identity cards

* feat: bells and whistles on identity screen

* feat: send public key to UI on fetching relevant identities

* chore: remove some unused java deps

* chore: remove some unused polkadot js deps

* feat: export public account (uos step 1)

* chore: cleanup obsolete screens

* chore: more cleanup

* feat: derivation checker and identity creation backend

* ci: Gitlab build (#784)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* remove test branch

* feat: expose identity creation functions

* feat: expose identity creation functions in RN; handle address collisions

* feat: add new identity

* feat: n+1 feature

* feat: backend to delete identities and suggest their names

* feat: delete identity

* major: tools for creating full signed offline QR updates

* feat: move prepopulated db to assets to copy on init

* feat: remove global context; make TOCnPP condition to populate db; app factory reset should work through deletion of app data now

* refactor: remove old rust code, some general cleanup

* fix: screen refresh on addition of account

* fix: refresh on address deletion

* refactor: RN cleanup

* feat: nice suggestions for seed names

* lint: RN lint and cleanup

* refactor: some types and more cleanup

* feat: automatic TOFU metadata, types and network specs import, fixed signing

* lint: cleanup meta_reading

* fix: signing and upgrading screens fixes

* feat: populate cold database from hot one (and some more cleanup)

* refactor: move all screens to one place

* feat: network settings screen

* feat: remove metadata, remove network

* CI: rework

* CI: poke the pipeline

* CI: metadata

* CI: make it work

* fix: network removal call properly

* fix: empty metadata does not crash; also some refactor and backend for listing all addresses

* fix: rn build android (#785)

* fix: disable broken minification with proguard

* revert: cat in ci

* docs: readme for db_handling

* fix: .h header for ios build

* fix: remove obsolete meta handle generator

* fix: cargo.toml cleanup for main module

* feat: use anyhow to propagate errors to ios

* feat: anyhow all rust code

* refactor: decrease code redundancy by helpers

* fix: rust ios return seedphrase on successful creation

* major: native ios wip dump

* feat: add rust-identicon dependency just to test build

* major: ios account management UI

* ci: remove yarn calls from e2e; should add tests later

* ci: remove ts lint types and unit tests

* ci: ga build script fix

* refactor: cleanup of junk files

* fix: simplify data model and fix some memory leaks and threading

* ci: scheme in actions

* feat: better rust qr parser and PC implementation as devtool

* feat: try to send svg string to ios

* fix: QR parser succeeds 1 frame sooner

* test: 1-frame multiframe decode unit test

* feat: transaction parsing and preview sketch

* feat: history backend

* feat: seed and network settings screens, TC and PP

* feat: bindings for history ios

* feat: ios history ui stub

* refactor: tidy up history in transaction parsing

* feat: rust QR code png renderer

* refactor: consolidate qr constants

* feat: integrate QR code generation into signing

* feat: ios history and hard types in tx and history ui cards

* fix: seriously, output is supposed to be binary-encoded hex symbols?!

* feat: new export pubkey qr code generator

* feat: identicons stub, faster qr videos

* feat: show identities for all seeds

* feat: show all seeds and minor UI fixes

* chore: cleanup RN

* docs: remove ETH, explain legacy situation

* docs: some tutorials

* docs: reference to uos

* fix: signing db checksum mismatch bugfix

* docs: mark how releases are tagged

Co-authored-by: Martin Pugh <martin@parity.io>
Co-authored-by: Martin Pugh <pugh@s3kr.it>
Co-authored-by: Denis P <denis.pisarev@parity.io>
Slesarew added a commit to novasamatech/parity-signer that referenced this issue Sep 22, 2021
* fix: update metadata

* docs: created issue for stock metadata updates

* docs: lint

* feat: add generalized metadata storage mwp

* feat: metadata info on network details page (early stub)

* feat: invalid metadata message

* feat: built-in metadata loaded in constants

feat: metadata versions added to constants

* fix!: metadata is actuallty loaded;
removed som non-essential networks due to metadata loading issues

* fix: annoying hooks warning about updating component from another component fixed

* fix: smoother metadata loading; initiation moved to separate from fetching block

* ref: merged networkscontext and registriescontext

* fix: remove process race on init and small fixes

* fix: infinite useEffect cycle in payload card; probably there is more

* feat: show list of available metadata packages for given network

* feat: choose metadata from network settings submenu

* test: fix typos in unit tests

* test: fix tests and some lint/type errors

* feat: Metadata management scanner (#749)

* feat: MWP fast Rust-processed QR scanner frontend

* build: temporarily switch dependency rust-native to side branch

* feat: implement rust code for fountain parsing. Saving point for partial dependencies upgrade attempts

* feat: add metadata through fountain QR codes! (go to network settings>"network name">ManageMetadata>Fast Qr Scanner)

* fix: lint and types

* fix: typo in constants

* fix: multiple minor bugs

* refactor: return rust native libs where they belong (#751)

* ref: return rust native libs where they belong

* docs: lost gitignore

* refactor: move reference animated qr code generator to external repository

* build: move header files in ios build part

* build: add more memory for ios node build

* build: add more memory for ios node build in a different way

* build: revert ios build changes, modify bitrise script to allocate less memory

* build: duplicate headers for ios

* fix: Transaction parser (#754)

* feat: parse generic transaction. Ugly but now works.

* test: increase e2e timeout

* fix: lint

* feat: automatically generate built-in metadata (#755)

* feat: add rust code to automatically fetch and generate built-in metadata constants

* test: add extra paths for linter to ignore

* feat: automatically update constants/networkSpecs.ts with new metadata info

* fix: add blake2 hash to metadata handles; use it as ID if no spec_name or spec_version is available

* fix: blake2 hash in networkSpecs constants

* fix: add hashes for centrifuge and edgeware

* fix: metadata autogeneration lint

* build: update failure_derive to 1.8.0

* build: convenience reminder in build script

* fix: multiple fixes to allow versionless metadata

* test: fix unit tests to recognize versioned metadata

* refactor: faster metadata queries (#759)

* perf: moved metadata handle generator to rust

* refactor: lint and types

* build: try ti disable flipper

* fix: update metadata

* test: increase alert timeout

* test: typo in consts

* fix: merged last commit that was dropped from last squash for some reason

* feat: Metadata management page (#760)

* build: bump polkadot/api version to latest

* fix: red boxes on registering networks

* build: mess with upgrades and lint

* feat: can delete unused metadata (except for built-in probably)

* build: Upgrade polkadot-js 4 7 2 (#761)

* upgrade polkadot and react-native

* test: disabled failing tests temporarily

* test: restore tests

* fix: lint

* test: fix ts-ignore updated rule

* fix: lint and types

* test: bump nodejs version

* test: bump wasm-crypto needed for tests

* fix: update metadata

* build: bump node version for e2e

* build: bump node version in bitrise.yml

* test: teach signing test to scroll down

* test: fix addNewNetwork signing test with scrolling

* test: forgot to import scrolling tap everywhere it's needed

* fix: update westend metadata

* build: build rust for detox

* build: try to fix comment in macro build issue for zeroize_derive

* fix: typu in NetworkContext file

* build: update synstructure rust dep

* build: disable 32-bit ios targets

* build: remoce macro proc so that cross-compile works

* build: very ugly hack to address ios inability to build dynamic libs and rust-lang/cargo#4881

* fix: update metadata

* feat: loading screen stub

* lint

* fix: import react to splashscreen tab

* fix: metadata qr alignment error

* test: increase e2e timeout

* feat: loaded metadata preview screen

* test: switch ios and android e2e tests order

* test: add waiting for loading in beforeall e2e

* fix: lint

* test: typo

* fix: update metadata

* test: preparing for new e2e tests

* docs: bump license year in ts

* docs: bump license year in ios

* docs: bump version year in rust

* fix: gracefully fail to parse transaction if no metadata is available

* test: fix gradle api for detox

* test: remove waiting for alerts

* fix: lint

* feat: slightly prettier loading screen

* fix: lint

* fix: properly handle networks with unset metadata on loading

* fix: #767 and some lint

* fix: lint and types

* feat: slightly prettier transaction parser

* fix: types and lint

* test: attempt to run e2e on bitrise

* test: bump node version on bitrise

* test: swap ios and android testing again

* build: automatically set NDK_HOME with other variables

* test: download last reasonable config from bitrise

* test: increase verbosity in e2e test

* test: increase verbosity for e2e ci test on github

* test: wait for chooser screen after account creation in e2e

* test: this will be reverted - check that ios really clears memory between tests

* fix: lint and ios build

* test: preparing for new tests

* build: ios version fix attempt

* build: fixing ios build

* build: rename xcode folders

* build: update some deps

* build: remove ios/SubstrateSignTests

* fix: reverse ios module renaming mess

* build: ios folder cleanup

* build: move swift-bridge header around

* fix: Bridging header location

* fix: libsigner.a location

* build: try different places for static ios rust lib

* build: remove ndk address and some file duplicates

* build: ios linking

* test: some unfinished test specs added

* chore: update meta_reading

* chore: bump metadata reading version

* fix: gitignore

* fix: gitignore

* feat: rust transaction parser mwp demo

* fix: accept V13 metadata

* feat: stub for rust transaction parser call

* feat: mwp rust transaction parse demo (stub vor visualization)

* feat: add more cards to transaction renderer

* fix: lint and make some things prettier

* build: manually return linking lines to ios project file

* feat: migrate metadata db to insecure storage

* fix: accept V13 metadata

* chore: update metadata

* feat: add templates for cards: loading and error in transaction

* feat: add error messages cards generation and some refactor

* feat!: remove ethereum support, direct connection to transaction parser. Can't sign at the moment.

* refactor: tidy up transaction parser code

* feat: active SIGN button in details screen and some sanitation to remove legacy

* feat: prepare data transfer for signature and signing pin screen

* feat: signing is back! and with all 3 crypto algorithms as well!

* fix: show error messages on pin entry

* fix: remove silly testing message from really hard to find place

* feat: proper pin code error messages and start of rust storage testing (sled vs sqlite?)

* chore: update metadata

* fix: invalid payload screen crashing

* fix: temporarilty disable mortality check until upstream conforms

* fix: data to sign format correction

* feat: payload details look

* test: remove decoders test from RN suite (moved to Rust tests)

* test: remove units conversion test from RN suite (moved to Rust tests)

* fix: choose sled as db

* fix: lint

* fix: some types, lint and legacy removal

* fix: purge ethereum

* fix: ios support and more legacy purging

* ci: Rework Gitlab (#782)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* feat: move all storage to rust (#780)

* FEAT: MFP sled database for android

* feat: network db handling utils

* docs: signing and parsing modules documentation

* fix: gitignore to ignore temporary db files in db handling tests

* refactor: move network specs constants to rust side

* fix: gitignore typo

* fix: gitignoring properly

* test: cleanup db tests locations

* feat: part of bridge to access new network specs storage from RN

* refactor: organize all cards and errors in transaction parsing into enums

* feat: network selector queries db. And some cleanup.

* test: add test feature to show all payload info cards

* feat: MWP metadata signing app example

* feat: MWP fetch and show derivations for given seed and network

* feat: removed RN data storages; app loads and fetches some data - MWP

* feat: prepare fetched metadata for signing and save to db instead of plaintext

* feat: account creation in db and signed metadata checks

* feat: generate metadata qr codes; also bridge Rust to RN

* feat: load type specs and some refactor

* feat: add hw backed key generation section to android

* fix: gitignore

* feat: automatic fetch chainspecs

* fix: create new seed

* fix: mwp address list screen

* feat: replace ethsign with XSalsa20Poly1305; just to save this state - this will be reverted

* feat: native credential-only unlock screen for Android (defunct)

* fix: unhang app on auth

* feat: HW keys for android (auth screen freezes thread, WIP)

* fix: proper thread locks for biometric prompt (Android)

* fix: fetch all seed names

* feat: add seed button

* feat: POC identity cards render

* fix: recover seed now works similar to create seed

* feat: general look for identity cards

* feat: bells and whistles on identity screen

* feat: send public key to UI on fetching relevant identities

* chore: remove some unused java deps

* chore: remove some unused polkadot js deps

* feat: export public account (uos step 1)

* chore: cleanup obsolete screens

* chore: more cleanup

* feat: derivation checker and identity creation backend

* ci: Gitlab build (#784)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* remove test branch

* feat: expose identity creation functions

* feat: expose identity creation functions in RN; handle address collisions

* feat: add new identity

* feat: n+1 feature

* feat: backend to delete identities and suggest their names

* feat: delete identity

* major: tools for creating full signed offline QR updates

* feat: move prepopulated db to assets to copy on init

* feat: remove global context; make TOCnPP condition to populate db; app factory reset should work through deletion of app data now

* refactor: remove old rust code, some general cleanup

* fix: screen refresh on addition of account

* fix: refresh on address deletion

* refactor: RN cleanup

* feat: nice suggestions for seed names

* lint: RN lint and cleanup

* refactor: some types and more cleanup

* feat: automatic TOFU metadata, types and network specs import, fixed signing

* lint: cleanup meta_reading

* fix: signing and upgrading screens fixes

* feat: populate cold database from hot one (and some more cleanup)

* refactor: move all screens to one place

* feat: network settings screen

* feat: remove metadata, remove network

* CI: rework

* CI: poke the pipeline

* CI: metadata

* CI: make it work

* fix: network removal call properly

* fix: empty metadata does not crash; also some refactor and backend for listing all addresses

* fix: rn build android (#785)

* fix: disable broken minification with proguard

* revert: cat in ci

* docs: readme for db_handling

* fix: .h header for ios build

* fix: remove obsolete meta handle generator

* fix: cargo.toml cleanup for main module

* feat: use anyhow to propagate errors to ios

* feat: anyhow all rust code

* refactor: decrease code redundancy by helpers

* fix: rust ios return seedphrase on successful creation

* major: native ios wip dump

* feat: add rust-identicon dependency just to test build

* major: ios account management UI

* ci: remove yarn calls from e2e; should add tests later

* ci: remove ts lint types and unit tests

* ci: ga build script fix

* refactor: cleanup of junk files

* fix: simplify data model and fix some memory leaks and threading

* ci: scheme in actions

* feat: better rust qr parser and PC implementation as devtool

* feat: try to send svg string to ios

* fix: QR parser succeeds 1 frame sooner

* test: 1-frame multiframe decode unit test

* feat: transaction parsing and preview sketch

* feat: history backend

* feat: seed and network settings screens, TC and PP

* feat: bindings for history ios

* feat: ios history ui stub

* refactor: tidy up history in transaction parsing

* feat: rust QR code png renderer

* refactor: consolidate qr constants

* feat: integrate QR code generation into signing

* feat: ios history and hard types in tx and history ui cards

* fix: seriously, output is supposed to be binary-encoded hex symbols?!

* feat: new export pubkey qr code generator

* feat: identicons stub, faster qr videos

* feat: show identities for all seeds

* feat: show all seeds and minor UI fixes

* chore: cleanup RN

* chore: clean up old android code

* feat: UI initial commit

* feat: navigation

* feat: rust native calls linking

* docs: code comments everywhere

* feat: onboarding and db populate

* fix: active state for onboard

* feat: network selector

* feat: mwp auth screen invoker

* feat: after all can use encryptedSharedPreferences with biometric

* feat: mwp seed management

* feat: keys list

* feat: png tunnel and key menu

* feat: create and export keys

* feat: camera on homescreen

* feat: qr code parser

* feat: decode all qr messages into clean payload

* feat: transaction signing

* feat: mwp history screen in settings

* feat: history cards stub

* build: decrease minimum sdk level

* feat: some formatting for transaction details cards

* feat: scan progress indicator

* fix: prettier scanner progress bar

* chore: merge ios from master

* fix: compatibility of ios to android changes

Co-authored-by: Martin Pugh <martin@parity.io>
Co-authored-by: Martin Pugh <pugh@s3kr.it>
Co-authored-by: Denis P <denis.pisarev@parity.io>
Slesarew added a commit to novasamatech/parity-signer that referenced this issue Sep 28, 2021
* feat: Metadata management page (#760)

* build: bump polkadot/api version to latest

* fix: red boxes on registering networks

* build: mess with upgrades and lint

* feat: can delete unused metadata (except for built-in probably)

* build: Upgrade polkadot-js 4 7 2 (#761)

* upgrade polkadot and react-native

* test: disabled failing tests temporarily

* test: restore tests

* fix: lint

* test: fix ts-ignore updated rule

* fix: lint and types

* test: bump nodejs version

* test: bump wasm-crypto needed for tests

* fix: update metadata

* build: bump node version for e2e

* build: bump node version in bitrise.yml

* test: teach signing test to scroll down

* test: fix addNewNetwork signing test with scrolling

* test: forgot to import scrolling tap everywhere it's needed

* fix: update westend metadata

* build: build rust for detox

* build: try to fix comment in macro build issue for zeroize_derive

* fix: typu in NetworkContext file

* build: update synstructure rust dep

* build: disable 32-bit ios targets

* build: remoce macro proc so that cross-compile works

* build: very ugly hack to address ios inability to build dynamic libs and rust-lang/cargo#4881

* fix: update metadata

* feat: loading screen stub

* lint

* fix: import react to splashscreen tab

* fix: metadata qr alignment error

* test: increase e2e timeout

* feat: loaded metadata preview screen

* test: switch ios and android e2e tests order

* test: add waiting for loading in beforeall e2e

* fix: lint

* test: typo

* fix: update metadata

* test: preparing for new e2e tests

* docs: bump license year in ts

* docs: bump license year in ios

* docs: bump version year in rust

* fix: gracefully fail to parse transaction if no metadata is available

* test: fix gradle api for detox

* test: remove waiting for alerts

* fix: lint

* feat: slightly prettier loading screen

* fix: lint

* fix: properly handle networks with unset metadata on loading

* fix: #767 and some lint

* fix: lint and types

* feat: slightly prettier transaction parser

* fix: types and lint

* test: attempt to run e2e on bitrise

* test: bump node version on bitrise

* test: swap ios and android testing again

* build: automatically set NDK_HOME with other variables

* test: download last reasonable config from bitrise

* test: increase verbosity in e2e test

* test: increase verbosity for e2e ci test on github

* test: wait for chooser screen after account creation in e2e

* test: this will be reverted - check that ios really clears memory between tests

* fix: lint and ios build

* test: preparing for new tests

* build: ios version fix attempt

* build: fixing ios build

* build: rename xcode folders

* build: update some deps

* build: remove ios/SubstrateSignTests

* fix: reverse ios module renaming mess

* build: ios folder cleanup

* build: move swift-bridge header around

* fix: Bridging header location

* fix: libsigner.a location

* build: try different places for static ios rust lib

* build: remove ndk address and some file duplicates

* build: ios linking

* test: some unfinished test specs added

* chore: update meta_reading

* chore: bump metadata reading version

* fix: gitignore

* fix: gitignore

* feat: rust transaction parser mwp demo

* fix: accept V13 metadata

* feat: stub for rust transaction parser call

* feat: mwp rust transaction parse demo (stub vor visualization)

* feat: add more cards to transaction renderer

* fix: lint and make some things prettier

* build: manually return linking lines to ios project file

* feat: migrate metadata db to insecure storage

* fix: accept V13 metadata

* chore: update metadata

* feat: add templates for cards: loading and error in transaction

* feat: add error messages cards generation and some refactor

* feat!: remove ethereum support, direct connection to transaction parser. Can't sign at the moment.

* refactor: tidy up transaction parser code

* feat: active SIGN button in details screen and some sanitation to remove legacy

* feat: prepare data transfer for signature and signing pin screen

* feat: signing is back! and with all 3 crypto algorithms as well!

* fix: show error messages on pin entry

* fix: remove silly testing message from really hard to find place

* feat: proper pin code error messages and start of rust storage testing (sled vs sqlite?)

* chore: update metadata

* fix: invalid payload screen crashing

* fix: temporarilty disable mortality check until upstream conforms

* fix: data to sign format correction

* feat: payload details look

* test: remove decoders test from RN suite (moved to Rust tests)

* test: remove units conversion test from RN suite (moved to Rust tests)

* fix: choose sled as db

* fix: lint

* fix: some types, lint and legacy removal

* fix: purge ethereum

* fix: ios support and more legacy purging

* ci: Rework Gitlab (#782)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* feat: move all storage to rust (#780)

* FEAT: MFP sled database for android

* feat: network db handling utils

* docs: signing and parsing modules documentation

* fix: gitignore to ignore temporary db files in db handling tests

* refactor: move network specs constants to rust side

* fix: gitignore typo

* fix: gitignoring properly

* test: cleanup db tests locations

* feat: part of bridge to access new network specs storage from RN

* refactor: organize all cards and errors in transaction parsing into enums

* feat: network selector queries db. And some cleanup.

* test: add test feature to show all payload info cards

* feat: MWP metadata signing app example

* feat: MWP fetch and show derivations for given seed and network

* feat: removed RN data storages; app loads and fetches some data - MWP

* feat: prepare fetched metadata for signing and save to db instead of plaintext

* feat: account creation in db and signed metadata checks

* feat: generate metadata qr codes; also bridge Rust to RN

* feat: load type specs and some refactor

* feat: add hw backed key generation section to android

* fix: gitignore

* feat: automatic fetch chainspecs

* fix: create new seed

* fix: mwp address list screen

* feat: replace ethsign with XSalsa20Poly1305; just to save this state - this will be reverted

* feat: native credential-only unlock screen for Android (defunct)

* fix: unhang app on auth

* feat: HW keys for android (auth screen freezes thread, WIP)

* fix: proper thread locks for biometric prompt (Android)

* fix: fetch all seed names

* feat: add seed button

* feat: POC identity cards render

* fix: recover seed now works similar to create seed

* feat: general look for identity cards

* feat: bells and whistles on identity screen

* feat: send public key to UI on fetching relevant identities

* chore: remove some unused java deps

* chore: remove some unused polkadot js deps

* feat: export public account (uos step 1)

* chore: cleanup obsolete screens

* chore: more cleanup

* feat: derivation checker and identity creation backend

* ci: Gitlab build (#784)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* remove test branch

* feat: expose identity creation functions

* feat: expose identity creation functions in RN; handle address collisions

* feat: add new identity

* feat: n+1 feature

* feat: backend to delete identities and suggest their names

* feat: delete identity

* major: tools for creating full signed offline QR updates

* feat: move prepopulated db to assets to copy on init

* feat: remove global context; make TOCnPP condition to populate db; app factory reset should work through deletion of app data now

* refactor: remove old rust code, some general cleanup

* fix: screen refresh on addition of account

* fix: refresh on address deletion

* refactor: RN cleanup

* feat: nice suggestions for seed names

* lint: RN lint and cleanup

* refactor: some types and more cleanup

* feat: automatic TOFU metadata, types and network specs import, fixed signing

* lint: cleanup meta_reading

* fix: signing and upgrading screens fixes

* feat: populate cold database from hot one (and some more cleanup)

* refactor: move all screens to one place

* feat: network settings screen

* feat: remove metadata, remove network

* CI: rework

* CI: poke the pipeline

* CI: metadata

* CI: make it work

* fix: network removal call properly

* fix: empty metadata does not crash; also some refactor and backend for listing all addresses

* fix: rn build android (#785)

* fix: disable broken minification with proguard

* revert: cat in ci

* docs: readme for db_handling

* fix: .h header for ios build

* fix: remove obsolete meta handle generator

* fix: cargo.toml cleanup for main module

* feat: use anyhow to propagate errors to ios

* feat: anyhow all rust code

* refactor: decrease code redundancy by helpers

* fix: rust ios return seedphrase on successful creation

* major: native ios wip dump

* feat: add rust-identicon dependency just to test build

* major: ios account management UI

* ci: remove yarn calls from e2e; should add tests later

* ci: remove ts lint types and unit tests

* ci: ga build script fix

* refactor: cleanup of junk files

* fix: simplify data model and fix some memory leaks and threading

* ci: scheme in actions

* feat: better rust qr parser and PC implementation as devtool

* feat: try to send svg string to ios

* fix: QR parser succeeds 1 frame sooner

* test: 1-frame multiframe decode unit test

* feat: transaction parsing and preview sketch

* feat: history backend

* feat: seed and network settings screens, TC and PP

* feat: bindings for history ios

* feat: ios history ui stub

* refactor: tidy up history in transaction parsing

* feat: rust QR code png renderer

* refactor: consolidate qr constants

* feat: integrate QR code generation into signing

* feat: ios history and hard types in tx and history ui cards

* fix: seriously, output is supposed to be binary-encoded hex symbols?!

* feat: new export pubkey qr code generator

* feat: identicons stub, faster qr videos

* feat: show identities for all seeds

* feat: show all seeds and minor UI fixes

* chore: cleanup RN

* chore: clean up old android code

* feat: UI initial commit

* feat: navigation

* feat: rust native calls linking

* docs: code comments everywhere

* docs: remove ETH, explain legacy situation

* docs: some tutorials

* docs: reference to uos

* feat: onboarding and db populate

* fix: active state for onboard

* feat: network selector

* feat: some support for metadata v14 (unstable as well as upstream)

* fix: hotfix BitVec u64 for 32bit archs

* feat: mwp auth screen invoker

* feat: after all can use encryptedSharedPreferences with biometric

* feat: docs in transaction preview and user comment for signing

* feat: mwp seed management

* feat: keys list

* feat: png tunnel and key menu

* feat: create and export keys

* feat: camera on homescreen

* feat: qr code parser

* feat: decode all qr messages into clean payload

* feat: transaction signing

* feat: mwp history screen in settings

* feat: history cards stub

* build: decrease minimum sdk level

* feat: some formatting for transaction details cards

* feat: scan progress indicator

* revert: use stable crates until metadata V14 is out

* fix: merge camera progress bar fix

* feat: replace ios navigation with flat custom one

* feat: docs and comments for transactions

* test: check links in docs

* ci: move links check on linux machine actions

* CI: chore

* CI: publish docs then check them

* CI: publish only /docs

* CI: move flag

* CI: use mdBook to compile book

* CI: debug mdbook

* CI: debug mdbook 2

* CI: mdbook latest version

* CI: mdbook dirty hack

* CI: mdbook use output dir

* CI: mdbook SUMMARY

* CI: mdbook builds

* CI: mdbook publish

* CI: linkcheck args

* CI: linkcheck args 1

* CI: linkcheck locally

* CI: mdbook serve in bkg

* CI: mdbook build first

* CI: another linkcheck

* CI: fix links

* CI: accidentially added

* CI: linkchecker fix links

* fix: fix most of settings screen

* docs: copy README to root for github

* chore: removed unused resources (moved some to docs)

* feat: custom focus-managing unified text input for ios

* fix: actually reset camera on home screen button

* feat: delete seed

* feat: search keys bar

* chore: cleanup master merge junk (revert)

Co-authored-by: Martin Pugh <martin@parity.io>
Co-authored-by: Martin Pugh <pugh@s3kr.it>
Co-authored-by: Denis P <denis.pisarev@parity.io>
@VladasZ
Copy link

VladasZ commented Jan 21, 2022

This really needs to be implemented. Without crate-type depending on target building cross platform crates supporting mobile platforms such as iOS and Android requires a lot fuss and workarounds.

@flukejones
Copy link

Related issue: #6179

@daxpedda
Copy link
Contributor

Related: rust-lang/rfcs#3180, and the follow-up: #10083.
Cargo teams opinion on (parts of) this at the moment: rust-lang/rfcs#3180 (comment).

@epage
Copy link
Contributor

epage commented Oct 31, 2023

While #12260 is a duplicate of this, it has more input from the cargo team, so I'm going to close in favor of that. If there is a reason to keep this open separately that I overlooked, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crate-types Area: crate-type declaration (lib, staticlib, dylib, cdylib, etc.) C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

Successfully merging a pull request may close this issue.