From a7b3278cfff71ac1c9836c3ece77d9d3c69e1f32 Mon Sep 17 00:00:00 2001 From: Emily Casey Date: Mon, 11 Jan 2021 09:50:29 -0500 Subject: [PATCH] Require users to provide spring-native dependency The buildpack will no longer contribute spring-graalvm-native dependency if missing. Users must explicitly include this as an application dependency. Now accept either the older spring-graalvm-native dependency or the renamed spring-native dependency. Signed-off-by: Emily Casey --- .github/pipeline-descriptor.yml | 8 - .../update-spring-graalvm-native.yml | 95 -------- README.md | 3 + buildpack.toml | 12 -- native/build.go | 18 +- native/native_image.go | 33 +-- native/native_image_test.go | 204 +++++++++--------- 7 files changed, 117 insertions(+), 256 deletions(-) delete mode 100644 .github/workflows/update-spring-graalvm-native.yml diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index e07843b..ecdace2 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -15,11 +15,3 @@ docker_credentials: - registry: gcr.io username: _json_key password: ${{ secrets.JAVA_GCLOUD_SERVICE_ACCOUNT_KEY }} - -dependencies: -- id: spring-graalvm-native - uses: docker://ghcr.io/paketo-buildpacks/actions/maven-dependency:main - with: - uri: https://repo.spring.io/milestone - group_id: org.springframework.experimental - artifact_id: spring-graalvm-native diff --git a/.github/workflows/update-spring-graalvm-native.yml b/.github/workflows/update-spring-graalvm-native.yml deleted file mode 100644 index 221211e..0000000 --- a/.github/workflows/update-spring-graalvm-native.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Update spring-graalvm-native -"on": - schedule: - - cron: 0 5 * * 1-5 - workflow_dispatch: {} -jobs: - update: - name: Update Buildpack Dependency - runs-on: - - ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: "1.15" - - name: Install update-buildpack-dependency - run: | - #!/usr/bin/env bash - - set -euo pipefail - - GO111MODULE=on go get -u -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency - - name: Install yj - run: | - #!/usr/bin/env bash - - set -euo pipefail - - echo "Installing yj ${YJ_VERSION}" - - mkdir -p "${HOME}"/bin - echo "${HOME}/bin" >> "${GITHUB_PATH}" - - curl \ - --location \ - --show-error \ - --silent \ - --output "${HOME}"/bin/yj \ - "https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux" - - chmod +x "${HOME}"/bin/yj - env: - YJ_VERSION: 5.0.0 - - uses: actions/checkout@v2 - - id: dependency - uses: docker://ghcr.io/paketo-buildpacks/actions/maven-dependency:main - with: - artifact_id: spring-graalvm-native - group_id: org.springframework.experimental - uri: https://repo.spring.io/milestone - - id: buildpack - name: Update Buildpack Dependency - run: | - #!/usr/bin/env bash - - set -euo pipefail - - OLD_VERSION=$(yj -tj < buildpack.toml | jq -r " - .metadata.dependencies[] | - select( .id == env.ID ) | - select( .version | test( env.VERSION_PATTERN ) ) | - .version") - - update-buildpack-dependency \ - --buildpack-toml buildpack.toml \ - --id "${ID}" \ - --version-pattern "${VERSION_PATTERN}" \ - --version "${VERSION}" \ - --uri "${URI}" \ - --sha256 "${SHA256}" - - git add buildpack.toml - git checkout -- . - - echo "::set-output name=old-version::${OLD_VERSION}" - echo "::set-output name=new-version::${VERSION}" - env: - ID: spring-graalvm-native - SHA256: ${{ steps.dependency.outputs.sha256 }} - URI: ${{ steps.dependency.outputs.uri }} - VERSION: ${{ steps.dependency.outputs.version }} - VERSION_PATTERN: '[\d]+\.[\d]+\.[\d]+' - - uses: peter-evans/create-pull-request@v3 - with: - author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> - body: Bumps `spring-graalvm-native` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. - branch: update/buildpack/spring-graalvm-native - commit-message: |- - Bump spring-graalvm-native from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} - - Bumps spring-graalvm-native from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. - delete-branch: true - labels: semver:minor, type:dependency-upgrade - signoff: true - title: Bump spring-graalvm-native from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} - token: ${{ secrets.JAVA_GITHUB_TOKEN }} diff --git a/README.md b/README.md index db9fee8..33a7ebc 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ The buildpack will do the following: * Creates a GraalVM native image and removes existing bytecode. +This buildpack requires that [Spring Native](https://github.com/spring-projects-experimental/spring-native) is included as an application dependency. + ## Configuration | Environment Variable | Description | -------------------- | ----------- @@ -28,3 +30,4 @@ The buildpack optionally accepts the following bindings: This buildpack is released under version 2.0 of the [Apache License][a]. [a]: http://www.apache.org/licenses/LICENSE-2.0 +[s]: https://github.com/spring-projects-experimental/spring-native diff --git a/buildpack.toml b/buildpack.toml index b16a9b0..70cfa9f 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -39,18 +39,6 @@ name = "BP_BOOT_NATIVE_IMAGE_BUILD_ARGUMENTS" description = "the arguments to pass to the native-image command" build = true -[[metadata.dependencies]] -id = "spring-graalvm-native" -name = "Spring GraalVM Native Feature" -version = "0.8.5" -uri = "https://repo.spring.io/milestone/org/springframework/experimental/spring-graalvm-native/0.8.5/spring-graalvm-native-0.8.5.jar" -sha256 = "70a3a8d264506d1e0d6fe2e05649dbd729d96d7f88fb0fa922de7b824de20e13" -stacks = [ "io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "org.cloudfoundry.stacks.cflinuxfs3" ] - -[[metadata.dependencies.licenses]] -type = "Apache-2.0" -uri = "https://github.com/spring-projects-experimental/spring-graal-native/blob/master/LICENSE.txt" - [metadata] pre-package = "scripts/build.sh" include-files = [ diff --git a/native/build.go b/native/build.go index 739c078..4a84b0e 100644 --- a/native/build.go +++ b/native/build.go @@ -49,25 +49,9 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) { return libcnb.BuildResult{}, fmt.Errorf("unable to create configuration resolver\n%w", err) } - dr, err := libpak.NewDependencyResolver(context) - if err != nil { - return libcnb.BuildResult{}, fmt.Errorf("unable to create dependency resolver\n%w", err) - } - - dc, err := libpak.NewDependencyCache(context) - if err != nil { - return libcnb.BuildResult{}, fmt.Errorf("unable to create dependency cache\n%w", err) - } - dc.Logger = b.Logger - args, _ := cr.Resolve("BP_BOOT_NATIVE_IMAGE_BUILD_ARGUMENTS") - dep, err := dr.Resolve("spring-graalvm-native", "") - if err != nil { - return libcnb.BuildResult{}, fmt.Errorf("unable to find dependency\n%w", err) - } - - n, err := NewNativeImage(context.Application.Path, args, dep, dc, manifest, context.StackID, result.Plan) + n, err := NewNativeImage(context.Application.Path, args, manifest, context.StackID) if err != nil { return libcnb.BuildResult{}, fmt.Errorf("unable to create native image layer\n%w", err) } diff --git a/native/native_image.go b/native/native_image.go index 35fb27b..494d7ab 100644 --- a/native/native_image.go +++ b/native/native_image.go @@ -17,6 +17,7 @@ package native import ( + "errors" "fmt" "io" "io/ioutil" @@ -26,7 +27,6 @@ import ( "strings" "github.com/buildpacks/libcnb" - "github.com/heroku/color" "github.com/magiconair/properties" "github.com/mattn/go-shellwords" "github.com/paketo-buildpacks/libpak" @@ -39,8 +39,6 @@ import ( type NativeImage struct { ApplicationPath string Arguments []string - Dependency libpak.BuildpackDependency - DependencyCache libpak.DependencyCache Executor effect.Executor LayerContributor libpak.LayerContributor Logger bard.Logger @@ -48,13 +46,10 @@ type NativeImage struct { StackID string } -func NewNativeImage(applicationPath string, arguments string, dependency libpak.BuildpackDependency, - cache libpak.DependencyCache, manifest *properties.Properties, stackID string, - plan *libcnb.BuildpackPlan) (NativeImage, error) { - +func NewNativeImage(applicationPath string, arguments string, manifest *properties.Properties, stackID string) (NativeImage, error) { var err error - expected := map[string]interface{}{"dependency": dependency} + expected := map[string]interface{}{} expected["arguments"], err = shellwords.Parse(arguments) if err != nil { @@ -69,18 +64,12 @@ func NewNativeImage(applicationPath string, arguments string, dependency libpak. n := NativeImage{ ApplicationPath: applicationPath, Arguments: expected["arguments"].([]string), - Dependency: dependency, - DependencyCache: cache, Executor: effect.NewExecutor(), LayerContributor: libpak.NewLayerContributor("Native Image", expected), Manifest: manifest, StackID: stackID, } - entry := dependency.AsBuildpackPlanEntry() - entry.Metadata["launch"] = n.Name() - plan.Entries = append(plan.Entries, entry) - return n, nil } @@ -127,15 +116,8 @@ func (n NativeImage) Contribute(layer libcnb.Layer) (libcnb.Layer, error) { cp = append(cp, filepath.Join(n.ApplicationPath, s, l)) } - if !n.hasSpringGraalVMNative(libs) { - n.Logger.Header(color.BlueString("%s %s", n.Dependency.Name, n.Dependency.Version)) - - artifact, err := n.DependencyCache.Artifact(n.Dependency) - if err != nil { - return libcnb.Layer{}, fmt.Errorf("unable to get dependency %s\n%w", n.Dependency.ID, err) - } - defer artifact.Close() - cp = append(cp, artifact.Name()) + if !n.hasSpringNative(libs) { + return libcnb.Layer{}, errors.New("application is missing required 'spring-native' dependency") } arguments := n.Arguments @@ -214,8 +196,9 @@ func (NativeImage) Name() string { return "native-image" } -func (NativeImage) hasSpringGraalVMNative(libs []string) bool { - re := regexp.MustCompile(`spring-graalvm-native-.+\.jar`) +func (NativeImage) hasSpringNative(libs []string) bool { + // matches either spring-native or legacy spring-graalvm-native + re := regexp.MustCompile(`spring-(?:graalvm-|)native-.+\.jar`) for _, l := range libs { if re.MatchString(l) { diff --git a/native/native_image_test.go b/native/native_image_test.go index 711052e..b943741 100644 --- a/native/native_image_test.go +++ b/native/native_image_test.go @@ -61,119 +61,126 @@ func testNativeImage(t *testing.T, context spec.G, it spec.S) { Expect(os.RemoveAll(ctx.Layers.Path)).To(Succeed()) }) - it("contributes native image", func() { - dep := libpak.BuildpackDependency{ - URI: "https://localhost/stub-spring-graalvm-native.jar", - SHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - } - dc := libpak.DependencyCache{CachePath: "testdata"} - - m := properties.NewProperties() - _, _, err := m.Set("Start-Class", "test-start-class") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Classes", "BOOT-INF/classes/") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Lib", "BOOT-INF/lib/") - Expect(err).NotTo(HaveOccurred()) + context("has neither spring-native nor spring-graalvm-native dependency", func() { + it("fails", func() { + m := properties.NewProperties() + _, _, err := m.Set("Start-Class", "test-start-class") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classes", "BOOT-INF/classes/") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Lib", "BOOT-INF/lib/") + Expect(err).NotTo(HaveOccurred()) - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed()) - Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` + Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` - "test-jar.jar"`), 0644)).To(Succeed()) - n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", dep, dc, m, - ctx.StackID, &libcnb.BuildpackPlan{}) - Expect(err).NotTo(HaveOccurred()) - n.Executor = executor + n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", m, ctx.StackID) + Expect(err).NotTo(HaveOccurred()) + n.Executor = executor - layer, err := ctx.Layers.Layer("test-layer") - Expect(err).NotTo(HaveOccurred()) + layer, err := ctx.Layers.Layer("test-layer") + Expect(err).NotTo(HaveOccurred()) - executor.On("Execute", mock.Anything).Run(func(args mock.Arguments) { - Expect(ioutil.WriteFile(filepath.Join(layer.Path, "test-start-class"), []byte{}, 0644)).To(Succeed()) - }).Return(nil) + executor.On("Execute", mock.Anything).Run(func(args mock.Arguments) { + Expect(ioutil.WriteFile(filepath.Join(layer.Path, "test-start-class"), []byte{}, 0644)).To(Succeed()) + }).Return(nil) - layer, err = n.Contribute(layer) - Expect(err).NotTo(HaveOccurred()) + layer, err = n.Contribute(layer) + Expect(err).To(HaveOccurred()) + }) + }) + + context("has spring-native dependency", func() { + it("it builds a native image", func() { + m := properties.NewProperties() + _, _, err := m.Set("Start-Class", "test-start-class") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classes", "BOOT-INF/classes/") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Lib", "BOOT-INF/lib/") + Expect(err).NotTo(HaveOccurred()) - Expect(layer.Cache).To(BeTrue()) - Expect(filepath.Join(layer.Path, "test-start-class")).To(BeARegularFile()) - Expect(filepath.Join(ctx.Application.Path, "test-start-class")).To(BeARegularFile()) - Expect(filepath.Join(ctx.Application.Path, "fixture-marker")).NotTo(BeAnExistingFile()) - - execution := executor.Calls[0].Arguments[0].(effect.Execution) - Expect(execution.Command).To(Equal("native-image")) - Expect(execution.Args).To(Equal([]string{"--version"})) - Expect(execution.Dir).To(Equal(layer.Path)) - - execution = executor.Calls[1].Arguments[0].(effect.Execution) - Expect(execution.Command).To(Equal("native-image")) - Expect(execution.Args).To(Equal([]string{ - "test-argument-1", - "test-argument-2", - fmt.Sprintf("-H:Name=%s", filepath.Join(layer.Path, "test-start-class")), - "-cp", - strings.Join([]string{ + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed()) + + Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` +- "test-jar.jar" +- "spring-graalvm-native-0.8.6-xxxxxx.jar" +`), 0644)).To(Succeed()) + + n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", m, ctx.StackID) + Expect(err).NotTo(HaveOccurred()) + n.Executor = executor + + layer, err := ctx.Layers.Layer("test-layer") + Expect(err).NotTo(HaveOccurred()) + + executor.On("Execute", mock.Anything).Run(func(args mock.Arguments) { + Expect(ioutil.WriteFile(filepath.Join(layer.Path, "test-start-class"), []byte{}, 0644)).To(Succeed()) + }).Return(nil) + + layer, err = n.Contribute(layer) + Expect(err).NotTo(HaveOccurred()) + + execution := executor.Calls[1].Arguments[0].(effect.Execution) + Expect(execution.Args[4]).To(Equal(strings.Join([]string{ ctx.Application.Path, filepath.Join(ctx.Application.Path, "BOOT-INF", "classes"), filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "test-jar.jar"), - filepath.Join("testdata", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "stub-spring-graalvm-native.jar"), - }, ":"), - "test-start-class", - })) - Expect(execution.Dir).To(Equal(layer.Path)) + filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "spring-graalvm-native-0.8.6-xxxxxx.jar"), + }, ":"))) + }) }) - it("does not contribute spring-graalvm-native JAR if it already exists in application", func() { - dep := libpak.BuildpackDependency{ - URI: "https://localhost/stub-spring-graalvm-native.jar", - SHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - } - dc := libpak.DependencyCache{CachePath: "testdata"} - - m := properties.NewProperties() - _, _, err := m.Set("Start-Class", "test-start-class") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Classes", "BOOT-INF/classes/") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx") - Expect(err).NotTo(HaveOccurred()) - _, _, err = m.Set("Spring-Boot-Lib", "BOOT-INF/lib/") - Expect(err).NotTo(HaveOccurred()) + context("has spring-graalvm-native dependency", func() { + it("it builds a native image", func() { + m := properties.NewProperties() + _, _, err := m.Set("Start-Class", "test-start-class") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classes", "BOOT-INF/classes/") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx") + Expect(err).NotTo(HaveOccurred()) + _, _, err = m.Set("Spring-Boot-Lib", "BOOT-INF/lib/") + Expect(err).NotTo(HaveOccurred()) - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed()) - Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` + Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` - "test-jar.jar" - "spring-graalvm-native-0.8.0-20200729.130845-95.jar" `), 0644)).To(Succeed()) - n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", dep, dc, m, - ctx.StackID, &libcnb.BuildpackPlan{}) - Expect(err).NotTo(HaveOccurred()) - n.Executor = executor + n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", m, ctx.StackID) + Expect(err).NotTo(HaveOccurred()) + n.Executor = executor - layer, err := ctx.Layers.Layer("test-layer") - Expect(err).NotTo(HaveOccurred()) + layer, err := ctx.Layers.Layer("test-layer") + Expect(err).NotTo(HaveOccurred()) - executor.On("Execute", mock.Anything).Run(func(args mock.Arguments) { - Expect(ioutil.WriteFile(filepath.Join(layer.Path, "test-start-class"), []byte{}, 0644)).To(Succeed()) - }).Return(nil) + executor.On("Execute", mock.Anything).Run(func(args mock.Arguments) { + Expect(ioutil.WriteFile(filepath.Join(layer.Path, "test-start-class"), []byte{}, 0644)).To(Succeed()) + }).Return(nil) - layer, err = n.Contribute(layer) - Expect(err).NotTo(HaveOccurred()) + layer, err = n.Contribute(layer) + Expect(err).NotTo(HaveOccurred()) - execution := executor.Calls[1].Arguments[0].(effect.Execution) - Expect(execution.Args[4]).To(Equal(strings.Join([]string{ - ctx.Application.Path, - filepath.Join(ctx.Application.Path, "BOOT-INF", "classes"), - filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "test-jar.jar"), - filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "spring-graalvm-native-0.8.0-20200729.130845-95.jar"), - }, ":"))) + execution := executor.Calls[1].Arguments[0].(effect.Execution) + Expect(execution.Args[4]).To(Equal(strings.Join([]string{ + ctx.Application.Path, + filepath.Join(ctx.Application.Path, "BOOT-INF", "classes"), + filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "test-jar.jar"), + filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "spring-graalvm-native-0.8.0-20200729.130845-95.jar"), + }, ":"))) + }) }) context("tiny stack", func() { @@ -182,12 +189,6 @@ func testNativeImage(t *testing.T, context spec.G, it spec.S) { }) it("contributes native image", func() { - dep := libpak.BuildpackDependency{ - URI: "https://localhost/stub-spring-graalvm-native.jar", - SHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - } - dc := libpak.DependencyCache{CachePath: "testdata"} - m := properties.NewProperties() _, _, err := m.Set("Start-Class", "test-start-class") Expect(err).NotTo(HaveOccurred()) @@ -204,8 +205,13 @@ func testNativeImage(t *testing.T, context spec.G, it spec.S) { Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` - "test-jar.jar"`), 0644)).To(Succeed()) - n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", dep, dc, m, - ctx.StackID, &libcnb.BuildpackPlan{}) + Expect(os.MkdirAll(filepath.Join(ctx.Application.Path, "BOOT-INF"), 0755)).To(Succeed()) + Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "BOOT-INF", "classpath.idx"), []byte(` +- "test-jar.jar" +- "spring-graalvm-native-0.8.6-xxxxxx.jar" +`), 0644)).To(Succeed()) + + n, err := native.NewNativeImage(ctx.Application.Path, "test-argument-1 test-argument-2", m, ctx.StackID) Expect(err).NotTo(HaveOccurred()) n.Executor = executor @@ -236,7 +242,7 @@ func testNativeImage(t *testing.T, context spec.G, it spec.S) { filepath.Join(ctx.Application.Path), filepath.Join(ctx.Application.Path, "BOOT-INF", "classes"), filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "test-jar.jar"), - filepath.Join("testdata", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "stub-spring-graalvm-native.jar"), + filepath.Join(ctx.Application.Path, "BOOT-INF", "lib", "spring-graalvm-native-0.8.6-xxxxxx.jar"), }, ":"), "test-start-class", }))