From 4234383196b2738d9f0b63b2a6599e7ec5dc847d Mon Sep 17 00:00:00 2001 From: Forest Eckhardt Date: Fri, 13 Sep 2019 15:45:15 -0400 Subject: [PATCH] add sdk location to build environment variables [#167050435] --- sdk/sdk.go | 4 ++++ sdk/sdk_test.go | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sdk/sdk.go b/sdk/sdk.go index 26f6ccde..03bc6b0b 100644 --- a/sdk/sdk.go +++ b/sdk/sdk.go @@ -65,6 +65,10 @@ func (c Contributor) Contribute() error { if err := helper.ExtractTarXz(artifact, layer.Root, 0); err != nil { return err } + + if err := layer.OverrideBuildEnv("SDK_LOCATION", layer.Root); err != nil { + return err + } return nil }, getFlags(c.plan.Metadata)...) diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index d18b7041..933399b5 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -118,10 +118,12 @@ func testSdk(t *testing.T, when spec.G, it spec.S) { it("appends dotnet driver to path, installs the runtime dependency", func() { factory.AddPlan(buildpackplan.Plan{Name: DotnetSDK, Version: "2.2.0"}) - dotnetRuntimeContributor, _, err := NewContributor(factory.Build) + dotnetSDKContributor, _, err := NewContributor(factory.Build) Expect(err).NotTo(HaveOccurred()) - Expect(dotnetRuntimeContributor.Contribute()).To(Succeed()) + Expect(dotnetSDKContributor.Contribute()).To(Succeed()) + + Expect(dotnetSDKContributor.sdkLayer).To(test.HaveOverrideBuildEnvironment("SDK_LOCATION", dotnetSDKContributor.sdkLayer.Root)) ExpectSymlink(filepath.Join(symlinkLayer.Root, "host"), t) @@ -138,10 +140,10 @@ func testSdk(t *testing.T, when spec.G, it spec.S) { factory.SetDefaultVersion(DotnetSDK, "0.9") factory.AddPlan(buildpackplan.Plan{Name: DotnetSDK}) - dotnetRuntimeContributor, _, err := NewContributor(factory.Build) + dotnetSDKContributor, _, err := NewContributor(factory.Build) Expect(err).NotTo(HaveOccurred()) - Expect(dotnetRuntimeContributor.Contribute()).To(Succeed()) + Expect(dotnetSDKContributor.Contribute()).To(Succeed()) layer := factory.Build.Layers.Layer(DotnetSDK) Expect(layer).To(test.HaveLayerVersion("0.9")) }) @@ -155,10 +157,10 @@ func testSdk(t *testing.T, when spec.G, it spec.S) { }, }) - dotnetRuntimeContributor, _, err := NewContributor(factory.Build) + dotnetSDKContributor, _, err := NewContributor(factory.Build) Expect(err).NotTo(HaveOccurred()) - Expect(dotnetRuntimeContributor.Contribute()).To(Succeed()) + Expect(dotnetSDKContributor.Contribute()).To(Succeed()) layer := factory.Build.Layers.Layer(DotnetSDK) Expect(layer).To(test.HaveLayerMetadata(true, false, false)) @@ -173,10 +175,10 @@ func testSdk(t *testing.T, when spec.G, it spec.S) { }, }) - dotnetRuntimeContributor, _, err := NewContributor(factory.Build) + dotnetSDKContributor, _, err := NewContributor(factory.Build) Expect(err).NotTo(HaveOccurred()) - Expect(dotnetRuntimeContributor.Contribute()).To(Succeed()) + Expect(dotnetSDKContributor.Contribute()).To(Succeed()) layer := factory.Build.Layers.Layer(DotnetSDK)