Skip to content

Commit

Permalink
Merge branch 'master' into rafael/web-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
riverar authored Jan 6, 2025
2 parents c6dc26e + 382ea56 commit 6b0a4a5
Show file tree
Hide file tree
Showing 44 changed files with 334 additions and 498 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ jobs:
run: cargo clippy -p sample_bits
- name: Clippy sample_com_uri
run: cargo clippy -p sample_com_uri
- name: Clippy sample_component_hello_world
run: cargo clippy -p sample_component_hello_world
- name: Clippy sample_component_json_validator
run: cargo clippy -p sample_component_json_validator
- name: Clippy sample_component_json_validator_client
run: cargo clippy -p sample_component_json_validator_client
- name: Clippy sample_component_json_validator_winrt
run: cargo clippy -p sample_component_json_validator_winrt
- name: Clippy sample_component_json_validator_winrt_client
run: cargo clippy -p sample_component_json_validator_winrt_client
- name: Clippy sample_component_json_validator_winrt_client_cpp
run: cargo clippy -p sample_component_json_validator_winrt_client_cpp
- name: Clippy sample_consent
run: cargo clippy -p sample_consent
- name: Clippy sample_core_app
Expand Down Expand Up @@ -87,6 +75,16 @@ jobs:
run: cargo clippy -p sample_enum_windows_sys
- name: Clippy sample_file_dialogs
run: cargo clippy -p sample_file_dialogs
- name: Clippy sample_json_validator
run: cargo clippy -p sample_json_validator
- name: Clippy sample_json_validator_client
run: cargo clippy -p sample_json_validator_client
- name: Clippy sample_json_validator_winrt
run: cargo clippy -p sample_json_validator_winrt
- name: Clippy sample_json_validator_winrt_client
run: cargo clippy -p sample_json_validator_winrt_client
- name: Clippy sample_json_validator_winrt_client_cpp
run: cargo clippy -p sample_json_validator_winrt_client_cpp
- name: Clippy sample_kernel_event
run: cargo clippy -p sample_kernel_event
- name: Clippy sample_memory_buffer
Expand Down
32 changes: 14 additions & 18 deletions .github/workflows/raw-dylib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ jobs:
run: cargo test -p sample_bits --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_com_uri
run: cargo test -p sample_com_uri --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_hello_world
run: cargo test -p sample_component_hello_world --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator
run: cargo test -p sample_component_json_validator --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_client
run: cargo test -p sample_component_json_validator_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt
run: cargo test -p sample_component_json_validator_winrt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt_client
run: cargo test -p sample_component_json_validator_winrt_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt_client_cpp
run: cargo test -p sample_component_json_validator_winrt_client_cpp --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_consent
run: cargo test -p sample_consent --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_core_app
Expand Down Expand Up @@ -114,6 +102,16 @@ jobs:
run: cargo test -p sample_enum_windows_sys --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_file_dialogs
run: cargo test -p sample_file_dialogs --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator
run: cargo test -p sample_json_validator --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_client
run: cargo test -p sample_json_validator_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt
run: cargo test -p sample_json_validator_winrt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt_client
run: cargo test -p sample_json_validator_winrt_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt_client_cpp
run: cargo test -p sample_json_validator_winrt_client_cpp --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_kernel_event
run: cargo test -p sample_kernel_event --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_memory_buffer
Expand Down Expand Up @@ -160,10 +158,10 @@ jobs:
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_feature
run: cargo test -p test_arch_feature --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_array
run: cargo test -p test_array --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_async
Expand Down Expand Up @@ -262,10 +260,10 @@ jobs:
run: cargo test -p test_readme --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_ref_params
run: cargo test -p test_ref_params --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference
run: cargo test -p test_reference --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference_client
run: cargo test -p test_reference_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference_float
Expand Down Expand Up @@ -364,8 +362,6 @@ jobs:
run: cargo test -p windows_x86_64_gnu --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test windows_x86_64_gnullvm
run: cargo test -p windows_x86_64_gnullvm --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test windows_x86_64_msvc
run: cargo test -p windows_x86_64_msvc --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Check diff
Expand Down
32 changes: 14 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ jobs:
run: cargo test -p sample_bits --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_com_uri
run: cargo test -p sample_com_uri --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_hello_world
run: cargo test -p sample_component_hello_world --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator
run: cargo test -p sample_component_json_validator --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_client
run: cargo test -p sample_component_json_validator_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt
run: cargo test -p sample_component_json_validator_winrt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt_client
run: cargo test -p sample_component_json_validator_winrt_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_component_json_validator_winrt_client_cpp
run: cargo test -p sample_component_json_validator_winrt_client_cpp --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_consent
run: cargo test -p sample_consent --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_core_app
Expand Down Expand Up @@ -111,6 +99,16 @@ jobs:
run: cargo test -p sample_enum_windows_sys --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_file_dialogs
run: cargo test -p sample_file_dialogs --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator
run: cargo test -p sample_json_validator --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_client
run: cargo test -p sample_json_validator_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt
run: cargo test -p sample_json_validator_winrt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt_client
run: cargo test -p sample_json_validator_winrt_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_json_validator_winrt_client_cpp
run: cargo test -p sample_json_validator_winrt_client_cpp --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_kernel_event
run: cargo test -p sample_kernel_event --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test sample_memory_buffer
Expand Down Expand Up @@ -157,10 +155,10 @@ jobs:
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_feature
run: cargo test -p test_arch_feature --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_array
run: cargo test -p test_array --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_async
Expand Down Expand Up @@ -259,10 +257,10 @@ jobs:
run: cargo test -p test_readme --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_ref_params
run: cargo test -p test_ref_params --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference
run: cargo test -p test_reference --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_reference_client
run: cargo test -p test_reference_client --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_reference_float
Expand Down Expand Up @@ -361,8 +359,6 @@ jobs:
run: cargo test -p windows_x86_64_gnu --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test windows_x86_64_gnullvm
run: cargo test -p windows_x86_64_gnullvm --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test windows_x86_64_msvc
run: cargo test -p windows_x86_64_msvc --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Check diff
Expand Down
4 changes: 3 additions & 1 deletion crates/libs/bindgen/src/types/cpp_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,9 @@ fn is_param_retval(ty: &Type, param: Param, hint: ParamHint) -> bool {
{
return false;
}
if hint.is_array() {
// This is reevaluated to detect unsupported array parameters.
// https://github.com/microsoft/windows-rs/issues/3384
if ParamHint::from_param(param).is_array() {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/libs/bindgen/src/winmd/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ impl Blob {
} else {
(
(((self[0] & 0x1F) as usize) << 24)
| (self[1] as usize) << 16
| (self[2] as usize) << 8
| ((self[1] as usize) << 16)
| ((self[2] as usize) << 8)
| self[3] as usize,
4,
)
Expand Down
6 changes: 3 additions & 3 deletions crates/libs/bindgen/src/winmd/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ impl File {

let heap_sizes = result.bytes.copy_as::<u8>(tables_data.0 + 6)?;
let string_index_size = if (heap_sizes & 1) == 1 { 4 } else { 2 };
let guid_index_size = if (heap_sizes >> 1 & 1) == 1 { 4 } else { 2 };
let blob_index_size = if (heap_sizes >> 2 & 1) == 1 { 4 } else { 2 };
let guid_index_size = if ((heap_sizes >> 1) & 1) == 1 { 4 } else { 2 };
let blob_index_size = if ((heap_sizes >> 2) & 1) == 1 { 4 } else { 2 };
let valid_bits = result.bytes.copy_as::<u64>(tables_data.0 + 8)?;
view = tables_data.0 + 24;

Expand Down Expand Up @@ -174,7 +174,7 @@ impl File {
let mut unused_module = Table::default();

for i in 0..64 {
if (valid_bits >> i & 1) == 0 {
if ((valid_bits >> i) & 1) == 0 {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/libs/core/src/guid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl GUID {
pub const fn from_u128(uuid: u128) -> Self {
Self {
data1: (uuid >> 96) as u32,
data2: (uuid >> 80 & 0xffff) as u16,
data3: (uuid >> 64 & 0xffff) as u16,
data2: ((uuid >> 80) & 0xffff) as u16,
data3: ((uuid >> 64) & 0xffff) as u16,
data4: (uuid as u64).to_be_bytes(),
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/libs/core/src/imp/sha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ impl ConstBuffer {
.push(b'-')
.push_hex_u16(guid.data3)
.push(b'-')
.push_hex_u16((guid.data4[0] as u16) << 8 | guid.data4[1] as u16)
.push_hex_u16(((guid.data4[0] as u16) << 8) | guid.data4[1] as u16)
.push(b'-')
.push_hex_u16((guid.data4[2] as u16) << 8 | guid.data4[3] as u16)
.push_hex_u16((guid.data4[4] as u16) << 8 | guid.data4[5] as u16)
.push_hex_u16((guid.data4[6] as u16) << 8 | guid.data4[7] as u16)
.push_hex_u16(((guid.data4[2] as u16) << 8) | guid.data4[3] as u16)
.push_hex_u16(((guid.data4[4] as u16) << 8) | guid.data4[5] as u16)
.push_hex_u16(((guid.data4[6] as u16) << 8) | guid.data4[7] as u16)
.push(b'}')
}
}
Expand Down
5 changes: 1 addition & 4 deletions crates/libs/cppwinrt/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ version = "0.1"
Use `cppwinrt` function as needed:

```rust
match cppwinrt::cppwinrt(["-help"]) {
Ok(output) => println!("{output}"),
Err(error) => println!("{error}"),
};
println!("{}", cppwinrt::cppwinrt(["-help"]));
```

Source:
Expand Down
20 changes: 12 additions & 8 deletions crates/libs/cppwinrt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const VERSION: &str = "2.0.240405.15";
/// Calls the C++/WinRT compiler with the given arguments.
///
/// Use `cppwinrt["-help"]` for available options.
pub fn cppwinrt<I, S>(args: I) -> Result<String, String>
#[track_caller]
pub fn cppwinrt<I, S>(args: I) -> String
where
I: IntoIterator<Item = S>,
S: AsRef<std::ffi::OsStr>,
Expand All @@ -27,9 +28,9 @@ where
_ = std::fs::remove_file(path);

if output.status.success() {
Ok(String::from_utf8_lossy(&output.stdout).to_string())
String::from_utf8_lossy(&output.stdout).to_string()
} else {
Err(String::from_utf8_lossy(&output.stderr).to_string())
panic!("{}", String::from_utf8_lossy(&output.stderr))
}
}

Expand All @@ -38,11 +39,14 @@ mod tests {
use crate::*;

#[test]
fn test() {
let ok = cppwinrt(["-help"]).unwrap();
assert!(ok.contains(VERSION), "unexpected version");
#[should_panic(expected = "'-invalid' is not supported")]
fn invalid_arg() {
cppwinrt(["-invalid"]);
}

let err = cppwinrt(["-invalid"]).unwrap_err();
assert!(err.contains("'-invalid' is not supported"));
#[test]
fn unexpected_version() {
let ok = cppwinrt(["-help"]);
assert!(ok.contains(VERSION), "unexpected version");
}
}
Loading

0 comments on commit 6b0a4a5

Please sign in to comment.