Skip to content

Commit

Permalink
adding parsring targets for extension.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
pacostas authored and ForestEckhardt committed Jan 21, 2025
1 parent 9d649db commit 80b9005
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cargo/extension_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ type ExtensionConfig struct {
API string `toml:"api" json:"api,omitempty"`
Extension ConfigExtension `toml:"extension" json:"extension,omitempty"`
Metadata ConfigExtensionMetadata `toml:"metadata" json:"metadata,omitempty"`
Targets []ExtensionConfigTarget `toml:"targets" json:"targets,omitempty"`
}

type ExtensionConfigTarget struct {
OS string `toml:"os" json:"os,omitempty"`
Arch string `toml:"arch" json:"arch,omitempty"`
}

type ConfigExtensionMetadata struct {
Expand Down
19 changes: 19 additions & 0 deletions cargo/extension_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,21 @@ func testExtensionConfig(t *testing.T, context spec.G, it spec.S) {
Build: true,
},
},

DefaultVersions: map[string]string{
"some-dependency": "1.2.x",
},
},
Targets: []cargo.ExtensionConfigTarget{
{
OS: "linux",
Arch: "arm64",
},
{
OS: "linux",
Arch: "amd64",
},
},
})
Expect(err).NotTo(HaveOccurred())
Expect(buffer.String()).To(MatchTOML(`
Expand Down Expand Up @@ -118,6 +129,14 @@ api = "0.7"
stacks = ["io.buildpacks.stacks.bionic", "org.cloudfoundry.stacks.tiny"]
uri = "http://some-url"
version = "1.2.3"
[[targets]]
os = "linux"
arch = "arm64"
[[targets]]
os = "linux"
arch = "amd64"
`))
})

Expand Down

0 comments on commit 80b9005

Please sign in to comment.