mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
update
This commit is contained in:
@@ -117,20 +117,21 @@ $packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
|
||||
|
||||
if ($WinAppSDKVersion -match "^1\.8") {
|
||||
Write-Host "Version $WinAppSDKVersion detected. Resolving split dependencies..."
|
||||
$tempDir = Join-Path $env:TEMP "winappsdk_deps_$(Get-Random)"
|
||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
||||
try {
|
||||
# Create a temporary nuget.config to avoid interference from the repo's config
|
||||
$tempConfig = Join-Path $tempDir "nuget.config"
|
||||
Set-Content -Path $tempConfig -Value "<?xml version='1.0' encoding='utf-8'?><configuration><packageSources><clear /><add key='TempSource' value='$sourceLink' /></packageSources></configuration>"
|
||||
$installDir = Join-Path $rootPath "localpackages\output"
|
||||
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
|
||||
|
||||
# Create a temporary nuget.config to avoid interference from the repo's config
|
||||
$tempConfig = Join-Path $env:TEMP "nuget_$(Get-Random).config"
|
||||
Set-Content -Path $tempConfig -Value "<?xml version='1.0' encoding='utf-8'?><configuration><packageSources><clear /><add key='TempSource' value='$sourceLink' /></packageSources></configuration>"
|
||||
|
||||
# Download package to inspect nuspec
|
||||
$nugetArgs = "install Microsoft.WindowsAppSDK -Version $WinAppSDKVersion -ConfigFile $tempConfig -OutputDirectory $tempDir -NonInteractive -NoCache"
|
||||
try {
|
||||
# Download package to inspect nuspec and keep it for the build
|
||||
$nugetArgs = "install Microsoft.WindowsAppSDK -Version $WinAppSDKVersion -ConfigFile $tempConfig -OutputDirectory $installDir -NonInteractive -NoCache"
|
||||
Invoke-Expression "nuget $nugetArgs" | Out-Null
|
||||
|
||||
# Parse dependencies from the installed folders
|
||||
# Folder structure is typically {PackageId}.{Version}
|
||||
$directories = Get-ChildItem -Path $tempDir -Directory
|
||||
$directories = Get-ChildItem -Path $installDir -Directory
|
||||
foreach ($dir in $directories) {
|
||||
if ($dir.Name -match "^(Microsoft\.WindowsAppSDK.*?)\.(\d.*)$") {
|
||||
$pkgId = $Matches[1]
|
||||
@@ -142,7 +143,7 @@ if ($WinAppSDKVersion -match "^1\.8") {
|
||||
} catch {
|
||||
Write-Warning "Failed to resolve dependencies: $_"
|
||||
} finally {
|
||||
Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item $tempConfig -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,39 @@ parameters:
|
||||
default: false
|
||||
|
||||
steps:
|
||||
- task: PowerShell@2
|
||||
displayName: 'Configure NuGet'
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
$nugetConfigPath = "$(Build.SourcesDirectory)\nuget.config"
|
||||
$localPackagesPath = "$(Build.SourcesDirectory)\localpackages\output"
|
||||
|
||||
# Ensure the directory exists so it's a valid source
|
||||
New-Item -ItemType Directory -Path $localPackagesPath -Force | Out-Null
|
||||
|
||||
Write-Host "Modifying $nugetConfigPath..."
|
||||
[xml]$xml = Get-Content -Path $nugetConfigPath
|
||||
|
||||
# Add localpackages source
|
||||
$packageSourcesNode = $xml.configuration.packageSources
|
||||
if (-not $packageSourcesNode.SelectSingleNode("add[@key='localpackages']")) {
|
||||
$addNode = $xml.CreateElement("add")
|
||||
$addNode.SetAttribute("key", "localpackages")
|
||||
$addNode.SetAttribute("value", $localPackagesPath)
|
||||
$packageSourcesNode.AppendChild($addNode) | Out-Null
|
||||
}
|
||||
|
||||
# Remove packageSourceMapping to ensure we can restore from both sources without restriction
|
||||
$packageSourceMappingNode = $xml.configuration.packageSourceMapping
|
||||
if ($packageSourceMappingNode) {
|
||||
$xml.configuration.RemoveChild($packageSourceMappingNode) | Out-Null
|
||||
Write-Host "Removed packageSourceMapping."
|
||||
}
|
||||
|
||||
$xml.Save($nugetConfigPath)
|
||||
Get-Content $nugetConfigPath
|
||||
|
||||
- task: NuGetAuthenticate@1
|
||||
displayName: 'NuGet Authenticate'
|
||||
|
||||
@@ -22,31 +55,6 @@ steps:
|
||||
- script: echo $(WinAppSDKVersion)
|
||||
displayName: 'Display WinAppSDK Version Found'
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: 'Download WindowsAppSDK'
|
||||
inputs:
|
||||
buildType: 'specific'
|
||||
project: '55e8140e-57ac-4e5f-8f9c-c7c15b51929d'
|
||||
definition: '104083'
|
||||
buildVersionToDownload: 'latestFromBranch'
|
||||
branchName: 'refs/heads/release/${{ parameters.versionNumber }}-stable'
|
||||
artifactName: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
targetPath: '$(Build.SourcesDirectory)\localpackages'
|
||||
|
||||
- script: dir $(Build.SourcesDirectory)\localpackages\NugetPackages
|
||||
displayName: 'List downloaded packages'
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: 'Install WindowsAppSDK'
|
||||
inputs:
|
||||
command: 'custom'
|
||||
arguments: >
|
||||
install "Microsoft.WindowsAppSDK"
|
||||
-Source "$(Build.SourcesDirectory)\localpackages\NugetPackages"
|
||||
-Version "$(WinAppSDKVersion)"
|
||||
-OutputDirectory "$(Build.SourcesDirectory)\localpackages\output"
|
||||
-FallbackSource "https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json"
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: 'Restore NuGet packages'
|
||||
inputs:
|
||||
|
||||
Reference in New Issue
Block a user