2
0
mirror of synced 2025-02-23 23:08:14 +00:00
mobile/cmd/gobind/main.go
Hyang-Ah (Hana) Kim 26f6ffe0b5 cmd/gobind: add experimental, objective-C code generation option.
Change-Id: Ia0e66ee0964bd40d868261994f7cb70260f3cbe9
Reviewed-on: https://go-review.googlesource.com/10841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-10 00:14:20 +00:00

49 lines
994 B
Go

// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"go/build"
"log"
"os"
)
var (
lang = flag.String("lang", "java", "target language for bindings, either java, go, or objc (experimental).")
outdir = flag.String("outdir", "", "result will be written to the directory instead of stdout.")
)
var usage = `The Gobind tool generates Java language bindings for Go.
For usage details, see doc.go.`
func main() {
flag.Parse()
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
for _, arg := range flag.Args() {
pkg, err := build.Import(arg, cwd, 0)
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %v\n", arg, err)
os.Exit(1)
}
genPkg(pkg)
}
os.Exit(exitStatus)
}
var exitStatus = 0
func errorf(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...)
fmt.Fprintln(os.Stderr)
exitStatus = 1
}