Skip to content

Commit

Permalink
Merge pull request #359 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 9103362 + 9a687e2 commit 24533c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion maven/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {
if _, found, err := pr.Resolve(PlanEntryJVMApplicationPackage); err != nil {
return libcnb.BuildResult{}, fmt.Errorf("unable to resolve JVM Application Package plan entry\n%w", err)
} else if found {
bomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.NewExecutor(), b.Logger)
bomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.CommandExecutor{}, b.Logger)

// build a layer contributor to run Maven
a, err := b.ApplicationFactory.NewApplication(
Expand Down
22 changes: 12 additions & 10 deletions maven/maven_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) {
var (
Expect = NewWithT(t).Expect

ctx libcnb.BuildContext
mavenManager maven.MavenManager
mvnwFilepath string
ctx libcnb.BuildContext
mavenManager maven.MavenManager
mvnwFilepath string
mvnwPropsPath string
)

Expand All @@ -36,10 +36,12 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) {
Expect(err).NotTo(HaveOccurred())

mvnwFilepath = filepath.Join(ctx.Application.Path, "mvnw")
mvnwPropsPath = filepath.Join(ctx.Application.Path, ".mvn/wrapper/")
mvnwPropsPath = filepath.Join(ctx.Application.Path, ".mvn/wrapper/")

err = os.MkdirAll(mvnwPropsPath, 0755)
Expect(err).NotTo(HaveOccurred())

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

it.After(func() {
Expand Down Expand Up @@ -273,13 +275,13 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) {
it("converts CRLF formatting in the maven-wrapper.properties file to LF (unix) if present", func() {
propsFile := filepath.Join(mvnwPropsPath, "maven-wrapper.properties")
Expect(os.WriteFile(propsFile, []byte("test\r\n"), 0755)).To(Succeed())

_, _, _, err := mavenManager.Install()
Expect(err).NotTo(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

contents, err := os.ReadFile(propsFile)
Expect(err).NotTo(HaveOccurred())
Expect(bytes.Compare(contents, []byte("test\n"))).To(Equal(0))
contents, err := os.ReadFile(propsFile)
Expect(err).NotTo(HaveOccurred())
Expect(bytes.Compare(contents, []byte("test\n"))).To(Equal(0))
})

})
Expand Down

0 comments on commit 24533c6

Please sign in to comment.