1
0
mirror of https://github.com/golang/go synced 2024-11-11 19:21:37 -07:00

misc/ios: add support for device ids to the exec wrapper

If set, GOIOS_DEVICE_ID specifies the device id for the iOS exec
wrapper. With that, a single builder can host multiple iOS devices.

Change-Id: If3cc049552f5edbd7344befda7b8d7f73b4236e2
Reviewed-on: https://go-review.googlesource.com/57296
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: JBD <jbd@google.com>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
This commit is contained in:
Elias Naur 2017-08-20 18:57:18 +02:00 committed by Chris Broadfoot
parent 3dd1b0d07c
commit 1a2ac46edd

View File

@ -49,6 +49,7 @@ var (
appID string
teamID string
bundleID string
deviceID string
)
// lock is a file lock to serialize iOS runs. It is global to avoid the
@ -77,6 +78,9 @@ func main() {
// https://developer.apple.com/membercenter/index.action#accountSummary as Team ID.
teamID = getenv("GOIOS_TEAM_ID")
// Device IDs as listed with ios-deploy -c.
deviceID = os.Getenv("GOIOS_DEVICE_ID")
parts := strings.SplitN(appID, ".", 2)
// For compatibility with the old builders, use a fallback bundle ID
bundleID = "golang.gotest"
@ -294,7 +298,7 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
if err != nil {
return nil, err
}
s.cmd = exec.Command(
cmdArgs := []string{
// lldb tries to be clever with terminals.
// So we wrap it in script(1) and be clever
// right back at it.
@ -307,9 +311,13 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
"-u",
"-r",
"-n",
`--args=`+strings.Join(args, " ")+``,
`--args=` + strings.Join(args, " ") + ``,
"--bundle", appdir,
)
}
if deviceID != "" {
cmdArgs = append(cmdArgs, "--id", deviceID)
}
s.cmd = exec.Command(cmdArgs[0], cmdArgs[1:]...)
if debug {
log.Println(strings.Join(s.cmd.Args, " "))
}