diff options
| author | ruki <[email protected]> | 2020-11-14 00:33:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-14 00:33:14 +0800 |
| commit | 3c879da3a536d4f113731bde1f5f8c6cb56a7509 (patch) | |
| tree | 1685d79838fc99093bdd1460d7640f61c7be0356 /xmake/rules/xcode/application/run.lua | |
| parent | 6fa502e50701669acd7af26797ce1beade3207e2 (diff) | |
improve run iosapp on simulator
Diffstat (limited to 'xmake/rules/xcode/application/run.lua')
| -rw-r--r-- | xmake/rules/xcode/application/run.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xmake/rules/xcode/application/run.lua b/xmake/rules/xcode/application/run.lua index d9a25e4a5..19bbf9b85 100644 --- a/xmake/rules/xcode/application/run.lua +++ b/xmake/rules/xcode/application/run.lua @@ -65,25 +65,23 @@ function _run_on_simulator(target, opt) assert(list, "simulator devices not found!") -- find the booted devices - local devices = {} + local name, deviceid for _, line in ipairs(list:split('\n', {plain = true})) do if line:find("(Booted)", 1, true) then line = line:trim() - local name, deviceid = line:match("(.-)%s+%(([%w%-]+)%)") + name, deviceid = line:match("(.-)%s+%(([%w%-]+)%)") if name and deviceid then - devices[name] = deviceid + break end end end + assert(name and deviceid, "booted simulator devices not found!") -- do launch on first simulator device local bundle_identifier = target:values("xcode.bundle_identifier") or get_config("xcode_bundle_identifier") or "io.xmake." .. target:name() if bundle_identifier then - for name, deviceid in pairs(devices) do - print("running %s application on %s (%s) ..", target:name(), name, deviceid) - os.execv("xcrun", {"simctl", "launch", "--console", deviceid, bundle_identifier}) - break - end + print("running %s application on %s (%s) ..", target:name(), name, deviceid) + os.execv("xcrun", {"simctl", "launch", "--console", deviceid, bundle_identifier}) end end |
