diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-09-06 00:07:57 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-11-14 23:56:58 +0800 |
commit | 178da7c6a94718389e7192d87df5ee42e7223bc3 (patch) | |
tree | 010f49656b5d1656cf24a4ff9bac35788dd9959f /cmd/abigen | |
parent | d89ea3e6f90c32a97bad58b82a15af0d81f4250e (diff) | |
download | go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar.gz go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar.bz2 go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar.lz go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar.xz go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.tar.zst go-tangerine-178da7c6a94718389e7192d87df5ee42e7223bc3.zip |
mobile: initial wrappers for mobile support
Diffstat (limited to 'cmd/abigen')
-rw-r--r-- | cmd/abigen/main.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 9c9ab6d31..dfbd025da 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -31,14 +31,15 @@ import ( var ( abiFlag = flag.String("abi", "", "Path to the Ethereum contract ABI json to bind") binFlag = flag.String("bin", "", "Path to the Ethereum contract bytecode (generate deploy method)") - typFlag = flag.String("type", "", "Go struct name for the binding (default = package name)") + typFlag = flag.String("type", "", "Struct name for the binding (default = package name)") solFlag = flag.String("sol", "", "Path to the Ethereum contract Solidity source to build and bind") solcFlag = flag.String("solc", "solc", "Solidity compiler to use if source builds are requested") excFlag = flag.String("exc", "", "Comma separated types to exclude from binding") - pkgFlag = flag.String("pkg", "", "Go package name to generate the binding into") - outFlag = flag.String("out", "", "Output file for the generated binding (default = stdout)") + pkgFlag = flag.String("pkg", "", "Package name to generate the binding into") + outFlag = flag.String("out", "", "Output file for the generated binding (default = stdout)") + langFlag = flag.String("lang", "go", "Destination language for the bindings (go, java, objc)") ) func main() { @@ -53,7 +54,19 @@ func main() { os.Exit(-1) } if *pkgFlag == "" { - fmt.Printf("No destination Go package specified (--pkg)\n") + fmt.Printf("No destination package specified (--pkg)\n") + os.Exit(-1) + } + var lang bind.Lang + switch *langFlag { + case "go": + lang = bind.LangGo + case "java": + lang = bind.LangJava + case "objc": + lang = bind.LangObjC + default: + fmt.Printf("Unsupported destination language \"%s\" (--lang)\n", *langFlag) os.Exit(-1) } // If the entire solidity code was specified, build and bind based on that @@ -108,7 +121,7 @@ func main() { types = append(types, kind) } // Generate the contract binding - code, err := bind.Bind(types, abis, bins, *pkgFlag) + code, err := bind.Bind(types, abis, bins, *pkgFlag, lang) if err != nil { fmt.Printf("Failed to generate ABI binding: %v\n", err) os.Exit(-1) |