Skip to content

Commit 38c0eb4

Browse files
committed
newt/repo: This fixes building targets when there are no repos and no
dependencies - This only happens when `newt` is used to build a standalone project without any repos or dependencies listed, everything local
1 parent 16449ee commit 38c0eb4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

newt/repo/repo.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ func (r *Repo) Name() string {
198198
}
199199

200200
func (r *Repo) Path() string {
201-
return r.localPath
201+
if r != nil {
202+
return r.localPath
203+
} else {
204+
return ""
205+
}
202206
}
203207

204208
func (r *Repo) IsLocal() bool {

newt/sysinit/sysinit.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) {
163163
sort.Slice(nodesQ, func(i int, j int) bool {
164164
a := nodesQ[i]
165165
b := nodesQ[j]
166-
167166
if strings.Compare(a.Name, b.Name) == -1 {
168167
return false
169168
}
@@ -181,6 +180,10 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) {
181180
// direct dependencies between each node of stage X to each node of
182181
// stage Y to make sure they can be resolved properly and reordered
183182
// if needed due to other dependencies.
183+
if stages == nil {
184+
util.FmtNewtError("Cannot resolve sysinit order: no stages defined.")
185+
return []stage.StageFunc{}, nil
186+
}
184187
sfsPrev := nodesByStage[stages[0]]
185188
stages = stages[1:]
186189
for _, stage := range stages {

0 commit comments

Comments
 (0)