Skip to content

Commit

Permalink
Check for presence of a target if we're doing a local subinclude.
Browse files Browse the repository at this point in the history
Fixes #573 (infinite loop in above scenario)
  • Loading branch information
peterebden committed Mar 22, 2019
1 parent 152d210 commit 393dfe2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/parse/asp/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ func subinclude(s *scope, args []pyObject) pyObject {
// subincludeTarget returns the target for a subinclude() call to a label.
// It blocks until the target exists and is built.
func subincludeTarget(s *scope, l core.BuildLabel) *core.BuildTarget {
t := s.state.WaitForBuiltTarget(l, s.contextPkg.Label())
pkgLabel := s.contextPkg.Label()
if l.Subrepo == pkgLabel.Subrepo && l.PackageName == pkgLabel.PackageName {
// This is a subinclude in the same package, check the target exists.
s.NAssert(s.contextPkg.Target(l.Name) == nil, "Target :%s is not defined in this package; it has to be defined before the subinclude() call", l.Name)
}
t := s.state.WaitForBuiltTarget(l, pkgLabel)
// This is not quite right, if you subinclude from another subinclude we can basically
// lose track of it later on. It's hard to know what better to do at this point though.
s.contextPkg.RegisterSubinclude(l)
Expand Down

0 comments on commit 393dfe2

Please sign in to comment.