-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add new tool for dumping feature status based on tidy #133514
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "features-status-dump" | ||
version = "0.1.0" | ||
license = "MIT OR Apache-2.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
serde = { version = "1.0.125", features = [ "derive" ] } | ||
serde_json = "1.0.59" | ||
tidy = { path = "../tidy" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::collections::HashMap; | ||
use std::env; | ||
use std::fs::File; | ||
use std::io::BufWriter; | ||
use std::path::Path; | ||
|
||
use tidy::features::{Feature, collect_lang_features, collect_lib_features}; | ||
|
||
#[derive(serde::Serialize)] | ||
struct FeaturesStatus { | ||
lang_features_status: HashMap<String, Feature>, | ||
lib_features_status: HashMap<String, Feature>, | ||
} | ||
|
||
fn main() { | ||
let library_path_str = env::args_os().nth(1).expect("library/ path required"); | ||
let compiler_path_str = env::args_os().nth(2).expect("compiler/ path required"); | ||
let output_path_str = env::args_os().nth(3).expect("output path required"); | ||
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might be able to extend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: what you can do is that in the bootstrap build step, pass these paths (which bootstrap will know about) as cli flags to this tool. I'll take a look tmrw. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
let library_path = Path::new(&library_path_str); | ||
let compiler_path = Path::new(&compiler_path_str); | ||
let output_path = Path::new(&output_path_str); | ||
let lang_features_status = collect_lang_features(compiler_path, &mut false); | ||
let lib_features_status = collect_lib_features(library_path) | ||
.into_iter() | ||
.filter(|&(ref name, _)| !lang_features_status.contains_key(name)) | ||
.collect(); | ||
let features_status = FeaturesStatus { lang_features_status, lib_features_status }; | ||
let writer = File::create(output_path).expect("output path should be a valid path"); | ||
let writer = BufWriter::new(writer); | ||
serde_json::to_writer_pretty(writer, &features_status).unwrap(); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.