Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ type Dependency struct {
Subpackages []string `yaml:"subpackages,omitempty"`
Arch []string `yaml:"arch,omitempty"`
Os []string `yaml:"os,omitempty"`
Recursive bool `yaml:"recursive,omitempty"`
}

// A transitive representation of a dependency for importing and exploting to yaml.
Expand All @@ -389,6 +390,7 @@ type dep struct {
Subpackages []string `yaml:"subpackages,omitempty"`
Arch []string `yaml:"arch,omitempty"`
Os []string `yaml:"os,omitempty"`
Recursive bool `yaml:"recursive,omitempty"`
}

// DependencyFromLock converts a Lock to a Dependency
Expand All @@ -401,6 +403,7 @@ func DependencyFromLock(lock *Lock) *Dependency {
Subpackages: lock.Subpackages,
Arch: lock.Arch,
Os: lock.Os,
Recursive: lock.Recursive,
}
}

Expand All @@ -418,6 +421,7 @@ func (d *Dependency) UnmarshalYAML(unmarshal func(interface{}) error) error {
d.Subpackages = newDep.Subpackages
d.Arch = newDep.Arch
d.Os = newDep.Os
d.Recursive = newDep.Recursive

if d.Reference == "" && newDep.Ref != "" {
d.Reference = newDep.Ref
Expand Down Expand Up @@ -455,6 +459,7 @@ func (d *Dependency) MarshalYAML() (interface{}, error) {
Subpackages: d.Subpackages,
Arch: d.Arch,
Os: d.Os,
Recursive: d.Recursive,
}

return newDep, nil
Expand Down Expand Up @@ -511,7 +516,12 @@ func (d *Dependency) GetRepo(dest string) (vcs.Repo, error) {
if len(VcsType) > 0 && VcsType != "None" {
switch vcs.Type(VcsType) {
case vcs.Git:
return vcs.NewGitRepo(remote, dest)
r, err := vcs.NewGitRepo(remote, dest)
if err != nil {
return nil, err
}
r.SetRecursive(d.Recursive)
return r, nil
case vcs.Svn:
return vcs.NewSvnRepo(remote, dest)
case vcs.Hg:
Expand All @@ -524,7 +534,12 @@ func (d *Dependency) GetRepo(dest string) (vcs.Repo, error) {
}

// When no type set we try to autodetect.
return vcs.NewRepo(remote, dest)
r, err := vcs.NewRepo(remote, dest)
if err != nil {
return nil, err
}
r.SetRecursive(d.Recursive)
return r, nil
}

// Clone creates a clone of a Dependency
Expand All @@ -538,6 +553,7 @@ func (d *Dependency) Clone() *Dependency {
Subpackages: d.Subpackages,
Arch: d.Arch,
Os: d.Os,
Recursive: d.Recursive,
}
}

Expand Down
3 changes: 3 additions & 0 deletions cfg/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type Lock struct {
Subpackages []string `yaml:"subpackages,omitempty"`
Arch []string `yaml:"arch,omitempty"`
Os []string `yaml:"os,omitempty"`
Recursive bool `yaml:"recursive:omitempty"`
}

// Clone creates a clone of a Lock.
Expand All @@ -174,6 +175,7 @@ func (l *Lock) Clone() *Lock {
Subpackages: l.Subpackages,
Arch: l.Arch,
Os: l.Os,
Recursive: l.Recursive,
}
}

Expand All @@ -187,6 +189,7 @@ func LockFromDependency(dep *Dependency) *Lock {
Subpackages: dep.Subpackages,
Arch: dep.Arch,
Os: dep.Os,
Recursive: dep.Recursive,
}
}

Expand Down