]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: include Import objects in Script Inputs
authorAndrew Gerrand <adg@golang.org>
Thu, 23 Jun 2011 00:15:46 +0000 (10:15 +1000)
committerAndrew Gerrand <adg@golang.org>
Thu, 23 Jun 2011 00:15:46 +0000 (10:15 +1000)
This has the effect of making goinstall rebuild a package's
dependencies when they are newer than the current package object.

R=rsc
CC=golang-dev
https://golang.org/cl/4627051

src/pkg/go/build/build.go

index 585489279fb88284daeb5b25603fecf56563b2bc..d83a6666e82a7f7f1bab0bcd6b798af9913f82f1 100644 (file)
@@ -35,6 +35,18 @@ func Build(tree *Tree, pkg string, info *DirInfo) (*Script, os.Error) {
                return nil, err
        }
 
+       // add import object files to list of Inputs
+       for _, pkg := range info.Imports {
+               t, p, err := FindTree(pkg)
+               if err != nil && err != ErrNotFound {
+                       // FindTree should always be able to suggest an import
+                       // path and tree. The path must be malformed
+                       // (for example, an absolute or relative path).
+                       return nil, os.NewError("build: invalid import: " + pkg)
+               }
+               s.addInput(filepath.Join(t.PkgDir(), p+".a"))
+       }
+
        // .go files to be built with gc
        gofiles := b.abss(info.GoFiles...)
        s.addInput(gofiles...)