Skip to content

Commit

Permalink
add sdk location to build environment variables
Browse files Browse the repository at this point in the history
[#167050435]
  • Loading branch information
ForestEckhardt committed Sep 13, 2019
1 parent 507c554 commit 4234383
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)...)
Expand Down
18 changes: 10 additions & 8 deletions sdk/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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"))
})
Expand All @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 4234383

Please sign in to comment.