IOSHelper: fix lime test ios with Xcode 16 or newer
The ios-deploy tool no longer works with new iOS SDKs that don't have DeveloperDiskImage.dmg, but Xcode added new commands that can be used in the terminal to install and launch on connected devices.
This commit is contained in:
@@ -359,21 +359,44 @@ class IOSHelper
|
||||
applicationPath = workingDirectory + "/build/" + configuration + "-iphoneos/" + project.app.file + ".app";
|
||||
}
|
||||
|
||||
var templatePaths = [
|
||||
Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end)
|
||||
].concat(project.templatePaths);
|
||||
var launcher = System.findTemplate(templatePaths, "bin/ios-deploy");
|
||||
Sys.command("chmod", ["+x", launcher]);
|
||||
var xcodeVersion = Std.parseFloat(getXcodeVersion());
|
||||
if (!Math.isNaN(xcodeVersion) && xcodeVersion >= 16) {
|
||||
// ios-deploy doesn't work with newer iOS SDKs where it can't
|
||||
// find DeveloperDiskImage.dmg. however, Xcode 16 adds new
|
||||
// commands for installing and launching apps on connected
|
||||
// devices, so we'll prefer those, if available.
|
||||
var listDevicesOutput = System.runProcess("", "xcrun", ["devicectl", "list", "devices", "--hide-default-columns", "--columns", "Identifier", "--filter", "Platform == 'iOS' AND State == 'connected'"]);
|
||||
var deviceUUID:String = null;
|
||||
var ready = false;
|
||||
for (line in listDevicesOutput.split("\n")) {
|
||||
if (!ready) {
|
||||
ready = StringTools.startsWith(line, "----");
|
||||
continue;
|
||||
}
|
||||
deviceUUID = line;
|
||||
break;
|
||||
}
|
||||
if (deviceUUID == null || deviceUUID.length == 0) {
|
||||
Log.error("No device connected");
|
||||
return;
|
||||
}
|
||||
System.runCommand("", "xcrun", ["devicectl", "device", "install", "app", "--device", deviceUUID, FileSystem.fullPath(applicationPath)]);
|
||||
System.runCommand("", "xcrun", ["devicectl", "device", "process", "launch", "--console", "--device", deviceUUID, project.meta.packageName]);
|
||||
} else {
|
||||
var templatePaths = [
|
||||
Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end)
|
||||
].concat(project.templatePaths);
|
||||
var launcher = System.findTemplate(templatePaths, "bin/ios-deploy");
|
||||
Sys.command("chmod", ["+x", launcher]);
|
||||
|
||||
// var xcodeVersion = getXcodeVersion ();
|
||||
|
||||
System.runCommand("", launcher, [
|
||||
"install",
|
||||
"--noninteractive",
|
||||
"--debug",
|
||||
"--bundle",
|
||||
FileSystem.fullPath(applicationPath)
|
||||
]);
|
||||
System.runCommand("", launcher, [
|
||||
"install",
|
||||
"--noninteractive",
|
||||
"--debug",
|
||||
"--bundle",
|
||||
FileSystem.fullPath(applicationPath)
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user