Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Allow Empty List of Dependencies / No Build Files #163

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions pkg/build/jvm/gradle_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package jvm

import (
"github.com/nais/salsa/pkg/build"
"github.com/nais/salsa/pkg/build/test"
"os"
"testing"

"github.com/nais/salsa/pkg/build"
"github.com/nais/salsa/pkg/build/test"

"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -74,13 +75,6 @@ func TestBuildGradle(t *testing.T) {
Error: true,
ErrorMessage: "could not find match, reading dir open testdata/whatever: no such file or directory",
},
{
Name: "cant find supported build type",
BuildType: BuildMaven(""),
WorkDir: "testdata/jvm/gradle-kts",
Error: true,
ErrorMessage: "no supported build files found: testdata/jvm/gradle-kts",
},
{
Name: "support build.gradle file",
BuildType: BuildGradle(),
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Thu Mar 02 13:32:47 CET 2023
gradle.version=8.0.1
562 changes: 562 additions & 0 deletions pkg/build/jvm/testdata/jvm/gradle-kts/gradle/verification-metadata.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Fri Oct 14 10:00:23 CEST 2022
gradle.version=7.5.1
#Thu Mar 02 13:32:48 CET 2023
gradle.version=8.0.1
367 changes: 367 additions & 0 deletions pkg/build/jvm/testdata/jvm/gradle/gradle/verification-metadata.xml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions pkg/build/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package build

import (
"fmt"
log "github.com/sirupsen/logrus"
"os"

log "github.com/sirupsen/logrus"
)

const (
Expand Down Expand Up @@ -38,7 +39,8 @@ func (t Tools) DetectDeps(workDir string) (*ArtifactDependencies, error) {
return deps, nil
}
}
return nil, fmt.Errorf(fmt.Sprintf("no supported build files found: %s", workDir))

return nil, nil
}

func match(t Tool, workDir string) (bool, string, error) {
Expand Down
10 changes: 8 additions & 2 deletions pkg/commands/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"errors"
"fmt"
"os"

"github.com/nais/salsa/pkg/build"
"github.com/nais/salsa/pkg/build/golang"
"github.com/nais/salsa/pkg/build/jvm"
Expand All @@ -15,7 +17,6 @@ import (
"github.com/nais/salsa/pkg/vcs"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"os"
)

var (
Expand Down Expand Up @@ -55,7 +56,12 @@ var scanCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("detecting dependecies: %v", err)
}
deps = generatedDeps

if generatedDeps != nil {
deps = generatedDeps
} else {
log.Infof("no supported build files found for directory: %s, proceeding", workDir)
}
}

contextEnvironment, err := vcs.ResolveBuildContext(&buildContext, &runnerContext, &envContext)
Expand Down