support for default,latest or preview as vsixFile

This commit is contained in:
freddydk 2023-07-27 10:03:59 +02:00
Родитель a064a7d3dd
Коммит 56bc2331ab
6 изменённых файлов: 53 добавлений и 18 удалений

Просмотреть файл

@ -702,6 +702,8 @@ if ($bcptTestSuites) { $bcptTestSuites | ForEach-Object { Write-Host "- $_" } }
Write-Host -ForegroundColor Yellow "Custom CodeCops"
if ($customCodeCops) { $customCodeCops | ForEach-Object { Write-Host "- $_" } } else { Write-Host "- None" }
$vsixFile = DetermineVsixFile -vsixFile $vsixFile
$compilerFolder = ''
if ($useCompilerFolder) {

Просмотреть файл

@ -329,6 +329,8 @@ else {
$RemoveBcContainer = { Param([Hashtable]$parameters) Remove-BcContainer @parameters }
}
$vsixFile = DetermineVsixFile -vsixFile $vsixFile
$currentArtifactUrl = ""
if ("$validateVersion" -eq "" -and !$validateCurrent -and !$validateNextMinor -and !$validateNextMajor) {

Просмотреть файл

@ -51,6 +51,8 @@ try {
$version = [System.Version]($parts[4])
$country = $parts[5]
$vsixFile = DetermineVsixFile -vsixFile $vsixFile
if ($version -lt "16.0.0.0") {
throw "Containerless compiling is not supported with versions before 16.0"
}

Просмотреть файл

@ -17,24 +17,7 @@ function Get-LatestAlLanguageExtensionUrl {
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
try {
$listing = Invoke-WebRequest -Method POST -UseBasicParsing `
-Uri https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery?api-version=3.0-preview.1 `
-Body '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":12,"value":"4096"},{"filterType":7,"value":"ms-dynamics-smb.al"}],"pageNumber":1,"pageSize":50,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":0x192}' `
-ContentType application/json | ConvertFrom-Json
$vsixUrl = $listing.results | Select-Object -First 1 -ExpandProperty extensions `
| Select-Object -ExpandProperty versions `
| Where-Object { ($allowPrerelease.IsPresent -or !(($_.properties.Key -eq 'Microsoft.VisualStudio.Code.PreRelease') -and ($_.properties | where-object { $_.Key -eq 'Microsoft.VisualStudio.Code.PreRelease' }).value -eq "true")) } `
| Select-Object -First 1 -ExpandProperty files `
| Where-Object { $_.assetType -eq "Microsoft.VisualStudio.Services.VSIXPackage"} `
| Select-Object -ExpandProperty source
if ($vsixUrl) {
$vsixUrl
}
else {
throw "Unable to locate latest AL Language Extension from the VS Code Marketplace"
}
GetLatestAlLanguageExtensionUrl -allowPrerelease:$allowPrerelease
}
catch {
TrackException -telemetryScope $telemetryScope -errorRecord $_

Просмотреть файл

@ -1452,6 +1452,8 @@ try {
$parameters += "--env bakfile=$bakFile"
}
$vsixFile = DetermineVsixFile -vsixFile $vsixFile
if ($vsixFile) {
$vsixUrl = $vsixFile
if ($vsixUrl.StartsWith("https://", "OrdinalIgnoreCase") -or $vsixUrl.StartsWith("http://", "OrdinalIgnoreCase")) {

Просмотреть файл

@ -1170,3 +1170,47 @@ function GetAppInfo {
$job | Wait-Job | Receive-Job
$job | Remove-Job
}
function GetLatestAlLanguageExtensionUrl {
Param(
[switch] $allowPrerelease
)
$listing = Invoke-WebRequest -Method POST -UseBasicParsing `
-Uri https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery?api-version=3.0-preview.1 `
-Body '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":12,"value":"4096"},{"filterType":7,"value":"ms-dynamics-smb.al"}],"pageNumber":1,"pageSize":50,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":0x192}' `
-ContentType application/json | ConvertFrom-Json
$vsixUrl = $listing.results | Select-Object -First 1 -ExpandProperty extensions `
| Select-Object -ExpandProperty versions `
| Where-Object { ($allowPrerelease.IsPresent -or !(($_.properties.Key -eq 'Microsoft.VisualStudio.Code.PreRelease') -and ($_.properties | where-object { $_.Key -eq 'Microsoft.VisualStudio.Code.PreRelease' }).value -eq "true")) } `
| Select-Object -First 1 -ExpandProperty files `
| Where-Object { $_.assetType -eq "Microsoft.VisualStudio.Services.VSIXPackage"} `
| Select-Object -ExpandProperty source
if ($vsixUrl) {
$vsixUrl
}
else {
throw "Unable to locate latest AL Language Extension from the VS Code Marketplace"
}
}
function DetermineVsixFile {
Param(
[string] $vsixFile
)
if ($vsixFile -eq 'default') {
return ''
}
elseif ($vsixFile -eq 'latest') {
return (GetLatestAlLanguageExtensionUrl)
}
elseif ($vsixFile -eq 'preview') {
return (GetLatestAlLanguageExtensionUrl -allowPrerelease)
}
else {
return $vsixFile
}
}