From 221d9dd98ae5da6414ef572702ecd4291a420ca5 Mon Sep 17 00:00:00 2001 From: Ryan Moran Date: Fri, 30 Oct 2020 08:50:27 -0700 Subject: [PATCH] Include mixins when packaging Resolves #80 --- cargo/config.go | 3 ++- cargo/config_test.go | 23 +++++++++++++++---- cargo/jam/pack_test.go | 6 +++-- cargo/jam/testdata/example-cnb/buildpack.toml | 1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/cargo/config.go b/cargo/config.go index d35def3d..ca05b474 100644 --- a/cargo/config.go +++ b/cargo/config.go @@ -17,7 +17,8 @@ type Config struct { } type ConfigStack struct { - ID string `toml:"id" json:"id,omitempty"` + ID string `toml:"id" json:"id,omitempty"` + Mixins []string `toml:"mixins" json:"mixins,omitempty"` } type ConfigBuildpack struct { diff --git a/cargo/config_test.go b/cargo/config_test.go index 8e21ba9d..31d8732c 100644 --- a/cargo/config_test.go +++ b/cargo/config_test.go @@ -40,7 +40,11 @@ func testConfig(t *testing.T, context spec.G, it spec.S) { }, Stacks: []cargo.ConfigStack{ { - ID: "some-stack-id", + ID: "some-stack-id", + Mixins: []string{"some-mixin-id"}, + }, + { + ID: "other-stack-id", }, }, Metadata: cargo.ConfigMetadata{ @@ -70,8 +74,7 @@ func testConfig(t *testing.T, context spec.G, it spec.S) { Group: []cargo.ConfigOrderGroup{ { ID: "some-dependency", - Version: "some-version", - }, + Version: "some-version"}, { ID: "other-dependency", Version: "other-version", @@ -110,6 +113,10 @@ some-dependency = "1.2.x" [[stacks]] id = "some-stack-id" + mixins = ["some-mixin-id"] + +[[stacks]] + id = "other-stack-id" [[order]] [[order.group]] @@ -169,6 +176,10 @@ some-dependency = "1.2.x" [[stacks]] id = "some-stack-id" + mixins = ["some-mixin-id"] + +[[stacks]] + id = "other-stack-id" [[order]] [[order.group]] @@ -193,7 +204,11 @@ some-dependency = "1.2.x" }, Stacks: []cargo.ConfigStack{ { - ID: "some-stack-id", + ID: "some-stack-id", + Mixins: []string{"some-mixin-id"}, + }, + { + ID: "other-stack-id", }, }, Metadata: cargo.ConfigMetadata{ diff --git a/cargo/jam/pack_test.go b/cargo/jam/pack_test.go index 5d76f5c8..4ec9d919 100644 --- a/cargo/jam/pack_test.go +++ b/cargo/jam/pack_test.go @@ -185,7 +185,8 @@ func testPack(t *testing.T, context spec.G, it spec.S) { version = "4.5.6" [[stacks]] - id = "some-stack-id"`)) + id = "some-stack-id" + mixins = ["some-mixin-id"]`)) Expect(hdr.Mode).To(Equal(int64(0644))) contents, hdr, err = ExtractFile(file, "bin/build") @@ -305,7 +306,8 @@ func testPack(t *testing.T, context spec.G, it spec.S) { version = "1.2.3" [[stacks]] - id = "some-stack-id"`)) + id = "some-stack-id" + mixins = ["some-mixin-id"]`)) Expect(hdr.Mode).To(Equal(int64(0644))) contents, hdr, err = ExtractFile(file, "bin/build") diff --git a/cargo/jam/testdata/example-cnb/buildpack.toml b/cargo/jam/testdata/example-cnb/buildpack.toml index c3729d44..f49dae3d 100644 --- a/cargo/jam/testdata/example-cnb/buildpack.toml +++ b/cargo/jam/testdata/example-cnb/buildpack.toml @@ -32,3 +32,4 @@ api = "0.2" [[stacks]] id = "some-stack-id" + mixins = ["some-mixin-id"]