I'm trying to pass the mobile deviceId to a flutter preLaunchTask. Minimal sample below, but ultimately it's a simctl script that uses booted as the device id. However, this breaks down when I have multiple simulator devices booted, so I'm trying to explicitly run the preLaunch script with the target device.
Does someone know how to do this? I've tried almost everything I could think of with variable substitution and environment variables (printenv shows nothing useful), but I can't find any hook into deviceId. It should be the same parameter passed to the -d argument. Caveat: I can't use an explicit deviceId in the launch config because the config is checked in and shared with others, and we all use various versions of devices and Xcode.
Can you help? :/
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Test My Shtuff",
"type": "dart",
"request": "launch",
"flutterMode": "debug",
"program": "./integration_test/",
"templateFor": "./integration_test/",
"preLaunchTask": "Thing that needs deviceId",
},
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Thing that needs deviceId",
"type": "shell",
"command": "echo $DEVICE_ID", // <-- what do?
},
]
}
I'm trying to pass the mobile deviceId to a flutter
preLaunchTask. Minimal sample below, but ultimately it's asimctlscript that usesbootedas the device id. However, this breaks down when I have multiple simulator devices booted, so I'm trying to explicitly run the preLaunch script with the target device.Does someone know how to do this? I've tried almost everything I could think of with variable substitution and environment variables (
printenvshows nothing useful), but I can't find any hook intodeviceId. It should be the same parameter passed to the-dargument. Caveat: I can't use an explicitdeviceIdin the launch config because the config is checked in and shared with others, and we all use various versions of devices and Xcode.Can you help? :/
launch.json{ "version": "0.2.0", "configurations": [ { "name": "Test My Shtuff", "type": "dart", "request": "launch", "flutterMode": "debug", "program": "./integration_test/", "templateFor": "./integration_test/", "preLaunchTask": "Thing that needs deviceId", }, ] }tasks.json{ "version": "2.0.0", "tasks": [ { "label": "Thing that needs deviceId", "type": "shell", "command": "echo $DEVICE_ID", // <-- what do? }, ] }