mirror of
https://github.com/go-i2p/gojava.git
synced 2025-07-03 17:59:42 -04:00
Use a build subcommand
This commit is contained in:
@ -1,4 +1,2 @@
|
|||||||
## GoJava - gobind for java
|
## GoJava -
|
||||||
|
|
||||||
WIP: This doesn't work yet
|
|
||||||
|
|
||||||
|
10
gojava.go
10
gojava.go
@ -51,9 +51,6 @@ func initBuild() (string, func (), error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadExportData(pkgs []string) ([]*types.Package, error) {
|
func loadExportData(pkgs []string) ([]*types.Package, error) {
|
||||||
if len(pkgs) == 0 {
|
|
||||||
pkgs = []string{"."}
|
|
||||||
}
|
|
||||||
// Load export data for the packages
|
// Load export data for the packages
|
||||||
if err := runCommand("go", append([]string{"install"}, pkgs...)...); err != nil {
|
if err := runCommand("go", append([]string{"install"}, pkgs...)...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -313,7 +310,6 @@ Usage:
|
|||||||
gojava build [-o <jar>] [<pkg1>, [<pkg2>...]]
|
gojava build [-o <jar>] [<pkg1>, [<pkg2>...]]
|
||||||
|
|
||||||
This generates a jar containing Java bindings to the specified Go packages.
|
This generates a jar containing Java bindings to the specified Go packages.
|
||||||
If no packages are specified the current directory is bound.
|
|
||||||
`
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -323,7 +319,11 @@ func main() {
|
|||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
}
|
}
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if err := bindToJar(*o, flag.Args()...); err != nil {
|
if len(flag.Args()) < 2 || flag.Args()[0] != "build" {
|
||||||
|
flag.Usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
if err := bindToJar(*o, flag.Args()[1:]...); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user