Improve iOS simulator behavior
This commit is contained in:
@@ -263,26 +263,21 @@ class IOSHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessHelper.runCommand ("", "open", [ "-a", "Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ], true, true);
|
try {
|
||||||
ProcessHelper.runCommand ("", "open", [ "-a", "iOS Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ], true, true);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
|
|
||||||
output = ProcessHelper.runProcess ("", "xcrun", [ "simctl", "install", currentDeviceID, applicationPath ], true, true, true);
|
ProcessHelper.runProcess ("", "open", [ "-Ra", "iOS Simulator" ], true, false);
|
||||||
|
ProcessHelper.runCommand ("", "open", [ "-a", "iOS Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ]);
|
||||||
|
|
||||||
if (output != null && output.toLowerCase ().indexOf ("invalid device state") > -1) {
|
} catch (e:Dynamic) {
|
||||||
|
|
||||||
Sys.sleep (3);
|
ProcessHelper.runCommand ("", "open", [ "-a", "Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ]);
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessHelper.runProcess ("", "xcrun", [ "simctl", "launch", currentDeviceID, project.meta.packageName ]);
|
waitForDeviceState ("xcrun", [ "simctl", "uninstall", currentDeviceID, project.meta.packageName ]);
|
||||||
|
waitForDeviceState ("xcrun", [ "simctl", "install", currentDeviceID, applicationPath ]);
|
||||||
|
waitForDeviceState ("xcrun", [ "simctl", "launch", currentDeviceID, project.meta.packageName ]);
|
||||||
|
|
||||||
ProcessHelper.runCommand ("", "tail", [ "-f", "~/Library/Logs/CoreSimulator/" + currentDeviceID + "/system.log"]);
|
ProcessHelper.runCommand ("", "tail", [ "-f", "~/Library/Logs/CoreSimulator/" + currentDeviceID + "/system.log"]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -349,4 +344,27 @@ class IOSHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function waitForDeviceState (command:String, args:Array<String>):Void {
|
||||||
|
|
||||||
|
var output;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
output = ProcessHelper.runProcess ("", command, args, true, true, true);
|
||||||
|
|
||||||
|
if (output != null && output.toLowerCase ().indexOf ("invalid device state") > -1) {
|
||||||
|
|
||||||
|
Sys.sleep (3);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ class ProcessHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _runProcess (path, command, args, waitForOutput, ignoreErrors);
|
return _runProcess (path, command, args, waitForOutput, safeExecute, ignoreErrors);
|
||||||
|
|
||||||
} catch (e:Dynamic) {
|
} catch (e:Dynamic) {
|
||||||
|
|
||||||
@@ -300,14 +300,14 @@ class ProcessHelper {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return _runProcess (path, command, args, waitForOutput, ignoreErrors);
|
return _runProcess (path, command, args, waitForOutput, safeExecute, ignoreErrors);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _runProcess (path:String, command:String, args:Array<String>, waitForOutput:Bool, ignoreErrors:Bool):String {
|
private static function _runProcess (path:String, command:String, args:Array<String>, waitForOutput:Bool, safeExecute:Bool, ignoreErrors:Bool):String {
|
||||||
|
|
||||||
var oldPath:String = "";
|
var oldPath:String = "";
|
||||||
|
|
||||||
@@ -390,6 +390,10 @@ class ProcessHelper {
|
|||||||
|
|
||||||
output = error;
|
output = error;
|
||||||
|
|
||||||
|
} else if (!safeExecute) {
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
LogHelper.error (error);
|
LogHelper.error (error);
|
||||||
|
|||||||
Reference in New Issue
Block a user