Skip to content

Commit

Permalink
Merge pull request #313 from paketo-buildpacks/fix-chars
Browse files Browse the repository at this point in the history
Do not use effect.NewExecutor use CommandExecutor instead
  • Loading branch information
anthonydahanne authored Oct 4, 2024
2 parents 9996c44 + 89b76e6 commit c1c0572
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion sbt/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {
InterestingFileDetector: libbs.AlwaysInterestingFileDetector{},
}

sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.NewExecutor(), b.Logger)
sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.CommandExecutor{}, b.Logger)

a, err := b.ApplicationFactory.NewApplication(
map[string]interface{}{},
Expand Down
13 changes: 7 additions & 6 deletions sbt/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package sbt_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -43,12 +42,14 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
it.Before(func() {
var err error

ctx.Application.Path, err = ioutil.TempDir("", "build-application")
ctx.Application.Path, err = os.MkdirTemp("", "build-application")
Expect(err).NotTo(HaveOccurred())

ctx.Layers.Path, err = ioutil.TempDir("", "build-layers")
ctx.Layers.Path, err = os.MkdirTemp("", "build-layers")
Expect(err).NotTo(HaveOccurred())
sbtBuild = sbt.Build{ApplicationFactory: &FakeApplicationFactory{}}

t.Setenv("BP_ARCH", "amd64")
})

it.After(func() {
Expand All @@ -66,7 +67,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
})

it("sets the settings path", func() {
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
ctx.StackID = "test-stack-id"

result, err := sbtBuild.Build(ctx)
Expand All @@ -85,7 +86,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
})

it("sets the settings path", func() {
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
ctx.StackID = "test-stack-id"

result, err := sbtBuild.Build(ctx)
Expand All @@ -99,7 +100,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
})

it("does not contribute distribution if wrapper exists", func() {
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "sbt"), []byte{}, 0644)).To(Succeed())
ctx.StackID = "test-stack-id"

result, err := sbtBuild.Build(ctx)
Expand Down
5 changes: 2 additions & 3 deletions sbt/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package sbt_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -40,7 +39,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
it.Before(func() {
var err error

ctx.Application.Path, err = ioutil.TempDir("", "sbt")
ctx.Application.Path, err = os.MkdirTemp("", "sbt")
Expect(err).NotTo(HaveOccurred())
})

Expand All @@ -53,7 +52,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
})

it("passes with build.sbt", func() {
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "build.sbt"), []byte{}, 0644))
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "build.sbt"), []byte{}, 0644))

Expect(detect.Detect(ctx)).To(Equal(libcnb.DetectResult{
Pass: true,
Expand Down
3 changes: 1 addition & 2 deletions sbt/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package sbt_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -40,7 +39,7 @@ func testDistribution(t *testing.T, context spec.G, it spec.S) {
it.Before(func() {
var err error

ctx.Layers.Path, err = ioutil.TempDir("", "distribution-layers")
ctx.Layers.Path, err = os.MkdirTemp("", "distribution-layers")
Expect(err).NotTo(HaveOccurred())
})

Expand Down

0 comments on commit c1c0572

Please sign in to comment.