-
Notifications
You must be signed in to change notification settings - Fork 13
/
buildpack.go
133 lines (103 loc) · 4 KB
/
buildpack.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright 2018-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package libcnb
// BuildpackInfo is information about the buildpack.
type BuildpackInfo struct {
// ID is the ID of the buildpack.
ID string `toml:"id"`
// Name is the name of the buildpack.
Name string `toml:"name"`
// Version is the version of the buildpack.
Version string `toml:"version"`
// Homepage is the homepage of the buildpack.
Homepage string `toml:"homepage"`
// ClearEnvironment is whether the environment should be clear of user-configured environment variables.
ClearEnvironment bool `toml:"clear-env"`
// Description is a string describing the buildpack.
Description string `toml:"description"`
// Keywords is a list of words that are associated with the buildpack.
Keywords []string `toml:"keywords"`
// Licenses a list of buildpack licenses.
Licenses []License `toml:"licenses"`
// SBOM is the list of supported SBOM media types
SBOMFormats []string `toml:"sbom-formats"`
}
// License contains information about a Software License
// governing the use or redistribution of a buildpack
type License struct {
// Type is the identifier for the license.
// It MAY use the SPDX 2.1 license expression, but is not limited to identifiers in the SPDX Licenses List.
Type string `toml:"type"`
// URI may be specified in lieu of or in addition to type to point to the license
// if this buildpack is using a nonstandard license.
URI string `toml:"uri"`
}
// BuildpackOrderBuildpack is a buildpack within in a buildpack order group.
type BuildpackOrderBuildpack struct {
// ID is the id of the buildpack.
ID string `toml:"id"`
// Version is the version of the buildpack.
Version string `toml:"version"`
// Optional is whether the buildpack is optional within the buildpack.
Optional bool `toml:"optional"`
}
// BuildpackOrder is an order definition in the buildpack.
type BuildpackOrder struct {
// Groups is the collection of groups within the order.
Groups []BuildpackOrderBuildpack `toml:"group"`
}
// Deprecated: BuildpackStack is a stack supported by the buildpack.
type BuildpackStack struct {
// ID is the id of the stack.
ID string `toml:"id"`
}
// TargetDistro is the supported target distro
type TargetDistro struct {
// Name is the name of the supported distro.
Name string `toml:"name"`
// Version is the version of the supported distro.
Version string `toml:"version"`
}
// TargetInfo is the supported target
type TargetInfo struct {
// OS is the supported os.
OS string `toml:"os"`
// Arch is the supported architecture.
Arch string `toml:"arch"`
// Variant is the supported variant of the architecture.
Variant string `toml:"variant"`
}
// Target is a target supported by the buildpack.
type Target struct {
TargetInfo
// Distros is the collection of distros associated with the target.
Distros []TargetDistro `toml:"distros"`
}
// Buildpack is the contents of the buildpack.toml file.
type Buildpack struct {
// API is the api version expected by the buildpack.
API string `toml:"api"`
// Info is information about the buildpack.
Info BuildpackInfo `toml:"buildpack"`
// Path is the path to the buildpack.
Path string `toml:"-"`
// Deprecated: Stacks is the collection of stacks supported by the buildpack.
Stacks []BuildpackStack `toml:"stacks"`
// Targets is the collection of targets supported by the buildpack.
Targets []Target `toml:"targets"`
// Metadata is arbitrary metadata attached to the buildpack.
Metadata map[string]interface{} `toml:"metadata"`
}