Skip to content

Commit

Permalink
Merge pull request #246 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 1e40f53 + 6df975c commit ba05c3f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions clojure/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {
result.Layers = append(result.Layers, c)

ednFileExists := fileExists(filepath.Join(context.Application.Path, "deps.edn"))
toolsBuildEnabled, err := libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ENABLED", cr)
toolsBuildEnabled, _ := libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ENABLED", cr)
var args []string
if ednFileExists && strings.ToLower(toolsBuildEnabled[0]) == "true" {
args, err = libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ARGUMENTS", cr)
Expand All @@ -114,7 +114,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
9 changes: 5 additions & 4 deletions clojure/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package clojure_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())
clojureBuild = clojure.Build{ApplicationFactory: &FakeApplicationFactory{}}

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

it.After(func() {
Expand All @@ -57,7 +58,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, "clojure"), []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "clojure"), []byte{}, 0644)).To(Succeed())
ctx.StackID = "test-stack-id"

result, err := clojureBuild.Build(ctx)
Expand Down
5 changes: 2 additions & 3 deletions clojure/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package clojure_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("", "clojure")
ctx.Application.Path, err = os.MkdirTemp("", "clojure")
Expect(err).NotTo(HaveOccurred())
})

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

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

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

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -42,7 +41,7 @@ func testDistribution(t *testing.T, context spec.G, it spec.S) {

Expect(err).NotTo(HaveOccurred())

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 ba05c3f

Please sign in to comment.