From 8c15f3f0b7109418c31d77a7a9358eea88003911 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Thu, 5 Sep 2024 07:45:38 -0500 Subject: [PATCH] helpers --- .github/workflows/clippy.yml | 4 ++-- .github/workflows/no-default-features.yml | 2 ++ .github/workflows/test.yml | 12 ++++++------ Cargo.toml | 1 + crates/{tools/lib => libs/helpers}/Cargo.toml | 2 +- crates/{tools/lib => libs/helpers}/src/lib.rs | 18 ++++++------------ crates/tests/metadata/Cargo.toml | 4 ++-- crates/tests/metadata/tests/attribute_enum.rs | 2 +- crates/tests/metadata/tests/fn_call_size.rs | 2 +- crates/tests/metadata/tests/unused.rs | 2 +- crates/tests/riddle/Cargo.toml | 4 ++-- crates/tests/riddle/src/lib.rs | 2 +- crates/tests/targets/Cargo.toml | 4 ++-- crates/tests/targets/tests/files.rs | 2 +- crates/tests/winrt/Cargo.toml | 2 +- crates/tools/gnu/Cargo.toml | 4 ++-- crates/tools/msvc/Cargo.toml | 4 ++-- crates/tools/yml/Cargo.toml | 4 ++-- crates/tools/yml/src/main.rs | 6 +++--- 19 files changed, 39 insertions(+), 42 deletions(-) rename crates/{tools/lib => libs/helpers}/Cargo.toml (87%) rename crates/{tools/lib => libs/helpers}/src/lib.rs (86%) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index db83ae29d7..6c246d5c49 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -31,6 +31,8 @@ jobs: uses: ./.github/actions/fix-environment - name: Clippy cppwinrt run: cargo clippy -p cppwinrt + - name: Clippy helpers + run: cargo clippy -p helpers - name: Clippy riddle run: cargo clippy -p riddle - name: Clippy sample_bits @@ -269,8 +271,6 @@ jobs: 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_msvc diff --git a/.github/workflows/no-default-features.yml b/.github/workflows/no-default-features.yml index 558582dc73..07f0615636 100644 --- a/.github/workflows/no-default-features.yml +++ b/.github/workflows/no-default-features.yml @@ -29,6 +29,8 @@ jobs: uses: ./.github/actions/fix-environment - name: Check cppwinrt run: cargo check -p cppwinrt --no-default-features + - name: Check helpers + run: cargo check -p helpers --no-default-features - name: Check windows run: cargo check -p windows --no-default-features - name: Check windows-bindgen diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0589234aee..860482483e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,8 @@ jobs: run: cargo clean - name: Test cppwinrt run: cargo test -p cppwinrt --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Test helpers + run: cargo test -p helpers --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test riddle run: cargo test -p riddle --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test sample_bits @@ -151,10 +153,10 @@ jobs: run: cargo test -p test_agile_reference --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_alternate_success_code run: cargo test -p test_alternate_success_code --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test test_arch - run: cargo test -p test_arch --target ${{ matrix.target }} ${{ matrix.etc }} - name: Clean run: cargo clean + - name: Test test_arch + run: cargo test -p test_arch --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_arch_feature run: cargo test -p test_arch_feature --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_array @@ -253,10 +255,10 @@ jobs: run: cargo test -p test_reserved --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_resources run: cargo test -p test_resources --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test test_result - run: cargo test -p test_result --target ${{ matrix.target }} ${{ matrix.etc }} - name: Clean run: cargo clean + - name: Test test_result + run: cargo test -p test_result --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_return_handle run: cargo test -p test_return_handle --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_return_struct @@ -297,8 +299,6 @@ jobs: 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_msvc diff --git a/Cargo.toml b/Cargo.toml index 4396030fe6..4d34ec07b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,3 +30,4 @@ windows-strings = { path = "crates/libs/strings" } windows-sys = { path = "crates/libs/sys" } windows-targets = { path = "crates/libs/targets" } windows-version = { path = "crates/libs/version" } +helpers = { path = "crates/libs/helpers" } diff --git a/crates/tools/lib/Cargo.toml b/crates/libs/helpers/Cargo.toml similarity index 87% rename from crates/tools/lib/Cargo.toml rename to crates/libs/helpers/Cargo.toml index 231a30d851..33173d34fc 100644 --- a/crates/tools/lib/Cargo.toml +++ b/crates/libs/helpers/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tool_lib" +name = "helpers" version = "0.0.0" edition = "2021" publish = false diff --git a/crates/tools/lib/src/lib.rs b/crates/libs/helpers/src/lib.rs similarity index 86% rename from crates/tools/lib/src/lib.rs rename to crates/libs/helpers/src/lib.rs index aa60516282..f66c7bf5f3 100644 --- a/crates/tools/lib/src/lib.rs +++ b/crates/libs/helpers/src/lib.rs @@ -10,18 +10,12 @@ pub enum CallingConvention { pub fn default_metadata() -> Vec { vec![ - metadata::File::new( - std::include_bytes!("../../../libs/bindgen/default/Windows.winmd").to_vec(), - ) - .expect("invalid winmd"), - metadata::File::new( - std::include_bytes!("../../../libs/bindgen/default/Windows.Win32.winmd").to_vec(), - ) - .expect("invalid winmd"), - metadata::File::new( - std::include_bytes!("../../../libs/bindgen/default/Windows.Wdk.winmd").to_vec(), - ) - .expect("invalid winmd"), + metadata::File::new(std::include_bytes!("../../bindgen/default/Windows.winmd").to_vec()) + .expect("invalid winmd"), + metadata::File::new(std::include_bytes!("../../bindgen/default/Windows.Win32.winmd").to_vec()) + .expect("invalid winmd"), + metadata::File::new(std::include_bytes!("../../bindgen/default/Windows.Wdk.winmd").to_vec()) + .expect("invalid winmd"), ] } diff --git a/crates/tests/metadata/Cargo.toml b/crates/tests/metadata/Cargo.toml index 44ffd25b5d..d2b124e1cd 100644 --- a/crates/tests/metadata/Cargo.toml +++ b/crates/tests/metadata/Cargo.toml @@ -25,5 +25,5 @@ features = [ "Win32_System_SystemServices", ] -[dependencies.tool_lib] -path = "../../tools/lib" +[dependencies.helpers] +workspace = true \ No newline at end of file diff --git a/crates/tests/metadata/tests/attribute_enum.rs b/crates/tests/metadata/tests/attribute_enum.rs index bde1630c5a..202f5dca2f 100644 --- a/crates/tests/metadata/tests/attribute_enum.rs +++ b/crates/tests/metadata/tests/attribute_enum.rs @@ -2,7 +2,7 @@ use windows_metadata::*; #[test] fn attribute_enum() { - let files = tool_lib::default_metadata(); + let files = helpers::default_metadata(); let reader = Reader::new(files); let (method, _) = reader diff --git a/crates/tests/metadata/tests/fn_call_size.rs b/crates/tests/metadata/tests/fn_call_size.rs index b67262fa3b..a05fc65fb4 100644 --- a/crates/tests/metadata/tests/fn_call_size.rs +++ b/crates/tests/metadata/tests/fn_call_size.rs @@ -5,7 +5,7 @@ fn size() { // Note: you can double check these export names from a Visual Studio x86 command prompt as follows: // dumpbin /exports kernel32.lib | findstr /i RtmConvertIpv6AddressAndLengthToNetAddress - let files = tool_lib::default_metadata(); + let files = helpers::default_metadata(); let reader = Reader::new(files); assert_eq!( diff --git a/crates/tests/metadata/tests/unused.rs b/crates/tests/metadata/tests/unused.rs index f2f2665277..bbce6e6f8a 100644 --- a/crates/tests/metadata/tests/unused.rs +++ b/crates/tests/metadata/tests/unused.rs @@ -2,7 +2,7 @@ use windows_metadata::*; #[test] fn test() { - let files = tool_lib::default_metadata(); + let files = helpers::default_metadata(); let reader = Reader::filter( files, &["Windows", "BadNamespace", "Windows.AI"], diff --git a/crates/tests/riddle/Cargo.toml b/crates/tests/riddle/Cargo.toml index 039fce0a26..393683c2fe 100644 --- a/crates/tests/riddle/Cargo.toml +++ b/crates/tests/riddle/Cargo.toml @@ -14,8 +14,8 @@ workspace = true [dependencies.windows-metadata] workspace = true -[dependencies.tool_lib] -path = "../../tools/lib" +[dependencies.helpers] +workspace = true [dependencies.windows-bindgen] workspace = true diff --git a/crates/tests/riddle/src/lib.rs b/crates/tests/riddle/src/lib.rs index 05dc9a1647..3b95c6e762 100644 --- a/crates/tests/riddle/src/lib.rs +++ b/crates/tests/riddle/src/lib.rs @@ -64,7 +64,7 @@ pub fn run_riddle(name: &str, dialect: &str, etc: &[&str]) -> Vec