Description
First off, thank you @davidgraeff for this crate. It is fantastic! 🙌
I've run into an issue with generating queries and I'm leaving my notes for whomever it may help.
Describe the bug
Build fails for the braintree-queries-generator crate.
To Reproduce
Steps to reproduce the behavior:
$ git clone [email protected]:davidgraeff/braintree-payment-graphql-rs.git
$ cd braintree-payment-graphql-rs/braintree-queries-generator
$ rustc --version
rustc 1.41.0-nightly (412f43ac5 2019-11-24)
$ cargo build
Compiling crossbeam-channel v0.3.9
Compiling structopt v0.3.5
Compiling rustc_version v0.2.3
Compiling graphql-parser v0.2.3
Compiling rust_decimal v1.0.3
Compiling cookie_store v0.7.0
Compiling cargo_metadata v0.8.2
error[E0432]: unresolved import `crossbeam_utils::atomic`
--> /Users/travis/.cargo/registry/src/github.jpy.wang-1ecc6299db9ec823/crossbeam-channel-0.3.9/src/flavors/tick.rs:8:22
|
8 | use crossbeam_utils::atomic::AtomicCell;
| ^^^^^^ could not find `atomic` in `crossbeam_utils`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error: could not compile `crossbeam-channel`.
warning: build failed, waiting for other jobs to finish...
error: build failed
Expected behavior
The braintree-queries-generator
should build on +nightly
(or ideally +stable
).
Work-around
The error comes from crossbeam_utils and the rustfmt-nightly feature seems to be all that requires nightly.
Here I'm using +stable without the rustfmt-nightly feature to build and install the binary. This produces Rust code which is not easily readable but can be re-formatted externally with rustfmt
.
$ git clone [email protected]:davidgraeff/braintree-payment-graphql-rs.git
$ braintree-payment-graphql-rs/braintree-queries-generator
$ cargo +stable install --no-default-features --path . --force
Here's a Makefile
target I'm using to generate queries and re-format the generated rust code.
.PHONY: src/queries
src/queries:
~/.cargo/bin/braintree-queries-generator
rustfmt src/queries/*
sed -i.bak 's/graphql_client::GraphQLQueryCLI/braintreepayment_graphql::GraphQLQueryCLI/g' src/queries/*
rm src/queries/*.bak