AL/Get-Symbols.ps1
function Get-Symbols { Param( [Parameter(Mandatory=$false)] [string]$SourcePath = (Get-Location), [Parameter(Mandatory=$false)] [string]$ContainerName = (Get-ContainerFromLaunchJson), # optionally download the test symbols [Parameter(Mandatory=$false)] [switch] $includeTestSymbols ) $PackagesPath = Join-Path $SourcePath '.alpackages' if (!(Test-Path $PackagesPath)) { New-EmptyDirectory $PackagesPath } $SymbolsDownloaded = $false # since BC15, system layer is defined in dependencies $Dependencies = Get-AppKeyValue -SourcePath $SourcePath -KeyName 'dependencies' foreach ($Dependency in $Dependencies) { if ($Dependency.publisher -eq 'Microsoft') { $Uri = 'http://{0}:7049/bc/dev/packages?publisher={1}&appName={2}&versionText={3}' -f $ContainerName, $Dependency.publisher, $Dependency.name, $Dependency.version Write-Host $Uri Invoke-WebRequest -Uri $Uri -Headers (New-Headers) -OutFile (Join-Path $PackagesPath ('{0}_{1}_{2}.app' -f $Dependency.publisher, $Dependency.name, $Dependency.version)) $SymbolsDownloaded = $true } } if ($SymbolsDownloaded) { $Uri = 'http://{0}:7049/bc/dev/packages?publisher=Microsoft&appName=System&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform') Write-Host $Uri Invoke-WebRequest -Uri $Uri -Headers (New-Headers) -OutFile (Join-Path $PackagesPath ('Microsoft_System_{0}.app' -f (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform'))) } # prior to BC15, system layer defined through properties in app.json else { $Uri = 'http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=Application&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'application') Write-Host $Uri Invoke-WebRequest -Uri $Uri -Headers (New-Headers) -OutFile (Join-Path $PackagesPath ('Microsoft_Application_{0}.app' -f (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'application'))) $Uri = 'http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=System&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform') Write-Host $Uri Invoke-WebRequest -Uri $Uri -Headers (New-Headers) -OutFile (Join-Path $PackagesPath ('Microsoft_System_{0}.app' -f (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform'))) if ($includeTestSymbols.IsPresent) { $Uri = 'http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=Test&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'test') Write-Host $Uri Invoke-WebRequest -Uri $Uri -Headers (New-Headers) -OutFile (Join-Path $PackagesPath ('Microsoft_Test_{0}.app' -f (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'test'))) } } } function New-Headers { $ba = '{0}:{1}' -f (Get-EnvironmentKeyValue -KeyName 'user'), (Get-EnvironmentKeyValue -KeyName 'password') $ba = [System.Text.Encoding]::UTF8.GetBytes($ba) $ba = [System.Convert]::ToBase64String($ba) $h = @{Authorization=("Basic {0}" -f $ba);'Accept-Encoding'='gzip,deflate'} $h } Export-ModuleMember -Function Get-Symbols |