Skip to content

Commit

Permalink
Nuget fixes (#3630)
Browse files Browse the repository at this point in the history
Clear application dependency if template is specified and app.json
doesn't have an application dependency
Normalize version strings in NuGetClass

---------

Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk committed Sep 5, 2024
1 parent d58e29a commit fefa87f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NuGet/New-BcNuGetPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ Function New-BcNuGetPackage {
$applicationDependency = GetDependencyVersionStr -template $applicationDependency -version ([System.Version]::Parse($appJson.Application))
}
}
elseif ($applicationDependency.Contains('{')) {
$applicationDependency = ''
}
if ($appJson.PSObject.Properties.Name -eq 'Platform' -and $appJson.Platform) {
if (-not $platformDependency) {
$platformDependency = $appJson.Platform
Expand All @@ -179,6 +182,9 @@ Function New-BcNuGetPackage {
$platformDependency = GetDependencyVersionStr -template $platformDependency -version ([System.Version]::Parse($appJson.Platform))
}
}
elseif ($platformDependency.Contains('{')) {
$platformDependency = ''
}

if ($prereleaseTag) {
$packageVersionStr = "$($packageVersion)-$prereleaseTag"
Expand Down
7 changes: 5 additions & 2 deletions NuGet/NuGetFeedClass.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class NuGetFeed {
}

static [Int32] CompareVersions([string] $version1, [string] $version2) {
$version1 = [NuGetFeed]::NormalizeVersionStr($version1)
$version2 = [NuGetFeed]::NormalizeVersionStr($version2)
$ver1 = $version1 -replace '-.+$' -as [System.Version]
$ver2 = $version2 -replace '-.+$' -as [System.Version]
if ($ver1 -eq $ver2) {
Expand All @@ -199,6 +201,7 @@ class NuGetFeed {
# Test if version is included in NuGet version range
# https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges
static [bool] IsVersionIncludedInRange([string] $versionStr, [string] $nuGetVersionRange) {
$versionStr = [NuGetFeed]::NormalizeVersionStr($versionStr)
$version = $versionStr -replace '-.+$' -as [System.Version]
if ($nuGetVersionRange -match '^\s*([\[(]?)([\d\.]*)(,?)([\d\.]*)([\])]?)\s*$') {
$inclFrom = $matches[1] -ne '('
Expand All @@ -208,7 +211,7 @@ class NuGetFeed {
$range = $true
}
if ($matches[2]) {
$fromver = [System.Version]$matches[2]
$fromver = [System.Version]([NuGetFeed]::NormalizeVersionStr($matches[2]))
}
else {
$fromver = [System.Version]::new(0,0,0,0)
Expand All @@ -218,7 +221,7 @@ class NuGetFeed {
}
}
if ($matches[4]) {
$tover = [System.Version]$matches[4]
$tover = [System.Version]([NuGetFeed]::NormalizeVersionStr($matches[4]))
}
elseif ($range) {
$tover = [System.Version]::new([int32]::MaxValue,[int32]::MaxValue,[int32]::MaxValue,[int32]::MaxValue)
Expand Down
2 changes: 2 additions & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Issue 3613 aka.ms/getbc fallback to NAVUserPassword because token expired when s
Issue #3617 Regression File Newtonsoft.Json.dll not found when copying item for New-BcCompilerFolder
Remove functions for supporting Alpaca and Cloud Containers - integration between alpaca and cloud containers with AL-Go for GitHub will NOT be done through BcContainerHelper
Issue #2623 New-BcContainer for BC25.1 or BC26 insider with includeTestToolkit AI Test Toolkit dependency missing
If template for applicationDependency or platformDependency is specified when creating a new BcNuGetPackage, it will create an invalid package if application or platform properties are missing in app.json
Normalize version strings in nuGetFeed to ensure that NuGet packages with version 1.2.3 are seen as being equal to version 1.2.3.0
Add Schedule parameter to Publish-PerTenantExtensionApps

6.0.20
Expand Down

0 comments on commit fefa87f

Please sign in to comment.