mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 01:36:31 +02:00
Fix the build.ps1 that does not work well with -RestoreOnly switch (#46012)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Fix the `build.ps1` that does not work well with `-RestoreOnly` switch. Also there is `.slnf` now and the build script should support it. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -7,7 +7,7 @@ This file provides reusable helper functions used by the build scripts:
|
||||
- Get-BuildPaths: returns ScriptDir, OriginalCwd, RepoRoot (repo root detection)
|
||||
- RunMSBuild: wrapper around msbuild.exe (accepts optional Platform/Configuration)
|
||||
- RestoreThenBuild: performs restore and optionally builds the solution/project
|
||||
- BuildProjectsInDirectory: discovers and builds local .sln/.csproj/.vcxproj files
|
||||
- BuildProjectsInDirectory: discovers and builds local .slnx/.csproj/.vcxproj files
|
||||
- Ensure-VsDevEnvironment: initializes the Visual Studio developer environment when possible.
|
||||
It prefers the DevShell PowerShell module (Microsoft.VisualStudio.DevShell.dll / Enter-VsDevShell),
|
||||
falls back to running VsDevCmd.bat and importing its environment into the current PowerShell session,
|
||||
@@ -113,7 +113,7 @@ function BuildProjectsInDirectory {
|
||||
|
||||
$files = @()
|
||||
try {
|
||||
$files = Get-ChildItem -Path (Join-Path $DirectoryPath '*') -Include *.sln,*.slnx,*.csproj,*.vcxproj -File -ErrorAction SilentlyContinue
|
||||
$files = Get-ChildItem -Path (Join-Path $DirectoryPath '*') -Include *.sln,*.slnx,*.slnf,*.csproj,*.vcxproj -File -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
$files = @()
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function BuildProjectsInDirectory {
|
||||
|
||||
foreach ($f in $files) {
|
||||
Write-Host ("[LOCAL BUILD] Building {0}" -f $f.FullName)
|
||||
if ($f.Extension -eq '.sln') {
|
||||
if ($f.Extension -eq '.sln' -or $f.Extension -eq '.slnx') {
|
||||
RestoreThenBuild $f.FullName $ExtraArgs $Platform $Configuration $RestoreOnly
|
||||
} else {
|
||||
$buildArgs = '/m'
|
||||
|
||||
@@ -86,7 +86,7 @@ if (-not $Platform -or $Platform -eq '') {
|
||||
}
|
||||
}
|
||||
|
||||
$cwd = if ($Path) {
|
||||
$cwd = if ($Path -ne '') {
|
||||
(Resolve-Path $Path).ProviderPath
|
||||
} else {
|
||||
(Get-Location).ProviderPath
|
||||
|
||||
Reference in New Issue
Block a user