Skip to content

Commit

Permalink
Tweak riddle arguments (#2563)
Browse files Browse the repository at this point in the history
  • Loading branch information
riverar authored Jul 2, 2023
1 parent a817607 commit fa7b524
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 53 deletions.
8 changes: 4 additions & 4 deletions crates/tests/component/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ fn main() {
"--target-dir",
"../../../target/test_component", // TODO: workaround for https://github.com/rust-lang/cargo/issues/6412
"--",
"-in",
"--in",
"component.winmd",
&metadata_dir,
"-out",
"--out",
"src/bindings.rs",
"-filter",
"--filter",
"test_component",
"-config",
"--config",
"IMPLEMENT",
]);

Expand Down
6 changes: 3 additions & 3 deletions crates/tests/component_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ fn main() {
"--target-dir",
"../../../target/test_component_client", // TODO: workaround for https://github.com/rust-lang/cargo/issues/6412
"--",
"-in",
"--in",
"../component/component.winmd",
&format!("{}\\System32\\WinMetadata", env!("windir")),
"-out",
"--out",
"src/bindings.rs",
"-filter",
"--filter",
"test_component",
]);

Expand Down
8 changes: 4 additions & 4 deletions crates/tests/riddle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ pub fn run_riddle(name: &str) -> Vec<windows_metadata::File> {
// Convert .idl to .winmd
let mut command = Command::new("cargo");
command.args([
"run", "-p", "riddle", "--", "-in", &idl, "-out", &winmd, "-filter", "Test",
"run", "-p", "riddle", "--", "--in", &idl, "--out", &winmd, "--filter", "Test",
]);
assert!(command.status().unwrap().success());

// Convert .winmd back to .idl
let mut command = Command::new("cargo");
command.args([
"run", "-p", "riddle", "--", "-in", &winmd, "-out", &idl, "-filter", "Test",
"run", "-p", "riddle", "--", "--in", &winmd, "--out", &idl, "--filter", "Test",
]);
assert!(command.status().unwrap().success());

Expand All @@ -32,8 +32,8 @@ pub fn run_riddle(name: &str) -> Vec<windows_metadata::File> {
// Convert .idl to .rs
let mut command = Command::new("cargo");
command.args([
"run", "-p", "riddle", "--", "-in", &idl, "-out", &rs, "-filter", "Test",
]); // TODO: -config FLATTEN doesn't work for namespaces
"run", "-p", "riddle", "--", "--in", &idl, "--out", &rs, "--filter", "Test",
]); // TODO: --config FLATTEN doesn't work for namespaces
assert!(command.status().unwrap().success());

// Return winmd file for validation
Expand Down
8 changes: 4 additions & 4 deletions crates/tests/standalone/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ fn riddle(output: &str, filter: &[&str], config: &[&str]) {
"--target-dir",
"../../../target/test_standalone", // TODO: workaround for https://github.com/rust-lang/cargo/issues/6412
"--",
"-in",
"--in",
"../../libs/metadata/default",
"-out",
"--out",
output,
"-filter",
"--filter",
]);

command.args(filter);
command.arg("-config");
command.arg("--config");
command.args(config);

if !command.status().unwrap().success() {
Expand Down
8 changes: 4 additions & 4 deletions crates/tools/core/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-in crates/libs/metadata/default
-out crates/libs/core/src/imp/bindings.rs
-config FLATTEN SYS MINIMAL
--in crates/libs/metadata/default
--out crates/libs/core/src/imp/bindings.rs
--config FLATTEN SYS MINIMAL

-filter
--filter
Windows.Win32.Foundation.CloseHandle
Windows.Win32.Foundation.ERROR_NO_UNICODE_TRANSLATION
Windows.Win32.Foundation.GetLastError
Expand Down
8 changes: 4 additions & 4 deletions crates/tools/core/com_bindings.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-in crates/libs/metadata/default
-out crates/libs/core/src/imp/com_bindings.rs
-config FLATTEN MINIMAL
--in crates/libs/metadata/default
--out crates/libs/core/src/imp/com_bindings.rs
--config FLATTEN MINIMAL

-filter
--filter
Windows.Foundation.IReference
Windows.Foundation.IStringable
Windows.Foundation.PropertyValue
Expand Down
4 changes: 2 additions & 2 deletions crates/tools/core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
"-p",
"riddle",
"--",
"-etc",
"--etc",
"crates/tools/core/bindings.txt",
]);

Expand All @@ -19,7 +19,7 @@ fn main() {
"-p",
"riddle",
"--",
"-etc",
"--etc",
"crates/tools/core/com_bindings.txt",
]);

Expand Down
8 changes: 4 additions & 4 deletions crates/tools/metadata/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-in crates/libs/metadata/default
-out crates/libs/metadata/src/imp/bindings.rs
-config FLATTEN SYS MINIMAL
--in crates/libs/metadata/default
--out crates/libs/metadata/src/imp/bindings.rs
--config FLATTEN SYS MINIMAL

-filter
--filter
Windows.Win32.System.Diagnostics.Debug.IMAGE_COR20_HEADER
Windows.Win32.System.Diagnostics.Debug.IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
Windows.Win32.System.Diagnostics.Debug.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
Expand Down
2 changes: 1 addition & 1 deletion crates/tools/metadata/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
"-p",
"riddle",
"--",
"-etc",
"--etc",
"crates/tools/metadata/bindings.txt",
]);

Expand Down
2 changes: 1 addition & 1 deletion crates/tools/riddle/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn from_iter<T: Iterator<Item = String>>(result: &mut Vec<String>, args: T) -> R
for args in crate::read_file_lines(&arg)? {
from_string(result, &args)?;
}
} else if arg == "-etc" {
} else if arg == "--etc" {
expand = true;
} else {
result.push(arg);
Expand Down
24 changes: 12 additions & 12 deletions crates/tools/riddle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ fn run() -> Result<()> {
r#"Usage: riddle.exe [options...]
Options:
-in <path> Path to files and directories containing .winmd and .idl files
-out <path> Path to .winmd or .idl file to generate
-filter <namespace> Namespaces to include or !exclude in output
-format Format .idl files only
-config <key=value> Override a configuration value
-etc <path> File containing command line options
--in <path> Path to files and directories containing .winmd and .idl files
--out <path> Path to .winmd, .idl, or .rs file to generate
--filter <namespace> Namespaces to include or !exclude in output
--config <key=value> Override a configuration value
--format Format .idl files only
--etc <path> File containing command line options
"#
);
return Ok(());
Expand All @@ -59,11 +59,11 @@ Options:

match kind {
ArgKind::None => match arg.as_str() {
"-in" => kind = ArgKind::Input,
"-out" => kind = ArgKind::Output,
"-filter" => kind = ArgKind::Filter,
"-config" => kind = ArgKind::Config,
"-format" => format = true,
"--in" => kind = ArgKind::Input,
"--out" => kind = ArgKind::Output,
"--filter" => kind = ArgKind::Filter,
"--config" => kind = ArgKind::Config,
"--format" => format = true,
_ => return Err(Error::new(&format!("invalid option `{arg}`"))),
},
ArgKind::Output => {
Expand Down Expand Up @@ -94,7 +94,7 @@ Options:
if format {
if output.is_some() || !include.is_empty() || !exclude.is_empty() {
return Err(Error::new(
"-format cannot be combined with -output, -include, or -exclude",
"--format cannot be combined with --out or --filter",
));
}

Expand Down
8 changes: 4 additions & 4 deletions crates/tools/sys/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-in crates/libs/metadata/default
-out crates/libs/sys/src/lib.rs
-config PACKAGE SYS
--in crates/libs/metadata/default
--out crates/libs/sys/src/lib.rs
--config PACKAGE SYS

-filter
--filter
Windows.Win32
Windows.Wdk
!Windows.AI
Expand Down
2 changes: 1 addition & 1 deletion crates/tools/sys/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
"-p",
"riddle",
"--",
"-etc",
"--etc",
"crates/tools/sys/bindings.txt",
]);

Expand Down
8 changes: 4 additions & 4 deletions crates/tools/windows/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-in crates/libs/metadata/default
-out crates/libs/windows/src/lib.rs
-config PACKAGE
--in crates/libs/metadata/default
--out crates/libs/windows/src/lib.rs
--config PACKAGE

-filter
--filter
Windows
!Windows.AI.MachineLearning.Preview
!Windows.ApplicationModel.SocialInfo
Expand Down
2 changes: 1 addition & 1 deletion crates/tools/windows/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
"-p",
"riddle",
"--",
"-etc",
"--etc",
"crates/tools/windows/bindings.txt",
]);

Expand Down

0 comments on commit fa7b524

Please sign in to comment.