From fc95594390a5189b9c1c206ce76f83760843e9d3 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 3 Oct 2024 21:35:19 -0400 Subject: [PATCH] feat: add support for targets to cargo Add support for targets in buildpack.toml which are used for multi-arch support. Signed-off-by: Michael Dawson --- cargo/config.go | 6 ++++++ cargo/config_test.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/cargo/config.go b/cargo/config.go index 657068d0..c5dda4eb 100644 --- a/cargo/config.go +++ b/cargo/config.go @@ -15,6 +15,7 @@ type Config struct { Metadata ConfigMetadata `toml:"metadata" json:"metadata,omitempty"` Stacks []ConfigStack `toml:"stacks" json:"stacks,omitempty"` Order []ConfigOrder `toml:"order" json:"order,omitempty"` + Targets []ConfigTarget `toml:"targets" json:"targets,omitempty"` } type ConfigStack struct { @@ -22,6 +23,11 @@ type ConfigStack struct { Mixins []string `toml:"mixins" json:"mixins,omitempty"` } +type ConfigTarget struct { + OS string `toml:"os" json:"os,omitempty"` + Arch string `toml:"arch" json:"arch,omitempty"` +} + type ConfigBuildpack struct { ID string `toml:"id" json:"id,omitempty"` Name string `toml:"name" json:"name,omitempty"` diff --git a/cargo/config_test.go b/cargo/config_test.go index beae8a37..ae74b146 100644 --- a/cargo/config_test.go +++ b/cargo/config_test.go @@ -57,6 +57,12 @@ func testConfig(t *testing.T, context spec.G, it spec.S) { ID: "other-stack-id", }, }, + Targets: []cargo.ConfigTarget{ + { + OS: "linux", + Arch: "arm64", + }, + }, Metadata: cargo.ConfigMetadata{ IncludeFiles: []string{ "some-include-file", @@ -166,6 +172,10 @@ api = "0.6" [[stacks]] id = "other-stack-id" +[[targets]] + os = "linux" + arch = "arm64" + [[order]] [[order.group]] id = "some-dependency"