Skip to content

No more syntex #940

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

Merged
merged 12 commits into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ There is also the `./bindgen-integration` crate, which uses `bindgen` to
generate bindings to some C++ code, and then uses the bindings, asserting that
values are what we expect them to be both on the Rust and C++ side.

The generated and expected bindings are run through `rustfmt` before they are
compared. Make sure you have `rustfmt` up to date:

```
$ rustup update nightly
$ rustup run nightly cargo install -f rustfmt-nightly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when rustfmt changes the default formatting? All our CI breaks until we update them? That seems not great :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because both the generated bindings and the expectations are run through rustfmt before being compared.

```

### Testing Bindings Generation

To regenerate bindings from the corpus of test headers in `tests/headers` and
Expand Down
104 changes: 4 additions & 100 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 3 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,18 @@ diff = "0.1"
clap = "2"
shlex = "0.1"

[build-dependencies]
quasi_codegen = "0.32"

[dependencies]
cexpr = "0.2"
cfg-if = "0.1.0"
# This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
clap = "2"
clang-sys = { version = "0.19.0", features = ["runtime", "clang_3_9"] }
lazy_static = "0.2.1"
peeking_take_while = "0.1.2"
syntex_syntax = "0.58"
quote = "0.3.15"
regex = "0.2"
# This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
clap = "2"
which = "1.0.2"

[dependencies.aster]
features = ["with-syntex"]
version = "0.41"

[dependencies.env_logger]
optional = true
version = "0.4"
Expand All @@ -66,10 +59,6 @@ version = "0.4"
optional = true
version = "0.3"

[dependencies.quasi]
features = ["with-syntex"]
version = "0.32"

[features]
default = ["logging"]
logging = ["env_logger", "log"]
Expand Down
13 changes: 2 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
mod codegen {
extern crate quasi_codegen;
mod target {
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};

pub fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let src = Path::new("src/codegen/mod.rs");
let dst = Path::new(&out_dir).join("codegen.rs");

quasi_codegen::expand(&src, &dst).unwrap();
println!("cargo:rerun-if-changed=src/codegen/mod.rs");
println!("cargo:rerun-if-changed=src/codegen/error.rs");
println!("cargo:rerun-if-changed=src/codegen/helpers.rs");
println!("cargo:rerun-if-changed=src/codegen/struct_layout.rs");

let mut dst = File::create(Path::new(&out_dir).join("host-target.txt"))
.unwrap();
Expand Down Expand Up @@ -77,6 +68,6 @@ mod testgen {
}

fn main() {
codegen::main();
target::main();
testgen::main();
}
4 changes: 4 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export RUST_BACKTRACE=1

case "$BINDGEN_JOB" in
"test")
# Need rustfmt to compare the test expectations.
rustup update nightly
rustup run nightly cargo install -f rustfmt-nightly

cargo test $BINDGEN_PROFILE --features "$BINDGEN_FEATURES"
./ci/assert-no-diff.sh
;;
Expand Down
Loading