cmd/gomobile: make -n work with bind
Fixes golang/go#13323. Change-Id: Ica213b7d06581ac7a0492184a903752cfa15d889 Reviewed-on: https://go-review.googlesource.com/17090 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
b39ed682d8
commit
0d55c986b8
@ -14,6 +14,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -147,12 +148,18 @@ func (b *binder) GenObjc(outdir string) error {
|
||||
if buildX {
|
||||
printcmd("gobind %s -outdir=%s %s", bindOption, outdir, b.pkg.Path())
|
||||
}
|
||||
if buildN {
|
||||
return nil
|
||||
}
|
||||
return bind.GenObjc(w, b.fset, b.pkg, bindPrefix, false)
|
||||
}
|
||||
if err := writeFile(mfile, generate); err != nil {
|
||||
return err
|
||||
}
|
||||
generate = func(w io.Writer) error {
|
||||
if buildN {
|
||||
return nil
|
||||
}
|
||||
return bind.GenObjc(w, b.fset, b.pkg, bindPrefix, true)
|
||||
}
|
||||
if err := writeFile(hfile, generate); err != nil {
|
||||
@ -178,6 +185,9 @@ func (b *binder) GenJava(outdir string) error {
|
||||
if buildX {
|
||||
printcmd("gobind %s -outdir=%s %s", bindOption, outdir, b.pkg.Path())
|
||||
}
|
||||
if buildN {
|
||||
return nil
|
||||
}
|
||||
return bind.GenJava(w, b.fset, b.pkg, bindJavaPkg)
|
||||
}
|
||||
if err := writeFile(javaFile, generate); err != nil {
|
||||
@ -195,6 +205,9 @@ func (b *binder) GenGo(outdir string) error {
|
||||
if buildX {
|
||||
printcmd("gobind -lang=go -outdir=%s %s", outdir, b.pkg.Path())
|
||||
}
|
||||
if buildN {
|
||||
return nil
|
||||
}
|
||||
return bind.GenGo(w, b.fset, b.pkg)
|
||||
}
|
||||
if err := writeFile(goFile, generate); err != nil {
|
||||
@ -276,6 +289,9 @@ func loadExportData(importPath string, env []string, args ...string) (*types.Pac
|
||||
if err := copyFile(dst, src); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buildN {
|
||||
return types.NewPackage(importPath, path.Base(importPath)), nil
|
||||
}
|
||||
oldDefault := build.Default
|
||||
build.Default = ctx // copy
|
||||
build.Default.GOPATH = fakegopath
|
||||
|
Loading…
x
Reference in New Issue
Block a user