Skip to content

Commit

Permalink
refactor buildkit graph operations
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-cup committed Jan 29, 2025
1 parent ee4e79e commit d88ea74
Show file tree
Hide file tree
Showing 10 changed files with 469 additions and 240 deletions.
14 changes: 7 additions & 7 deletions buildkit/graph_env.go → buildkit/build_llb/build_env.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package buildkit
package build_llb

type GraphEnvironment struct {
type BuildEnvironment struct {
PathList []string
EnvVars map[string]string
}

func NewGraphEnvironment() GraphEnvironment {
return GraphEnvironment{
func NewGraphEnvironment() BuildEnvironment {
return BuildEnvironment{
PathList: make([]string, 0),
EnvVars: make(map[string]string),
}
}

// Merges the other environment into the current environment
func (e *GraphEnvironment) Merge(other GraphEnvironment) {
func (e *BuildEnvironment) Merge(other BuildEnvironment) {
e.PathList = append(e.PathList, other.PathList...)

for k, v := range other.EnvVars {
e.EnvVars[k] = v
}
}

func (e *GraphEnvironment) AddPath(path string) {
func (e *BuildEnvironment) AddPath(path string) {
for _, existingPath := range e.PathList {
if existingPath == path {
return
Expand All @@ -31,6 +31,6 @@ func (e *GraphEnvironment) AddPath(path string) {
e.PathList = append(e.PathList, path)
}

func (e *GraphEnvironment) AddEnvVar(key, value string) {
func (e *BuildEnvironment) AddEnvVar(key, value string) {
e.EnvVars[key] = value
}
Loading

0 comments on commit d88ea74

Please sign in to comment.