cmd/gobind: update export data for imported packages
CL 30093 removed the go install step from gobind to avoid errors from circular dependencies with Java reverse wrapper. However, if a dependency is either never installed or outdated, gobind will fail. Reinstate the go install step, but ignore errors from the go install tool. Tested manually by wiping the $GOPATH/pkg directory and running the cmd/gobind tests. Updates golang/go#19046 Change-Id: I31832eccab09b2a7cf29e5d5bc1cc76963b7c2ef Reviewed-on: https://go-review.googlesource.com/37326 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
57e7952fd5
commit
eb9032959f
@ -16,7 +16,9 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/mobile/internal/importers"
|
"golang.org/x/mobile/internal/importers"
|
||||||
"golang.org/x/mobile/internal/importers/java"
|
"golang.org/x/mobile/internal/importers/java"
|
||||||
@ -86,6 +88,19 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the export data for any imported packages are up to date.
|
||||||
|
cmd := exec.Command("go", "install")
|
||||||
|
cmd.Args = append(cmd.Args, flag.Args()...)
|
||||||
|
cmd.Env = append(os.Environ(), "GOPATH="+ctx.GOPATH)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
// Only report I/O errors. Errors from go install is expected for as-yet
|
||||||
|
// undefined Java wrappers.
|
||||||
|
if _, ok := err.(*exec.ExitError); !ok {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s failed: %v", strings.Join(cmd.Args, " "), err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typePkgs := make([]*types.Package, len(allPkg))
|
typePkgs := make([]*types.Package, len(allPkg))
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
conf := &types.Config{
|
conf := &types.Config{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user