Skip to content

Commit

Permalink
refactor: use is_none_or for clippy::nonminimal_bool and resolve …
Browse files Browse the repository at this point in the history
…`clippy::needless_raw_string_hashes` (#231)

Signed-off-by: NateD-MSFT <[email protected]>
Co-authored-by: NateD-MSFT <[email protected]>
  • Loading branch information
wmmc88 and NateD-MSFT authored Nov 7, 2024
1 parent 420f44f commit 4cb9626
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
27 changes: 16 additions & 11 deletions .github/actions/winget-install/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,42 @@ inputs:
runs:
using: "composite"
steps:
- name: Get URIs for Latest Winget assets
- name: Get URIs for Winget v1.8.1911 assets
shell: pwsh
run: |
$AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" }
$LatestReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
$LatestWingetDownloadUri = $LatestReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') }
$LatestWingetLicenseDownloadUri = $LatestReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') }
$ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566'
$WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') }
$WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') }
# Print to logs
Write-Host "LatestWingetDownloadUri=$LatestWingetDownloadUri"
Write-Host "LatestWingetLicenseDownloadUri=$LatestWingetLicenseDownloadUri"
Write-Host "WingetDownloadUri=$WingetDownloadUri"
Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri"
# Save output for next step
Write-Output "LatestWingetDownloadUri=$LatestWingetDownloadUri" >> $env:GITHUB_ENV
Write-Output "LatestWingetLicenseDownloadUri=$LatestWingetLicenseDownloadUri" >> $env:GITHUB_ENV
Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV
Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV
- name: Download Winget Assets and Dependencies
shell: pwsh
run: |
New-Item -Type Directory $env:RUNNER_TEMP/winget-install
Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx # Needed per https://github.com/microsoft/winget-cli/blob/21de1607ed5c90174e6bb931406975c18681a5dd/README.md?plain=1#L35C19-L35C19
Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:LatestWingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle
Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:LatestWingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml
Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle
Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml
- name: Start Winget Installation
- name: Start Winget Installation for all Users
shell: pwsh
run: |
Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx
- name: Install Winget for Current User (for better install diagnostics)
shell: powershell
run: |
Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle
- name: Wait for Completion of Winget Installation
shell: pwsh
run: |
Expand Down
4 changes: 1 addition & 3 deletions crates/wdk-build/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ pub fn validate_wdk_version_format<S: AsRef<str>>(version_string: S) -> bool {
let version_parts: Vec<&str> = version.split('.').collect();

// First, check if we have "10" as our first value
if !version_parts.first().is_some_and(|first| *first == "10") {
// FIXME: Once is_some_or is stabilized, replace the above with:
// if version_parts.first().is_none_or(|first| *first != "10") {
if version_parts.first().is_none_or(|first| *first != "10") {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/wdk-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ macro_rules! call_unsafe_wdf_function_binding {{
}}"#
);
static ref TEST_STUBS_TEMPLATE: String = format!(
r#"
r"
use crate::WDFFUNC;
/// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile
#[no_mangle]
pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null();
"#,
",
);
}

Expand Down

0 comments on commit 4cb9626

Please sign in to comment.