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

braintree-queries-generator build fails #1

Open
travismiller opened this issue Dec 6, 2019 · 2 comments
Open

braintree-queries-generator build fails #1

travismiller opened this issue Dec 6, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@travismiller
Copy link

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 git@github.com: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.com-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 git@github.com: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

Noteworthy external issues

@travismiller travismiller added the bug Something isn't working label Dec 6, 2019
@travismiller
Copy link
Author

I forgot to mention that the generated code implements graphql_client::GraphQLQueryCLI which is not published so I'm patching the code in my Makefile target.

@davidgraeff
Copy link
Owner

Thanks for the report. Because upstream has accepted by GraphQL patches, I have scheduled to update this crate and I will look into this.

Formatting is indeed the only part that requires rust nightly and should be feature gated. The codegen app could also probe for an installed rustfmt and use the external binary to perform formatting. I will come up with something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants