diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 1d55461eb1..4164a07029 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -258,22 +258,18 @@ jobs: run: cargo clippy -p test_window_long - name: Clippy test_winrt run: cargo clippy -p test_winrt + - 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_standalone run: cargo clippy -p tool_standalone - - name: Clippy tool_sys - run: cargo clippy -p tool_sys - - 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 884c5bacc9..4aaaccfa78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -286,22 +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_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_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_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 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/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/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/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/bindings/Cargo.toml b/crates/tools/bindings/Cargo.toml new file mode 100644 index 0000000000..a42bc8aad4 --- /dev/null +++ b/crates/tools/bindings/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tool_bindings" +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/bindings/src/core.txt similarity index 98% rename from crates/libs/core/tests/bindings.txt rename to crates/tools/bindings/src/core.txt index 9b6e83a01d..37a36bc164 100644 --- a/crates/libs/core/tests/bindings.txt +++ b/crates/tools/bindings/src/core.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/bindings/src/core_com.txt similarity index 94% rename from crates/libs/core/tests/com_bindings.txt rename to crates/tools/bindings/src/core_com.txt index d20b3d353a..aab10831f8 100644 --- a/crates/libs/core/tests/com_bindings.txt +++ b/crates/tools/bindings/src/core_com.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/bindings/src/main.rs b/crates/tools/bindings/src/main.rs new file mode 100644 index 0000000000..518fdb8722 --- /dev/null +++ b/crates/tools/bindings/src/main.rs @@ -0,0 +1,19 @@ +use windows_bindgen::*; + +fn main() -> Result<()> { + 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 run(path: &str) -> Result<()> { + println!("{path}"); + bindgen(["--etc", path])?; + Ok(()) +} diff --git a/crates/tools/metadata/bindings.txt b/crates/tools/bindings/src/metadata.txt similarity index 98% rename from crates/tools/metadata/bindings.txt rename to crates/tools/bindings/src/metadata.txt index 829d424fb4..597035180d 100644 --- a/crates/tools/metadata/bindings.txt +++ b/crates/tools/bindings/src/metadata.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/libs/registry/tests/bindings.txt b/crates/tools/bindings/src/registry.txt similarity index 97% rename from crates/libs/registry/tests/bindings.txt rename to crates/tools/bindings/src/registry.txt index 7f0a6f4e64..6bc398c2bd 100644 --- a/crates/libs/registry/tests/bindings.txt +++ b/crates/tools/bindings/src/registry.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/libs/result/tests/bindings.txt b/crates/tools/bindings/src/result.txt similarity index 96% rename from crates/libs/result/tests/bindings.txt rename to crates/tools/bindings/src/result.txt index 33472b81e1..32236b86e3 100644 --- a/crates/libs/result/tests/bindings.txt +++ b/crates/tools/bindings/src/result.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/sys/bindings.txt b/crates/tools/bindings/src/sys.txt similarity index 99% rename from crates/tools/sys/bindings.txt rename to crates/tools/bindings/src/sys.txt index 7f6a6b5dfa..03939d4f86 100644 --- a/crates/tools/sys/bindings.txt +++ b/crates/tools/bindings/src/sys.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/bindings/src/version.txt b/crates/tools/bindings/src/version.txt new file mode 100644 index 0000000000..555ec9326f --- /dev/null +++ b/crates/tools/bindings/src/version.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/windows/bindings.txt b/crates/tools/bindings/src/windows.txt similarity index 96% rename from crates/tools/windows/bindings.txt rename to crates/tools/bindings/src/windows.txt index 3cd700917c..4068160a2b 100644 --- a/crates/tools/windows/bindings.txt +++ b/crates/tools/bindings/src/windows.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/metadata/Cargo.toml b/crates/tools/metadata/Cargo.toml deleted file mode 100644 index 59d105ff4f..0000000000 --- a/crates/tools/metadata/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[package] -name = "tool_metadata" -version = "0.0.0" -edition = "2021" -publish = false diff --git a/crates/tools/metadata/src/main.rs b/crates/tools/metadata/src/main.rs deleted file mode 100644 index 9c87ebcf9f..0000000000 --- a/crates/tools/metadata/src/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); - - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/metadata/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); -} diff --git a/crates/tools/sys/Cargo.toml b/crates/tools/sys/Cargo.toml deleted file mode 100644 index e82c2b0f18..0000000000 --- a/crates/tools/sys/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[package] -name = "tool_sys" -version = "0.0.0" -edition = "2021" -publish = false diff --git a/crates/tools/sys/src/main.rs b/crates/tools/sys/src/main.rs deleted file mode 100644 index b9cc3008bf..0000000000 --- a/crates/tools/sys/src/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); - - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/sys/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); -} diff --git a/crates/tools/windows/Cargo.toml b/crates/tools/windows/Cargo.toml deleted file mode 100644 index c44909b5dc..0000000000 --- a/crates/tools/windows/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[package] -name = "tool_windows" -version = "0.0.0" -edition = "2021" -publish = false diff --git a/crates/tools/windows/src/main.rs b/crates/tools/windows/src/main.rs deleted file mode 100644 index c56c95b4ee..0000000000 --- a/crates/tools/windows/src/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let mut command = std::process::Command::new("cargo"); - - command.args([ - "run", - "-p", - "riddle", - "--", - "--etc", - "crates/tools/windows/bindings.txt", - ]); - - assert!(command.status().unwrap().success()); -}