Files
wit-bindgen/build.rs
Peter Huene 5be459e57f Some clean-up work. (#391)
* Fix some typos and linter warnings.

This commit fixes some random comment typos and various linter warnings.

* wit-component: rename `decode_interface_component`.

This commit renames `decode_interface_component` to
`decode_component_interfaces` to better describe what the function does.

Previously it was meant to decode an "interface-only" component, but now it
returns all the interfaces (i.e. the "world") of the component.

* wit-component: implement multi-value return printing.

This commit implements printing of multi-value returns of interfaces decoded
from a component.

* Remove `module` field from `Interface`.

The `module` field was originally used by `cargo component` but is no longer
necessary and otherwise unused from `wit-bindgen` itself.

* Remove `symbol_namespace` from Rust generator.

This field is no longer used anywhere in the wit-bindgen repo.

* Add method to `Interface` for determining core export names.

This commit extracts the expected core export name out of `wit-component` and
into `Interface`, allowing generators to conform to the name expected by
`wit-component`.
2022-10-24 09:15:46 -05:00

35 lines
843 B
Rust

use std::{path::Path, process::Command};
fn main() {
println!("cargo:rerun-if-changed=build.rs");
commit_info();
}
fn commit_info() {
if !Path::new(".git").exists() {
return;
}
let output = match Command::new("git")
.arg("log")
.arg("-1")
.arg("--date=short")
.arg("--format=%H %h %cd")
.arg("--abbrev=9")
.output()
{
Ok(output) if output.status.success() => output,
_ => return,
};
let stdout = String::from_utf8(output.stdout).unwrap();
let mut parts = stdout.split_whitespace();
let mut next = || parts.next().unwrap();
println!("cargo:rustc-env=CARGO_GIT_HASH={}", next());
println!(
"cargo:rustc-env=CARGO_VERSION_INFO={} ({} {})",
env!("CARGO_PKG_VERSION"),
next(),
next()
);
}