2
0
mirror of synced 2025-02-22 14:28:14 +00:00

cmd/gomobile: install should fail for target!=android

Change-Id: I1c21e7aab2b283927e732a5ec8420b4c36cfae91
Reviewed-on: https://go-review.googlesource.com/12090
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Burcu Dogan 2015-07-11 11:55:10 -07:00
parent c8fe70554f
commit ac3e8010d5
2 changed files with 11 additions and 3 deletions

View File

@ -27,7 +27,7 @@ Commands:
bind build a shared library for android APK and iOS app
build compile android APK and iOS app
init install android compiler toolchain
install compile android APK and iOS app and install on device
install compile android APK and install on device
Use 'gomobile help [command]' for more information about that command.
@ -117,7 +117,7 @@ The -u option forces download and installation of the new toolchain
even when the toolchain exists.
Compile android APK and iOS app and install on device
Compile android APK and install on device
Usage:

View File

@ -5,16 +5,18 @@
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
var cmdInstall = &command{
run: runInstall,
Name: "install",
Usage: "[-target android] [build flags] [package]",
Short: "compile android APK and iOS app and install on device",
Short: "compile android APK and install on device",
Long: `
Install compiles and installs the app named by the import path on the
attached mobile device.
@ -27,6 +29,9 @@ For documentation, see 'go help build'.
}
func runInstall(cmd *command) error {
if buildTarget != "android" {
return fmt.Errorf("install is not supported for -target=%s", buildTarget)
}
if err := runBuild(cmd); err != nil {
return err
}
@ -36,6 +41,9 @@ func runInstall(cmd *command) error {
`-r`,
filepath.Base(pkg.Dir)+`.apk`,
)
if buildX {
printcmd("%s", strings.Join(install.Args, " "))
}
if buildV {
install.Stdout = os.Stdout
install.Stderr = os.Stderr