-
Notifications
You must be signed in to change notification settings - Fork 2
/
buidfile.go
49 lines (39 loc) · 1.29 KB
/
buidfile.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
package sdkbuildfile
import (
"go.autokitteh.dev/autokitteh/internal/kittehs"
"go.autokitteh.dev/autokitteh/sdk/sdktypes"
)
type BuildFile struct {
Info BuildInfo `json:"info"`
Runtimes []*RuntimeData `json:"runtimes"`
// requirements that are not satisfiable at build time.
RuntimeRequirements []sdktypes.BuildRequirement `json:"runtime_requirements"`
}
type BuildInfo struct {
Memo map[string]string `json:"memo,omitempty"`
}
type RuntimeData struct {
Info RuntimeInfo `json:"info"`
Artifact sdktypes.BuildArtifact `json:"artifact"`
}
func (bf *BuildFile) OmitContent() {
// TODO: replace data with its length. Problem is that JSON renders it as a bytes buffer
// so it shows it in base64 like `"content": "PDY4IGJ5dGVzPg=="`` which is not useful.
measure := func(bs []byte) []byte { return nil }
for _, rt := range bf.Runtimes {
all := rt.Artifact.CompiledData()
rt.Artifact = rt.Artifact.WithCompiledData(kittehs.TransformMapValues(all, measure))
}
}
// This does not overwrite Info.
func (d *RuntimeData) MergeFrom(other *RuntimeData) error {
d.Artifact = d.Artifact.MergeFrom(other.Artifact)
return nil
}
type RuntimeInfo struct {
Name sdktypes.Symbol `json:"name"`
}
type ResourceInfo struct {
Path string `json:"path"`
Status string `json:"status"`
}