Commit 1a2ac46e authored by Elias Naur's avatar Elias Naur Committed by Chris Broadfoot

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: default avatarJBD <jbd@google.com>
Reviewed-by: default avatarChris Broadfoot <cbro@golang.org>
parent 3dd1b0d0
...@@ -49,6 +49,7 @@ var ( ...@@ -49,6 +49,7 @@ var (
appID string appID string
teamID string teamID string
bundleID string bundleID string
deviceID string
) )
// lock is a file lock to serialize iOS runs. It is global to avoid the // lock is a file lock to serialize iOS runs. It is global to avoid the
...@@ -77,6 +78,9 @@ func main() { ...@@ -77,6 +78,9 @@ func main() {
// https://developer.apple.com/membercenter/index.action#accountSummary as Team ID. // https://developer.apple.com/membercenter/index.action#accountSummary as Team ID.
teamID = getenv("GOIOS_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) parts := strings.SplitN(appID, ".", 2)
// For compatibility with the old builders, use a fallback bundle ID // For compatibility with the old builders, use a fallback bundle ID
bundleID = "golang.gotest" bundleID = "golang.gotest"
...@@ -294,7 +298,7 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error ...@@ -294,7 +298,7 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
if err != nil { if err != nil {
return nil, err return nil, err
} }
s.cmd = exec.Command( cmdArgs := []string{
// lldb tries to be clever with terminals. // lldb tries to be clever with terminals.
// So we wrap it in script(1) and be clever // So we wrap it in script(1) and be clever
// right back at it. // right back at it.
...@@ -307,9 +311,13 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error ...@@ -307,9 +311,13 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
"-u", "-u",
"-r", "-r",
"-n", "-n",
`--args=`+strings.Join(args, " ")+``, `--args=` + strings.Join(args, " ") + ``,
"--bundle", appdir, "--bundle", appdir,
) }
if deviceID != "" {
cmdArgs = append(cmdArgs, "--id", deviceID)
}
s.cmd = exec.Command(cmdArgs[0], cmdArgs[1:]...)
if debug { if debug {
log.Println(strings.Join(s.cmd.Args, " ")) log.Println(strings.Join(s.cmd.Args, " "))
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment