From f39299469820bffe0c6ddb2f5d8ae422e820e650 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:36:06 -0500 Subject: [PATCH 01/11] tool_core --- crates/libs/core/tests/bindings.rs | 8 -------- crates/tools/core/Cargo.toml | 8 ++++++++ crates/{libs/core/tests => tools/core/src}/bindings.txt | 2 +- .../{libs/core/tests => tools/core/src}/com_bindings.txt | 2 +- crates/tools/core/src/main.rs | 7 +++++++ 5 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 crates/libs/core/tests/bindings.rs create mode 100644 crates/tools/core/Cargo.toml rename crates/{libs/core/tests => tools/core/src}/bindings.txt (98%) rename crates/{libs/core/tests => tools/core/src}/com_bindings.txt (94%) create mode 100644 crates/tools/core/src/main.rs diff --git a/crates/libs/core/tests/bindings.rs b/crates/libs/core/tests/bindings.rs deleted file mode 100644 index 468b8fb49d..0000000000 --- a/crates/libs/core/tests/bindings.rs +++ /dev/null @@ -1,8 +0,0 @@ -use windows_bindgen::*; - -#[test] -fn bindings() -> Result<()> { - bindgen(["--etc", "tests/bindings.txt"])?; - bindgen(["--etc", "tests/com_bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/core/Cargo.toml b/crates/tools/core/Cargo.toml new file mode 100644 index 0000000000..ae0934550d --- /dev/null +++ b/crates/tools/core/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tool_core" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/libs/core/tests/bindings.txt b/crates/tools/core/src/bindings.txt similarity index 98% rename from crates/libs/core/tests/bindings.txt rename to crates/tools/core/src/bindings.txt index 9b6e83a01d..37a36bc164 100644 --- a/crates/libs/core/tests/bindings.txt +++ b/crates/tools/core/src/bindings.txt @@ -1,6 +1,6 @@ // These will use `windows-sys` style bindings. ---out src/imp/bindings.rs +--out crates/libs/core/src/imp/bindings.rs --config flatten sys minimal no-bindgen-comment --filter diff --git a/crates/libs/core/tests/com_bindings.txt b/crates/tools/core/src/com_bindings.txt similarity index 94% rename from crates/libs/core/tests/com_bindings.txt rename to crates/tools/core/src/com_bindings.txt index d20b3d353a..aab10831f8 100644 --- a/crates/libs/core/tests/com_bindings.txt +++ b/crates/tools/core/src/com_bindings.txt @@ -1,6 +1,6 @@ // These will use `windows` style bindings and include COM APIs. ---out src/imp/com_bindings.rs +--out crates/libs/core/src/imp/com_bindings.rs --config flatten minimal no-bindgen-comment --filter diff --git a/crates/tools/core/src/main.rs b/crates/tools/core/src/main.rs new file mode 100644 index 0000000000..6a09a10108 --- /dev/null +++ b/crates/tools/core/src/main.rs @@ -0,0 +1,7 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/core/src/bindings.txt"])?; + bindgen(["--etc", "crates/tools/core/src/com_bindings.txt"])?; + Ok(()) +} From 3f1166b78879fb8fe6ed6f521245c6cd0f4b704e Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:41:05 -0500 Subject: [PATCH 02/11] tool_metadata --- crates/tools/metadata/Cargo.toml | 3 +++ crates/tools/metadata/{ => src}/bindings.txt | 1 - crates/tools/metadata/src/main.rs | 16 ++++------------ 3 files changed, 7 insertions(+), 13 deletions(-) rename crates/tools/metadata/{ => src}/bindings.txt (98%) diff --git a/crates/tools/metadata/Cargo.toml b/crates/tools/metadata/Cargo.toml index 59d105ff4f..4ccd80cb25 100644 --- a/crates/tools/metadata/Cargo.toml +++ b/crates/tools/metadata/Cargo.toml @@ -3,3 +3,6 @@ name = "tool_metadata" version = "0.0.0" edition = "2021" publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/metadata/bindings.txt b/crates/tools/metadata/src/bindings.txt similarity index 98% rename from crates/tools/metadata/bindings.txt rename to crates/tools/metadata/src/bindings.txt index 829d424fb4..597035180d 100644 --- a/crates/tools/metadata/bindings.txt +++ b/crates/tools/metadata/src/bindings.txt @@ -1,4 +1,3 @@ ---in crates/libs/bindgen/default --out crates/libs/metadata/src/bindings.rs --config flatten sys minimal no-bindgen-comment diff --git a/crates/tools/metadata/src/main.rs b/crates/tools/metadata/src/main.rs index 9c87ebcf9f..1d2f5db47f 100644 --- a/crates/tools/metadata/src/main.rs +++ b/crates/tools/metadata/src/main.rs @@ -1,14 +1,6 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); +use windows_bindgen::*; - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/metadata/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/metadata/src/bindings.txt"])?; + Ok(()) } From 192306b8994920d6c1be221613db398377cb2a58 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:43:58 -0500 Subject: [PATCH 03/11] tool_registry --- crates/libs/registry/tests/bindings.rs | 4 ---- crates/tools/registry/Cargo.toml | 8 ++++++++ .../registry/tests => tools/registry/src}/bindings.txt | 2 +- crates/tools/registry/src/main.rs | 6 ++++++ 4 files changed, 15 insertions(+), 5 deletions(-) delete mode 100644 crates/libs/registry/tests/bindings.rs create mode 100644 crates/tools/registry/Cargo.toml rename crates/{libs/registry/tests => tools/registry/src}/bindings.txt (97%) create mode 100644 crates/tools/registry/src/main.rs diff --git a/crates/libs/registry/tests/bindings.rs b/crates/libs/registry/tests/bindings.rs deleted file mode 100644 index 803ee2f2c8..0000000000 --- a/crates/libs/registry/tests/bindings.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn bindings() { - windows_bindgen::bindgen(["--etc", "tests/bindings.txt"]).unwrap(); -} diff --git a/crates/tools/registry/Cargo.toml b/crates/tools/registry/Cargo.toml new file mode 100644 index 0000000000..ca0847c5cd --- /dev/null +++ b/crates/tools/registry/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tool_registry" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/libs/registry/tests/bindings.txt b/crates/tools/registry/src/bindings.txt similarity index 97% rename from crates/libs/registry/tests/bindings.txt rename to crates/tools/registry/src/bindings.txt index 7f0a6f4e64..6bc398c2bd 100644 --- a/crates/libs/registry/tests/bindings.txt +++ b/crates/tools/registry/src/bindings.txt @@ -1,4 +1,4 @@ ---out src/bindings.rs +--out crates/libs/registry/src/bindings.rs --config flatten sys minimal no-bindgen-comment --filter diff --git a/crates/tools/registry/src/main.rs b/crates/tools/registry/src/main.rs new file mode 100644 index 0000000000..1681d86b78 --- /dev/null +++ b/crates/tools/registry/src/main.rs @@ -0,0 +1,6 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/registry/src/bindings.txt"])?; + Ok(()) +} From 60841277c97e88decbac7c1ad25f0a881a77d674 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:48:20 -0500 Subject: [PATCH 04/11] tool_result --- crates/libs/result/tests/bindings.rs | 4 ---- crates/tools/result/Cargo.toml | 8 ++++++++ .../{libs/result/tests => tools/result/src}/bindings.txt | 2 +- crates/tools/result/src/main.rs | 6 ++++++ 4 files changed, 15 insertions(+), 5 deletions(-) delete mode 100644 crates/libs/result/tests/bindings.rs create mode 100644 crates/tools/result/Cargo.toml rename crates/{libs/result/tests => tools/result/src}/bindings.txt (96%) create mode 100644 crates/tools/result/src/main.rs diff --git a/crates/libs/result/tests/bindings.rs b/crates/libs/result/tests/bindings.rs deleted file mode 100644 index 803ee2f2c8..0000000000 --- a/crates/libs/result/tests/bindings.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn bindings() { - windows_bindgen::bindgen(["--etc", "tests/bindings.txt"]).unwrap(); -} diff --git a/crates/tools/result/Cargo.toml b/crates/tools/result/Cargo.toml new file mode 100644 index 0000000000..33c0e5df65 --- /dev/null +++ b/crates/tools/result/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tool_result" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/libs/result/tests/bindings.txt b/crates/tools/result/src/bindings.txt similarity index 96% rename from crates/libs/result/tests/bindings.txt rename to crates/tools/result/src/bindings.txt index 33472b81e1..32236b86e3 100644 --- a/crates/libs/result/tests/bindings.txt +++ b/crates/tools/result/src/bindings.txt @@ -1,4 +1,4 @@ ---out src/bindings.rs +--out crates/libs/result/src/bindings.rs --config flatten sys minimal vtbl no-bindgen-comment --filter diff --git a/crates/tools/result/src/main.rs b/crates/tools/result/src/main.rs new file mode 100644 index 0000000000..b4ae120020 --- /dev/null +++ b/crates/tools/result/src/main.rs @@ -0,0 +1,6 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/result/src/bindings.txt"])?; + Ok(()) +} From 5537fe1035ccffff4834202b41661a15b3280734 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:51:34 -0500 Subject: [PATCH 05/11] tool_version --- crates/libs/version/Cargo.toml | 4 ---- crates/libs/version/src/lib.rs | 18 ------------------ crates/tools/version/Cargo.toml | 8 ++++++++ crates/tools/version/src/bindings.txt | 7 +++++++ crates/tools/version/src/main.rs | 6 ++++++ 5 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 crates/tools/version/Cargo.toml create mode 100644 crates/tools/version/src/bindings.txt create mode 100644 crates/tools/version/src/main.rs diff --git a/crates/libs/version/Cargo.toml b/crates/libs/version/Cargo.toml index e27026f8b2..15e2b91ec2 100644 --- a/crates/libs/version/Cargo.toml +++ b/crates/libs/version/Cargo.toml @@ -20,7 +20,3 @@ targets = [] [dependencies.windows-targets] version = "0.52.5" path = "../targets" - -[dev-dependencies.windows-bindgen] -version = "0.57.0" -path = "../bindgen" diff --git a/crates/libs/version/src/lib.rs b/crates/libs/version/src/lib.rs index ecb127449f..23ba99ee09 100644 --- a/crates/libs/version/src/lib.rs +++ b/crates/libs/version/src/lib.rs @@ -116,22 +116,4 @@ mod test { assert!(OsVersion::current() >= OsVersion::new(10, 100, 1_000, 10_000)); assert!(!(OsVersion::current() >= OsVersion::new(10, 100, 1_000, 10_001))); } - - #[test] - fn bindgen() { - let args = [ - "--out", - "src/bindings.rs", - "--config", - "flatten", - "sys", - "no-bindgen-comment", - "--filter", - "Windows.Wdk.System.SystemServices.RtlGetVersion", - "Windows.Win32.System.SystemInformation.OSVERSIONINFOEXW", - "Windows.Win32.System.SystemServices.VER_NT_WORKSTATION", - ]; - - windows_bindgen::bindgen(args).unwrap(); - } } diff --git a/crates/tools/version/Cargo.toml b/crates/tools/version/Cargo.toml new file mode 100644 index 0000000000..1a524f4055 --- /dev/null +++ b/crates/tools/version/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tool_version" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/version/src/bindings.txt b/crates/tools/version/src/bindings.txt new file mode 100644 index 0000000000..555ec9326f --- /dev/null +++ b/crates/tools/version/src/bindings.txt @@ -0,0 +1,7 @@ +--out crates/libs/version/src/bindings.rs +--config flatten sys no-bindgen-comment + +--filter + Windows.Wdk.System.SystemServices.RtlGetVersion + Windows.Win32.System.SystemInformation.OSVERSIONINFOEXW + Windows.Win32.System.SystemServices.VER_NT_WORKSTATION diff --git a/crates/tools/version/src/main.rs b/crates/tools/version/src/main.rs new file mode 100644 index 0000000000..575b7d60b0 --- /dev/null +++ b/crates/tools/version/src/main.rs @@ -0,0 +1,6 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/version/src/bindings.txt"])?; + Ok(()) +} From 8377002315aad0dfb9756b0e37020bdcae306baa Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:52:59 -0500 Subject: [PATCH 06/11] tool_yml --- .github/workflows/clippy.yml | 8 ++++++++ .github/workflows/test.yml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 1d55461eb1..bc37cb92d5 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -258,6 +258,8 @@ jobs: run: cargo clippy -p test_window_long - name: Clippy test_winrt run: cargo clippy -p test_winrt + - name: Clippy tool_core + run: cargo clippy -p tool_core - name: Clippy tool_gnu run: cargo clippy -p tool_gnu - name: Clippy tool_lib @@ -268,10 +270,16 @@ jobs: run: cargo clippy -p tool_metadata - name: Clippy tool_msvc run: cargo clippy -p tool_msvc + - name: Clippy tool_registry + run: cargo clippy -p tool_registry + - name: Clippy tool_result + run: cargo clippy -p tool_result - name: Clippy tool_standalone run: cargo clippy -p tool_standalone - name: Clippy tool_sys run: cargo clippy -p tool_sys + - name: Clippy tool_version + run: cargo clippy -p tool_version - name: Clippy tool_windows run: cargo clippy -p tool_windows - name: Clippy tool_yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 884c5bacc9..0cb19797bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,6 +286,8 @@ jobs: run: cargo test -p test_window_long --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_winrt run: cargo test -p test_winrt --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test tool_core + run: cargo test -p tool_core --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_gnu run: cargo test -p tool_gnu --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_lib @@ -296,10 +298,16 @@ jobs: run: cargo test -p tool_metadata --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_msvc run: cargo test -p tool_msvc --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test tool_registry + run: cargo test -p tool_registry --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test tool_result + run: cargo test -p tool_result --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_standalone run: cargo test -p tool_standalone --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_sys run: cargo test -p tool_sys --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test tool_version + run: cargo test -p tool_version --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_windows run: cargo test -p tool_windows --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_yml From 5093d2bd68912ba56c7ac78920a8dd4a44e7a830 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:56:03 -0500 Subject: [PATCH 07/11] tool_sys --- crates/tools/sys/Cargo.toml | 3 +++ crates/tools/sys/{ => src}/bindings.txt | 1 - crates/tools/sys/src/main.rs | 16 ++++------------ 3 files changed, 7 insertions(+), 13 deletions(-) rename crates/tools/sys/{ => src}/bindings.txt (99%) diff --git a/crates/tools/sys/Cargo.toml b/crates/tools/sys/Cargo.toml index e82c2b0f18..72bd0217d0 100644 --- a/crates/tools/sys/Cargo.toml +++ b/crates/tools/sys/Cargo.toml @@ -3,3 +3,6 @@ name = "tool_sys" version = "0.0.0" edition = "2021" publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/sys/bindings.txt b/crates/tools/sys/src/bindings.txt similarity index 99% rename from crates/tools/sys/bindings.txt rename to crates/tools/sys/src/bindings.txt index 7f6a6b5dfa..03939d4f86 100644 --- a/crates/tools/sys/bindings.txt +++ b/crates/tools/sys/src/bindings.txt @@ -1,4 +1,3 @@ ---in crates/libs/bindgen/default --out crates/libs/sys/src/lib.rs --config package sys no-bindgen-comment --config rustfmt-config=max_width=800,newline_style=Unix diff --git a/crates/tools/sys/src/main.rs b/crates/tools/sys/src/main.rs index b9cc3008bf..6a126b1942 100644 --- a/crates/tools/sys/src/main.rs +++ b/crates/tools/sys/src/main.rs @@ -1,14 +1,6 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); +use windows_bindgen::*; - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/sys/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/sys/src/bindings.txt"])?; + Ok(()) } From 5b7161e2812ac03f26a3a4630e096dc6bf391921 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 13:57:31 -0500 Subject: [PATCH 08/11] tool_windows --- crates/tools/windows/Cargo.toml | 3 +++ crates/tools/windows/{ => src}/bindings.txt | 1 - crates/tools/windows/src/main.rs | 16 ++++------------ 3 files changed, 7 insertions(+), 13 deletions(-) rename crates/tools/windows/{ => src}/bindings.txt (96%) diff --git a/crates/tools/windows/Cargo.toml b/crates/tools/windows/Cargo.toml index c44909b5dc..cbafd2127a 100644 --- a/crates/tools/windows/Cargo.toml +++ b/crates/tools/windows/Cargo.toml @@ -3,3 +3,6 @@ name = "tool_windows" version = "0.0.0" edition = "2021" publish = false + +[dependencies] +windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/windows/bindings.txt b/crates/tools/windows/src/bindings.txt similarity index 96% rename from crates/tools/windows/bindings.txt rename to crates/tools/windows/src/bindings.txt index 3cd700917c..4068160a2b 100644 --- a/crates/tools/windows/bindings.txt +++ b/crates/tools/windows/src/bindings.txt @@ -1,4 +1,3 @@ ---in crates/libs/bindgen/default --out crates/libs/windows/src/lib.rs --config package no-bindgen-comment --config prepend:Windows.Win32.Foundation.WIN32_ERROR=#[must_use] diff --git a/crates/tools/windows/src/main.rs b/crates/tools/windows/src/main.rs index c56c95b4ee..7a1ce97416 100644 --- a/crates/tools/windows/src/main.rs +++ b/crates/tools/windows/src/main.rs @@ -1,14 +1,6 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); +use windows_bindgen::*; - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/windows/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); +fn main() -> Result<()> { + bindgen(["--etc", "crates/tools/windows/src/bindings.txt"])?; + Ok(()) } From bc7f604a33db54c5c9a8598bb043c86944fdf28d Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 14:36:25 -0500 Subject: [PATCH 09/11] tool_bindings --- crates/tools/{core => bindings}/Cargo.toml | 2 +- .../bindings.txt => bindings/src/core.txt} | 0 .../src/core_com.txt} | 0 crates/tools/bindings/src/main.rs | 24 +++++++++++++++++++ .../src/metadata.txt} | 0 .../src/registry.txt} | 0 .../bindings.txt => bindings/src/result.txt} | 0 .../src/bindings.txt => bindings/src/sys.txt} | 0 .../bindings.txt => bindings/src/version.txt} | 0 .../bindings.txt => bindings/src/windows.txt} | 0 crates/tools/core/src/main.rs | 7 ------ crates/tools/metadata/Cargo.toml | 8 ------- crates/tools/metadata/src/main.rs | 6 ----- crates/tools/registry/Cargo.toml | 8 ------- crates/tools/registry/src/main.rs | 6 ----- crates/tools/result/Cargo.toml | 8 ------- crates/tools/result/src/main.rs | 6 ----- crates/tools/sys/Cargo.toml | 8 ------- crates/tools/sys/src/main.rs | 6 ----- crates/tools/version/Cargo.toml | 8 ------- crates/tools/version/src/main.rs | 6 ----- crates/tools/windows/Cargo.toml | 8 ------- crates/tools/windows/src/main.rs | 6 ----- 23 files changed, 25 insertions(+), 92 deletions(-) rename crates/tools/{core => bindings}/Cargo.toml (84%) rename crates/tools/{core/src/bindings.txt => bindings/src/core.txt} (100%) rename crates/tools/{core/src/com_bindings.txt => bindings/src/core_com.txt} (100%) create mode 100644 crates/tools/bindings/src/main.rs rename crates/tools/{metadata/src/bindings.txt => bindings/src/metadata.txt} (100%) rename crates/tools/{registry/src/bindings.txt => bindings/src/registry.txt} (100%) rename crates/tools/{result/src/bindings.txt => bindings/src/result.txt} (100%) rename crates/tools/{sys/src/bindings.txt => bindings/src/sys.txt} (100%) rename crates/tools/{version/src/bindings.txt => bindings/src/version.txt} (100%) rename crates/tools/{windows/src/bindings.txt => bindings/src/windows.txt} (100%) delete mode 100644 crates/tools/core/src/main.rs delete mode 100644 crates/tools/metadata/Cargo.toml delete mode 100644 crates/tools/metadata/src/main.rs delete mode 100644 crates/tools/registry/Cargo.toml delete mode 100644 crates/tools/registry/src/main.rs delete mode 100644 crates/tools/result/Cargo.toml delete mode 100644 crates/tools/result/src/main.rs delete mode 100644 crates/tools/sys/Cargo.toml delete mode 100644 crates/tools/sys/src/main.rs delete mode 100644 crates/tools/version/Cargo.toml delete mode 100644 crates/tools/version/src/main.rs delete mode 100644 crates/tools/windows/Cargo.toml delete mode 100644 crates/tools/windows/src/main.rs diff --git a/crates/tools/core/Cargo.toml b/crates/tools/bindings/Cargo.toml similarity index 84% rename from crates/tools/core/Cargo.toml rename to crates/tools/bindings/Cargo.toml index ae0934550d..a42bc8aad4 100644 --- a/crates/tools/core/Cargo.toml +++ b/crates/tools/bindings/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tool_core" +name = "tool_bindings" version = "0.0.0" edition = "2021" publish = false diff --git a/crates/tools/core/src/bindings.txt b/crates/tools/bindings/src/core.txt similarity index 100% rename from crates/tools/core/src/bindings.txt rename to crates/tools/bindings/src/core.txt diff --git a/crates/tools/core/src/com_bindings.txt b/crates/tools/bindings/src/core_com.txt similarity index 100% rename from crates/tools/core/src/com_bindings.txt rename to crates/tools/bindings/src/core_com.txt diff --git a/crates/tools/bindings/src/main.rs b/crates/tools/bindings/src/main.rs new file mode 100644 index 0000000000..3c738dd45a --- /dev/null +++ b/crates/tools/bindings/src/main.rs @@ -0,0 +1,24 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + for path in &bindings() { + println!("bindings: {path}"); + bindgen(["--etc", path])?; + } + Ok(()) +} + +fn bindings() -> Vec { + let mut paths = vec![]; + + if let Ok(files) = std::fs::read_dir("crates\\tools\\bindings\\src") { + for file in files.filter_map(|file| file.ok()) { + let path = file.path(); + if path.to_string_lossy().ends_with(".txt") { + paths.push(path.to_string_lossy().into_owned()); + } + } + } + + paths +} diff --git a/crates/tools/metadata/src/bindings.txt b/crates/tools/bindings/src/metadata.txt similarity index 100% rename from crates/tools/metadata/src/bindings.txt rename to crates/tools/bindings/src/metadata.txt diff --git a/crates/tools/registry/src/bindings.txt b/crates/tools/bindings/src/registry.txt similarity index 100% rename from crates/tools/registry/src/bindings.txt rename to crates/tools/bindings/src/registry.txt diff --git a/crates/tools/result/src/bindings.txt b/crates/tools/bindings/src/result.txt similarity index 100% rename from crates/tools/result/src/bindings.txt rename to crates/tools/bindings/src/result.txt diff --git a/crates/tools/sys/src/bindings.txt b/crates/tools/bindings/src/sys.txt similarity index 100% rename from crates/tools/sys/src/bindings.txt rename to crates/tools/bindings/src/sys.txt diff --git a/crates/tools/version/src/bindings.txt b/crates/tools/bindings/src/version.txt similarity index 100% rename from crates/tools/version/src/bindings.txt rename to crates/tools/bindings/src/version.txt diff --git a/crates/tools/windows/src/bindings.txt b/crates/tools/bindings/src/windows.txt similarity index 100% rename from crates/tools/windows/src/bindings.txt rename to crates/tools/bindings/src/windows.txt diff --git a/crates/tools/core/src/main.rs b/crates/tools/core/src/main.rs deleted file mode 100644 index 6a09a10108..0000000000 --- a/crates/tools/core/src/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/core/src/bindings.txt"])?; - bindgen(["--etc", "crates/tools/core/src/com_bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/metadata/Cargo.toml b/crates/tools/metadata/Cargo.toml deleted file mode 100644 index 4ccd80cb25..0000000000 --- a/crates/tools/metadata/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_metadata" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/metadata/src/main.rs b/crates/tools/metadata/src/main.rs deleted file mode 100644 index 1d2f5db47f..0000000000 --- a/crates/tools/metadata/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/metadata/src/bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/registry/Cargo.toml b/crates/tools/registry/Cargo.toml deleted file mode 100644 index ca0847c5cd..0000000000 --- a/crates/tools/registry/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_registry" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/registry/src/main.rs b/crates/tools/registry/src/main.rs deleted file mode 100644 index 1681d86b78..0000000000 --- a/crates/tools/registry/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/registry/src/bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/result/Cargo.toml b/crates/tools/result/Cargo.toml deleted file mode 100644 index 33c0e5df65..0000000000 --- a/crates/tools/result/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_result" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/result/src/main.rs b/crates/tools/result/src/main.rs deleted file mode 100644 index b4ae120020..0000000000 --- a/crates/tools/result/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/result/src/bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/sys/Cargo.toml b/crates/tools/sys/Cargo.toml deleted file mode 100644 index 72bd0217d0..0000000000 --- a/crates/tools/sys/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_sys" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/sys/src/main.rs b/crates/tools/sys/src/main.rs deleted file mode 100644 index 6a126b1942..0000000000 --- a/crates/tools/sys/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/sys/src/bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/version/Cargo.toml b/crates/tools/version/Cargo.toml deleted file mode 100644 index 1a524f4055..0000000000 --- a/crates/tools/version/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_version" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/version/src/main.rs b/crates/tools/version/src/main.rs deleted file mode 100644 index 575b7d60b0..0000000000 --- a/crates/tools/version/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/version/src/bindings.txt"])?; - Ok(()) -} diff --git a/crates/tools/windows/Cargo.toml b/crates/tools/windows/Cargo.toml deleted file mode 100644 index cbafd2127a..0000000000 --- a/crates/tools/windows/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "tool_windows" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies] -windows-bindgen = { path = "../../libs/bindgen" } diff --git a/crates/tools/windows/src/main.rs b/crates/tools/windows/src/main.rs deleted file mode 100644 index 7a1ce97416..0000000000 --- a/crates/tools/windows/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -use windows_bindgen::*; - -fn main() -> Result<()> { - bindgen(["--etc", "crates/tools/windows/src/bindings.txt"])?; - Ok(()) -} From 511b0338c728a4a2c93bae5680db0c12ea5c8075 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 14:37:42 -0500 Subject: [PATCH 10/11] yml --- .github/workflows/clippy.yml | 16 ++-------------- .github/workflows/gen.yml | 2 +- .github/workflows/test.yml | 16 ++-------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index bc37cb92d5..4164a07029 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -258,30 +258,18 @@ jobs: run: cargo clippy -p test_window_long - name: Clippy test_winrt run: cargo clippy -p test_winrt - - name: Clippy tool_core - run: cargo clippy -p tool_core + - name: Clippy tool_bindings + run: cargo clippy -p tool_bindings - name: Clippy tool_gnu run: cargo clippy -p tool_gnu - name: Clippy tool_lib run: cargo clippy -p tool_lib - name: Clippy tool_license run: cargo clippy -p tool_license - - name: Clippy tool_metadata - run: cargo clippy -p tool_metadata - name: Clippy tool_msvc run: cargo clippy -p tool_msvc - - name: Clippy tool_registry - run: cargo clippy -p tool_registry - - name: Clippy tool_result - run: cargo clippy -p tool_result - name: Clippy tool_standalone run: cargo clippy -p tool_standalone - - name: Clippy tool_sys - run: cargo clippy -p tool_sys - - name: Clippy tool_version - run: cargo clippy -p tool_version - - name: Clippy tool_windows - run: cargo clippy -p tool_windows - name: Clippy tool_yml run: cargo clippy -p tool_yml - name: Clippy windows diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index 52d66315f6..3ac9f550d4 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - tool: [windows, sys, yml, license, metadata, standalone] + tool: [bindings, yml, license, standalone] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0cb19797bd..4aaaccfa78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,30 +286,18 @@ jobs: run: cargo test -p test_window_long --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_winrt run: cargo test -p test_winrt --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_core - run: cargo test -p tool_core --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test tool_bindings + run: cargo test -p tool_bindings --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_gnu run: cargo test -p tool_gnu --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_lib run: cargo test -p tool_lib --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_license run: cargo test -p tool_license --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_metadata - run: cargo test -p tool_metadata --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_msvc run: cargo test -p tool_msvc --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_registry - run: cargo test -p tool_registry --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_result - run: cargo test -p tool_result --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_standalone run: cargo test -p tool_standalone --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_sys - run: cargo test -p tool_sys --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_version - run: cargo test -p tool_version --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test tool_windows - run: cargo test -p tool_windows --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test tool_yml run: cargo test -p tool_yml --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test windows From 9d57a77964cd21e3aceccaaaf672d94f4198be01 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Fri, 14 Jun 2024 14:45:34 -0500 Subject: [PATCH 11/11] simpler --- crates/tools/bindings/src/main.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/crates/tools/bindings/src/main.rs b/crates/tools/bindings/src/main.rs index 3c738dd45a..518fdb8722 100644 --- a/crates/tools/bindings/src/main.rs +++ b/crates/tools/bindings/src/main.rs @@ -1,24 +1,19 @@ use windows_bindgen::*; fn main() -> Result<()> { - for path in &bindings() { - println!("bindings: {path}"); - bindgen(["--etc", path])?; - } + run("crates/tools/bindings/src/core_com.txt")?; + run("crates/tools/bindings/src/core.txt")?; + run("crates/tools/bindings/src/metadata.txt")?; + run("crates/tools/bindings/src/registry.txt")?; + run("crates/tools/bindings/src/result.txt")?; + run("crates/tools/bindings/src/sys.txt")?; + run("crates/tools/bindings/src/version.txt")?; + run("crates/tools/bindings/src/windows.txt")?; Ok(()) } -fn bindings() -> Vec { - let mut paths = vec![]; - - if let Ok(files) = std::fs::read_dir("crates\\tools\\bindings\\src") { - for file in files.filter_map(|file| file.ok()) { - let path = file.path(); - if path.to_string_lossy().ends_with(".txt") { - paths.push(path.to_string_lossy().into_owned()); - } - } - } - - paths +fn run(path: &str) -> Result<()> { + println!("{path}"); + bindgen(["--etc", path])?; + Ok(()) }