Skip to content

Commit 1a2ac46

Browse files
Elias Naurbroady
Elias Naur
authored andcommitted
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: JBD <[email protected]> Reviewed-by: Chris Broadfoot <[email protected]>
1 parent 3dd1b0d commit 1a2ac46

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

misc/ios/go_darwin_arm_exec.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var (
4949
appID string
5050
teamID string
5151
bundleID string
52+
deviceID string
5253
)
5354

5455
// lock is a file lock to serialize iOS runs. It is global to avoid the
@@ -77,6 +78,9 @@ func main() {
7778
// https://developer.apple.com/membercenter/index.action#accountSummary as Team ID.
7879
teamID = getenv("GOIOS_TEAM_ID")
7980

81+
// Device IDs as listed with ios-deploy -c.
82+
deviceID = os.Getenv("GOIOS_DEVICE_ID")
83+
8084
parts := strings.SplitN(appID, ".", 2)
8185
// For compatibility with the old builders, use a fallback bundle ID
8286
bundleID = "golang.gotest"
@@ -294,7 +298,7 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
294298
if err != nil {
295299
return nil, err
296300
}
297-
s.cmd = exec.Command(
301+
cmdArgs := []string{
298302
// lldb tries to be clever with terminals.
299303
// So we wrap it in script(1) and be clever
300304
// right back at it.
@@ -307,9 +311,13 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error
307311
"-u",
308312
"-r",
309313
"-n",
310-
`--args=`+strings.Join(args, " ")+``,
314+
`--args=` + strings.Join(args, " ") + ``,
311315
"--bundle", appdir,
312-
)
316+
}
317+
if deviceID != "" {
318+
cmdArgs = append(cmdArgs, "--id", deviceID)
319+
}
320+
s.cmd = exec.Command(cmdArgs[0], cmdArgs[1:]...)
313321
if debug {
314322
log.Println(strings.Join(s.cmd.Args, " "))
315323
}

0 commit comments

Comments
 (0)