Skip to content

Commit

Permalink
XRAY-43991 - Export CreateAlternativeVersionForms function, which is …
Browse files Browse the repository at this point in the history
…needed for Curation Audit support for NuGet (#270)
  • Loading branch information
igorz-jf authored Sep 4, 2024
1 parent af97559 commit 42ec6f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions build/utils/dotnet/dependencies/packagesconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import (
"encoding/binary"
"encoding/xml"
"fmt"
"github.com/jfrog/build-info-go/build/utils/dotnet"
buildinfo "github.com/jfrog/build-info-go/entities"
"github.com/jfrog/build-info-go/utils"
"github.com/jfrog/gofrog/crypto"
gofrogcmd "github.com/jfrog/gofrog/io"
"os"
"path/filepath"
"strings"
"unicode/utf16"

"github.com/jfrog/gofrog/crypto"
gofrogcmd "github.com/jfrog/gofrog/io"

"github.com/jfrog/build-info-go/build/utils/dotnet"
buildinfo "github.com/jfrog/build-info-go/entities"
"github.com/jfrog/build-info-go/utils"
)

const (
Expand Down Expand Up @@ -79,7 +81,7 @@ func (extractor *packagesExtractor) extract(packagesConfig *packagesConfig, glob
}
if pack == nil {
// If it doesn't exist lets build the array of alternative versions.
alternativeVersions := createAlternativeVersionForms(nuget.Version)
alternativeVersions := CreateAlternativeVersionForms(nuget.Version)
// Now let's do a loop to run over the alternative possibilities
for i := 0; i < len(alternativeVersions); i++ {
nPackage.version = alternativeVersions[i]
Expand Down Expand Up @@ -110,7 +112,7 @@ func (extractor *packagesExtractor) extract(packagesConfig *packagesConfig, glob
// "1.22.33" --> []string{"1.22.33.0"}
// "1.22.33.44" --> []string{}
// "1.0.2" --> []string{"1.0.2.0"}
func createAlternativeVersionForms(originalVersion string) []string {
func CreateAlternativeVersionForms(originalVersion string) []string {
versionSlice := strings.Split(originalVersion, ".")
versionSliceSize := len(versionSlice)
for i := 4; i > versionSliceSize; i-- {
Expand Down
2 changes: 1 addition & 1 deletion build/utils/dotnet/dependencies/packagesconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestAlternativeVersionsForms(t *testing.T) {
}
for _, test := range tests {
t.Run(test.version, func(t *testing.T) {
actual := createAlternativeVersionForms(test.version)
actual := CreateAlternativeVersionForms(test.version)
sort.Strings(actual)
sort.Strings(test.expected)
if len(actual) != len(test.expected) {
Expand Down

0 comments on commit 42ec6f1

Please sign in to comment.