Skip to content

Commit

Permalink
Merge branch 'master' into inspectable-is-null
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Jun 4, 2024
2 parents e3c7224 + 8b4a185 commit 7a09db5
Show file tree
Hide file tree
Showing 115 changed files with 5,316 additions and 954 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.winmd -text
*.lib -text
*.a -text
*.exe -text
28 changes: 21 additions & 7 deletions .github/actions/fix-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ runs:
- name: Configure environment
shell: pwsh
run: |
$vs_root = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -property installationPath -format value
switch -Wildcard ("${{ matrix.target }}")
{
"*-pc-windows-gnu"
Expand All @@ -26,27 +29,38 @@ runs:
}
"i686*"
{
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH
((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86")
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86")
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH
}
"x86_64*"
{
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH
((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64")
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64")
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH
}
"aarch64*"
{
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH
((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64")
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64")
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH
}
"*"
{
(Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH
(Join-Path $env:GITHUB_WORKSPACE "target\test\debug\deps").ToString() >> $env:GITHUB_PATH
"INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" `
"INCLUDE=${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\winrt;${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\cppwinrt" `
>> $env:GITHUB_ENV
}
}
# Workaround to address several issues with windows-2022 runners:
# - Old mingw-w64-* binutils that prevent deterministic builds.
# - Missing llvm-dlltool in the native Windows LLVM package.
# - Missing mingw-w64 compiler packages.
- name: Update packages
shell: pwsh
run: |
C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-binutils
C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-llvm
C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-i686-gcc
C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-gcc
6 changes: 5 additions & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022

strategy:
matrix:
Expand All @@ -32,6 +32,8 @@ jobs:
run: rustup component add clippy
- name: Fix environment
uses: ./.github/actions/fix-environment
- name: Clippy cppwinrt
run: cargo clippy -p cppwinrt
- name: Clippy no_std
run: cargo clippy -p no_std
- name: Clippy riddle
Expand All @@ -50,6 +52,8 @@ jobs:
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
2 changes: 1 addition & 1 deletion .github/workflows/debugger_visualizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022

strategy:
matrix:
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,22 +27,30 @@ jobs:
set PATH=C:\msys64\mingw64\bin;%PATH%
cargo run -p tool_gnu -- all
- name: Find Visual Studio
id: visual-studio
shell: pwsh
run: |
$path = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -property installationPath -format value
"install_path=$path" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Build i686_msvc
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" x86
call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" x86
cargo run -p tool_msvc
- name: Build x86_64_msvc
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" amd64
call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" amd64
cargo run -p tool_msvc
- name: Build aarch64_msvc
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" amd64_arm64
call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" amd64_arm64
cargo run -p tool_msvc
- name: Upload libs
Expand All @@ -60,7 +68,7 @@ jobs:
- name: Check dumpbin
shell: pwsh
run: |
$VisualStudioRoot = & vswhere -latest -property installationPath -format value
$VisualStudioRoot = "${{steps.visual-studio.outputs.install_path}}"
$DumpbinPath = Resolve-Path "$VisualStudioRoot\VC\Tools\MSVC\*\bin\*\x86\dumpbin.exe" |
Select -ExpandProperty Path -First 1
$Tests = @(
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msrv-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
rust: [1.70.0, stable, nightly]
runs-on:
- windows-2019
- windows-2022
- ubuntu-latest
runs-on: ${{ matrix.runs-on }}
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/no-default-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022

strategy:
matrix:
Expand All @@ -30,6 +30,8 @@ jobs:
run: rustup target add ${{ matrix.target }}
- name: Fix environment
uses: ./.github/actions/fix-environment
- name: Check cppwinrt
run: cargo check -p cppwinrt --no-default-features
- name: Check windows
run: cargo check -p windows --no-default-features
- name: Check windows-bindgen
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/raw_dylib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022

strategy:
matrix:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
check:
runs-on: windows-2019
runs-on: windows-2022

strategy:
matrix:
Expand Down Expand Up @@ -56,6 +56,8 @@ jobs:
uses: ./.github/actions/fix-environment
- name: Clean
run: cargo clean
- name: Test cppwinrt
run: cargo test -p cppwinrt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test no_std
run: cargo test -p no_std --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test riddle
Expand All @@ -74,6 +76,8 @@ jobs:
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 @@ -152,12 +156,12 @@ 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: Test test_array
run: cargo test -p test_array --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_bcrypt
run: cargo test -p test_bcrypt --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_bstr
Expand Down Expand Up @@ -254,12 +258,12 @@ jobs:
run: cargo test -p test_standalone --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_string_param
run: cargo test -p test_string_param --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_structs
run: cargo test -p test_structs --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_sys
run: cargo test -p test_sys --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Clean
run: cargo clean
- name: Test test_targets
run: cargo test -p test_targets --target ${{ matrix.target }} ${{ matrix.etc }}
- name: Test test_unions
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/target
*.lock
*.winmd
winrt
16 changes: 13 additions & 3 deletions crates/libs/bindgen/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ impl From<Error> for std::io::Error {
impl From<syn::Error> for Error {
fn from(error: syn::Error) -> Self {
let start = error.span().start();
Self { message: error.to_string(), span: Some((start.line, start.column)), ..Self::default() }
Self {
message: error.to_string(),
span: Some((start.line, start.column)),
..Self::default()
}
}
}

Expand All @@ -40,10 +44,16 @@ impl std::fmt::Display for Error {

impl Error {
pub(crate) fn new(message: &str) -> Self {
Self { message: message.to_string(), ..Self::default() }
Self {
message: message.to_string(),
..Self::default()
}
}

pub(crate) fn with_path(self, path: &str) -> Self {
Self { path: path.to_string(), ..self }
Self {
path: path.to_string(),
..self
}
}
}
Loading

0 comments on commit 7a09db5

Please sign in to comment.