diff --git a/.gitignore b/.gitignore index ed3f80a4ec..1318abc22c 100644 --- a/.gitignore +++ b/.gitignore @@ -349,10 +349,7 @@ src/common/Telemetry/*.etl /src/modules/powerrename/ui/RCb24464 # Generated installer file for Monaco source files. -/installer/PowerToysSetup/MonacoSRC.wxs -/installer/PowerToysSetup/DscResources.wxs /installer/PowerToysSetupVNext/MonacoSRC.wxs -/installer/PowerToysSetupVNext/DscResources.wxs # MSBuildCache /MSBuildCacheLogs/ diff --git a/.pipelines/generateDscManifests.ps1 b/.pipelines/generateDscManifests.ps1 index 109610e62e..e0a2f463af 100644 --- a/.pipelines/generateDscManifests.ps1 +++ b/.pipelines/generateDscManifests.ps1 @@ -65,21 +65,28 @@ if (-not (Test-Path $outputDir)) { New-Item -Path $outputDir -ItemType Directory -Force | Out-Null } -Write-Host "DSC manifests will be generated to: '$outputDir'" +# DSC v3 manifests go to DSCModules subfolder +$dscOutputDir = Join-Path $outputDir 'DSCModules' +if (-not (Test-Path $dscOutputDir)) { + Write-Host "Creating DSCModules subfolder at '$dscOutputDir'." + New-Item -Path $dscOutputDir -ItemType Directory -Force | Out-Null +} -Write-Host "Cleaning previously generated DSC manifest files from '$outputDir'." -Get-ChildItem -Path $outputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction SilentlyContinue | Remove-Item -Force +Write-Host "DSC manifests will be generated to: '$dscOutputDir'" -$arguments = @('manifest', '--resource', 'settings', '--outputDir', $outputDir) +Write-Host "Cleaning previously generated DSC manifest files from '$dscOutputDir'." +Get-ChildItem -Path $dscOutputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction SilentlyContinue | Remove-Item -Force + +$arguments = @('manifest', '--resource', 'settings', '--outputDir', $dscOutputDir) Write-Host "Invoking DSC manifest generator: '$exePath' $($arguments -join ' ')" & $exePath @arguments if ($LASTEXITCODE -ne 0) { throw "PowerToys.DSC.exe exited with code $LASTEXITCODE" } -$generatedFiles = Get-ChildItem -Path $outputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction Stop +$generatedFiles = Get-ChildItem -Path $dscOutputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction Stop if ($generatedFiles.Count -eq 0) { - throw "No DSC manifest files were generated in '$outputDir'." + throw "No DSC manifest files were generated in '$dscOutputDir'." } Write-Host "Generated $($generatedFiles.Count) DSC manifest file(s):" diff --git a/installer/PowerToysSetupCustomActionsVNext/PowerToysSetupCustomActionsVNext.vcxproj b/installer/PowerToysSetupCustomActionsVNext/PowerToysSetupCustomActionsVNext.vcxproj index 71d7b97fed..21b0e75837 100644 --- a/installer/PowerToysSetupCustomActionsVNext/PowerToysSetupCustomActionsVNext.vcxproj +++ b/installer/PowerToysSetupCustomActionsVNext/PowerToysSetupCustomActionsVNext.vcxproj @@ -54,6 +54,7 @@ call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\CmdPal.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\CmdPal.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\ColorPicker.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\ColorPicker.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Core.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Core.wxs.bk"""" + call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\DscResources.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\DscResources.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\EnvironmentVariables.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\EnvironmentVariables.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\FileExplorerPreview.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\FileExplorerPreview.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\FileLocksmith.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\FileLocksmith.wxs.bk"""" diff --git a/installer/PowerToysSetupVNext/Core.wxs b/installer/PowerToysSetupVNext/Core.wxs index d3f992d82e..a9cf083512 100644 --- a/installer/PowerToysSetupVNext/Core.wxs +++ b/installer/PowerToysSetupVNext/Core.wxs @@ -9,6 +9,25 @@ + + + + + + + + + + + + + + + + + + + @@ -44,16 +63,6 @@ - - - - - - - - - - @@ -101,7 +110,6 @@ - @@ -113,7 +121,11 @@ - + + + + + diff --git a/installer/PowerToysSetupVNext/DscResources.wxs b/installer/PowerToysSetupVNext/DscResources.wxs new file mode 100644 index 0000000000..2c08253229 --- /dev/null +++ b/installer/PowerToysSetupVNext/DscResources.wxs @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installer/PowerToysSetupVNext/PowerToysInstallerVNext.wixproj b/installer/PowerToysSetupVNext/PowerToysInstallerVNext.wixproj index c99bae67a3..18d6232140 100644 --- a/installer/PowerToysSetupVNext/PowerToysInstallerVNext.wixproj +++ b/installer/PowerToysSetupVNext/PowerToysInstallerVNext.wixproj @@ -14,7 +14,6 @@ SET PTRoot=$(SolutionDir)\.. call "..\..\..\publish.cmd" x64 ) call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuildThisFileDirectory)\generateMonacoWxs.ps1 -monacoWxsFile "$(MSBuildThisFileDirectory)\MonacoSRC.wxs" -Platform "$(Platform)" -nugetHeatPath "$(NUGET_PACKAGES)\wixtoolset.heat\5.0.2" -call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuildThisFileDirectory)\generateDscResourcesWxs.ps1 -dscWxsFile "$(MSBuildThisFileDirectory)\DscResources.wxs" -Platform "$(Platform)" -Configuration "$(Configuration)" @@ -25,7 +24,6 @@ SET PTRoot=$(SolutionDir)\.. call "..\..\..\publish.cmd" arm64 ) call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuildThisFileDirectory)\generateMonacoWxs.ps1 -monacoWxsFile "$(MSBuildThisFileDirectory)\MonacoSRC.wxs" -Platform "$(Platform)" -nugetHeatPath "$(NUGET_PACKAGES)\wixtoolset.heat\5.0.2" -call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuildThisFileDirectory)\generateDscResourcesWxs.ps1 -dscWxsFile "$(MSBuildThisFileDirectory)\DscResources.wxs" -Platform "$(Platform)" -Configuration "$(Configuration)" @@ -37,6 +35,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil call move /Y ..\..\..\CmdPal.wxs.bk ..\..\..\CmdPal.wxs call move /Y ..\..\..\ColorPicker.wxs.bk ..\..\..\ColorPicker.wxs call move /Y ..\..\..\Core.wxs.bk ..\..\..\Core.wxs + call move /Y ..\..\..\DscResources.wxs.bk ..\..\..\DscResources.wxs call move /Y ..\..\..\EnvironmentVariables.wxs.bk ..\..\..\EnvironmentVariables.wxs call move /Y ..\..\..\FileExplorerPreview.wxs.bk ..\..\..\FileExplorerPreview.wxs call move /Y ..\..\..\FileLocksmith.wxs.bk ..\..\..\FileLocksmith.wxs diff --git a/installer/PowerToysSetupVNext/generateAllFileComponents.ps1 b/installer/PowerToysSetupVNext/generateAllFileComponents.ps1 index 84616af567..6724d95170 100644 --- a/installer/PowerToysSetupVNext/generateAllFileComponents.ps1 +++ b/installer/PowerToysSetupVNext/generateAllFileComponents.ps1 @@ -317,3 +317,7 @@ Generate-FileComponents -fileListName "SettingsV2IconsModelsFiles" -wxsFilePath #Workspaces Generate-FileList -fileDepsJson "" -fileListName WorkspacesImagesComponentFiles -wxsFilePath $PSScriptRoot\Workspaces.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\Assets\Workspaces\" Generate-FileComponents -fileListName "WorkspacesImagesComponentFiles" -wxsFilePath $PSScriptRoot\Workspaces.wxs + +#DSC Resources - JSON manifest files in DSCModules subfolder +Generate-FileList -fileDepsJson "" -fileListName DscJsonFiles -wxsFilePath $PSScriptRoot\DscResources.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\DSCModules\" +Generate-FileComponents -fileListName "DscJsonFiles" -wxsFilePath $PSScriptRoot\DscResources.wxs diff --git a/installer/PowerToysSetupVNext/generateDscResourcesWxs.ps1 b/installer/PowerToysSetupVNext/generateDscResourcesWxs.ps1 deleted file mode 100644 index 14172db0bc..0000000000 --- a/installer/PowerToysSetupVNext/generateDscResourcesWxs.ps1 +++ /dev/null @@ -1,102 +0,0 @@ -[CmdletBinding()] -Param( - [Parameter(Mandatory = $True)] - [string]$dscWxsFile, - [Parameter(Mandatory = $True)] - [string]$Platform, - [Parameter(Mandatory = $True)] - [string]$Configuration -) - -$ErrorActionPreference = 'Stop' - -$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path - -# Find build output directory -$buildOutputDir = Join-Path $scriptDir "..\..\$Platform\$Configuration" - -if (-not (Test-Path $buildOutputDir)) { - Write-Error "Build output directory not found: '$buildOutputDir'" - exit 1 -} - -# Find all DSC manifest JSON files -$dscFiles = Get-ChildItem -Path $buildOutputDir -Filter "microsoft.powertoys.*.settings.dsc.resource.json" -File - -if (-not $dscFiles) { - Write-Warning "No DSC manifest files found in '$buildOutputDir'" - # Create empty component group - $wxsContent = @" - - - - - - - - - -"@ - Set-Content -Path $dscWxsFile -Value $wxsContent - exit 0 -} - -Write-Host "Found $($dscFiles.Count) DSC manifest file(s)" - -# Generate WiX fragment -$wxsContent = @" - - - - - - -"@ - -$componentRefs = @() - -foreach ($file in $dscFiles) { - $componentId = "DscResource_" + ($file.BaseName -replace '[^A-Za-z0-9_]', '_') - $fileId = $componentId + "_File" - $guid = [System.Guid]::NewGuid().ToString().ToUpper() - - $componentRefs += $componentId - - $wxsContent += @" - - - - - - - -"@ -} - -$wxsContent += @" - - - - - - -"@ - -foreach ($componentId in $componentRefs) { - $wxsContent += @" - - -"@ -} - -$wxsContent += @" - - - - -"@ - -# Write the WiX file -Set-Content -Path $dscWxsFile -Value $wxsContent - -Write-Host "Generated DSC resources WiX fragment: '$dscWxsFile'" \ No newline at end of file diff --git a/src/dsc/v3/PowerToys.DSC/Models/DscManifest.cs b/src/dsc/v3/PowerToys.DSC/Models/DscManifest.cs index dcb6abf4a1..5eb91acec3 100644 --- a/src/dsc/v3/PowerToys.DSC/Models/DscManifest.cs +++ b/src/dsc/v3/PowerToys.DSC/Models/DscManifest.cs @@ -13,7 +13,7 @@ namespace PowerToys.DSC.Models; public sealed class DscManifest { private const string Schema = "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.vscode.json"; - private const string Executable = @"PowerToys.DSC.exe"; + private const string Executable = @"..\PowerToys.DSC.exe"; private readonly string _type; private readonly string _version; diff --git a/src/dsc/v3/PowerToys.DSC/PowerToys.DSC.csproj b/src/dsc/v3/PowerToys.DSC/PowerToys.DSC.csproj index c0b9cafd30..9dc11a0a8a 100644 --- a/src/dsc/v3/PowerToys.DSC/PowerToys.DSC.csproj +++ b/src/dsc/v3/PowerToys.DSC/PowerToys.DSC.csproj @@ -40,9 +40,11 @@ - - - - + + + + + + \ No newline at end of file diff --git a/tools/build/generate-dsc-manifests.ps1 b/tools/build/generate-dsc-manifests.ps1 index cb730ddd4a..78cc909174 100644 --- a/tools/build/generate-dsc-manifests.ps1 +++ b/tools/build/generate-dsc-manifests.ps1 @@ -93,21 +93,28 @@ if (-not (Test-Path $outputDir)) { New-Item -Path $outputDir -ItemType Directory -Force | Out-Null } -Write-Host "DSC manifests will be generated to: '$outputDir'" +# DSC v3 manifests go to DSCModules subfolder +$dscOutputDir = Join-Path $outputDir 'DSCModules' +if (-not (Test-Path $dscOutputDir)) { + Write-Host "Creating DSCModules subfolder at '$dscOutputDir'." + New-Item -Path $dscOutputDir -ItemType Directory -Force | Out-Null +} -Write-Host "Cleaning previously generated DSC manifest files from '$outputDir'." -Get-ChildItem -Path $outputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction SilentlyContinue | Remove-Item -Force +Write-Host "DSC manifests will be generated to: '$dscOutputDir'" -$arguments = @('manifest', '--resource', 'settings', '--outputDir', $outputDir) +Write-Host "Cleaning previously generated DSC manifest files from '$dscOutputDir'." +Get-ChildItem -Path $dscOutputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction SilentlyContinue | Remove-Item -Force + +$arguments = @('manifest', '--resource', 'settings', '--outputDir', $dscOutputDir) Write-Host "Invoking DSC manifest generator: '$exePath' $($arguments -join ' ')" & $exePath @arguments if ($LASTEXITCODE -ne 0) { throw "PowerToys.DSC.exe exited with code $LASTEXITCODE" } -$generatedFiles = Get-ChildItem -Path $outputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction Stop +$generatedFiles = Get-ChildItem -Path $dscOutputDir -Filter 'microsoft.powertoys.*.settings.dsc.resource.json' -ErrorAction Stop if ($generatedFiles.Count -eq 0) { - throw "No DSC manifest files were generated in '$outputDir'." + throw "No DSC manifest files were generated in '$dscOutputDir'." } Write-Host "Generated $($generatedFiles.Count) DSC manifest file(s):"