-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into anastasiia-extract-block-reverter
- Loading branch information
Showing
170 changed files
with
4,422 additions
and
2,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//! Build script for the external node binary. | ||
use std::{ | ||
env, fs, | ||
io::{self, Write}, | ||
path::Path, | ||
}; | ||
|
||
use rustc_version::{Channel, LlvmVersion}; | ||
|
||
fn print_rust_meta(out: &mut impl Write, meta: &rustc_version::VersionMeta) -> io::Result<()> { | ||
writeln!( | ||
out, | ||
"pub(crate) const RUSTC_METADATA: RustcMetadata = RustcMetadata {{ \ | ||
version: {semver:?}, \ | ||
commit_hash: {commit_hash:?}, \ | ||
commit_date: {commit_date:?}, \ | ||
channel: {channel:?}, \ | ||
host: {host:?}, \ | ||
llvm: {llvm:?} \ | ||
}};", | ||
semver = meta.semver.to_string(), | ||
commit_hash = meta.commit_hash, | ||
commit_date = meta.commit_date, | ||
channel = match meta.channel { | ||
Channel::Dev => "dev", | ||
Channel::Beta => "beta", | ||
Channel::Nightly => "nightly", | ||
Channel::Stable => "stable", | ||
}, | ||
host = meta.host, | ||
llvm = meta.llvm_version.as_ref().map(LlvmVersion::to_string), | ||
) | ||
} | ||
|
||
fn main() { | ||
let out_dir = env::var("OUT_DIR").expect("`OUT_DIR` env var not set for build script"); | ||
let rustc_meta = rustc_version::version_meta().expect("Failed obtaining rustc metadata"); | ||
|
||
let metadata_module_path = Path::new(&out_dir).join("metadata_values.rs"); | ||
let metadata_module = | ||
fs::File::create(metadata_module_path).expect("cannot create metadata module"); | ||
let mut metadata_module = io::BufWriter::new(metadata_module); | ||
|
||
print_rust_meta(&mut metadata_module, &rustc_meta).expect("failed printing rustc metadata"); | ||
} |
Oops, something went wrong.