diff options
author | Andrew Gerrand <adg@golang.org> | 2011-06-23 10:15:46 +1000 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2011-06-23 10:15:46 +1000 |
commit | d7df79a7e53e14c00f07d6ceae79245ef348d1fc (patch) | |
tree | 3dfc7701b5d8b8debb017b96e188ec146009e2c7 | |
parent | 88442358a98bca7c93eec12be221b2a0f26e8277 (diff) | |
download | go-d7df79a7e53e14c00f07d6ceae79245ef348d1fc.tar.gz go-d7df79a7e53e14c00f07d6ceae79245ef348d1fc.zip |
go/build: include Import objects in Script Inputs
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
-rw-r--r-- | src/pkg/go/build/build.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pkg/go/build/build.go b/src/pkg/go/build/build.go index 585489279f..d83a6666e8 100644 --- a/src/pkg/go/build/build.go +++ b/src/pkg/go/build/build.go @@ -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...) |