You've already forked wit-bindgen
mirror of
https://github.com/AdaCore/wit-bindgen.git
synced 2026-02-12 13:12:42 -08:00
* 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`.
35 lines
843 B
Rust
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()
|
|
);
|
|
}
|