Make iostool arguments closer to phonegap ios-deploy.

phonegap's ios-deploy tool is probably the most widely known command
line tool for deploying and debugging iOS applications. Make several
arguments identical to theirs with the eventual goal of making iostool
and ios-deploy command lines interchangeable.

This is a libexec (private) tool only used internally by Qt Creator,
so the changes should not impact anyone.

Change-Id: I51f25f9c466570ca65b415d4ea94c78285cff1c2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Jake Petroules
2015-10-20 00:13:21 -07:00
parent 525c33f999
commit 3fbd210b2a
2 changed files with 30 additions and 29 deletions

View File

@@ -591,9 +591,9 @@ void IosDeviceToolHandlerPrivate::requestTransferApp(const QString &bundlePath,
this->bundlePath = bundlePath; this->bundlePath = bundlePath;
this->deviceId = deviceId; this->deviceId = deviceId;
QStringList args; QStringList args;
args << QLatin1String("-device-id") << deviceId << QLatin1String("-bundle") args << QLatin1String("--id") << deviceId << QLatin1String("--bundle")
<< bundlePath << QLatin1String("-timeout") << QString::number(timeout) << bundlePath << QLatin1String("--timeout") << QString::number(timeout)
<< QLatin1String("-deploy"); << QLatin1String("--install");
start(IosToolHandler::iosDeviceToolPath(), args); start(IosToolHandler::iosDeviceToolPath(), args);
} }
@@ -606,18 +606,17 @@ void IosDeviceToolHandlerPrivate::requestRunApp(const QString &bundlePath,
this->deviceId = deviceId; this->deviceId = deviceId;
this->runKind = runType; this->runKind = runType;
QStringList args; QStringList args;
args << QLatin1String("-device-id") << deviceId << QLatin1String("-bundle") args << QLatin1String("--id") << deviceId << QLatin1String("--bundle")
<< bundlePath << QLatin1String("-timeout") << QString::number(timeout); << bundlePath << QLatin1String("--timeout") << QString::number(timeout);
//args << QLatin1String("--deploy"); // to remove when the separate deploy step is functional
switch (runType) { switch (runType) {
case IosToolHandler::NormalRun: case IosToolHandler::NormalRun:
args << QLatin1String("-run"); args << QLatin1String("--run");
break; break;
case IosToolHandler::DebugRun: case IosToolHandler::DebugRun:
args << QLatin1String("-debug"); args << QLatin1String("--debug");
break; break;
} }
args << QLatin1String("-extra-args") << extraArgs; args << QLatin1String("--args") << extraArgs;
op = OpAppRun; op = OpAppRun;
start(IosToolHandler::iosDeviceToolPath(), args); start(IosToolHandler::iosDeviceToolPath(), args);
} }
@@ -626,8 +625,8 @@ void IosDeviceToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, int
{ {
this->deviceId = deviceId; this->deviceId = deviceId;
QStringList args; QStringList args;
args << QLatin1String("-device-id") << deviceId << QLatin1String("-device-info") args << QLatin1String("--id") << deviceId << QLatin1String("--device-info")
<< QLatin1String("-timeout") << QString::number(timeout); << QLatin1String("--timeout") << QString::number(timeout);
op = OpDeviceInfo; op = OpDeviceInfo;
start(IosToolHandler::iosDeviceToolPath(), args); start(IosToolHandler::iosDeviceToolPath(), args);
} }

View File

@@ -531,34 +531,36 @@ void IosTool::run(const QStringList &args)
out.writeStartElement(QLatin1String("query_result")); out.writeStartElement(QLatin1String("query_result"));
for (int iarg = 1; iarg < args.size(); ++iarg) { for (int iarg = 1; iarg < args.size(); ++iarg) {
const QString &arg = args[iarg]; const QString &arg = args[iarg];
if (arg == QLatin1String("-device-id")) { if (arg == QLatin1String("-i") || arg == QLatin1String("--id")) {
if (++iarg == args.size()) { if (++iarg == args.size()) {
writeMsg("missing device id value after -device-id"); writeMsg(QStringLiteral("missing device id value after ") + arg);
printHelp = true; printHelp = true;
} }
deviceId = args.value(iarg); deviceId = args.value(iarg);
} else if (arg == QLatin1String("-bundle")) { } else if (arg == QLatin1String("-b") || arg == QLatin1String("--bundle")) {
if (++iarg == args.size()) { if (++iarg == args.size()) {
writeMsg("missing bundle path after -bundle"); writeMsg(QStringLiteral("missing bundle path after ") + arg);
printHelp = true; printHelp = true;
} }
bundlePath = args.value(iarg); bundlePath = args.value(iarg);
} else if (arg == QLatin1String("-deploy")) { } else if (arg == QLatin1String("--install")) {
appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Install); appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Install);
} else if (arg == QLatin1String("-run")) { } else if (arg == QLatin1String("--run")) {
appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Run); appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Run);
} else if (arg == QLatin1String("-ipv6")) { } else if (arg == QLatin1String("--noninteractive")) {
// ignored for compatibility
} else if (arg == QLatin1String("--ipv6")) {
ipv6 = true; ipv6 = true;
} else if (arg == QLatin1String("-verbose")) { } else if (arg == QLatin1String("-v") || arg == QLatin1String("--verbose")) {
echoRelays = true; echoRelays = true;
} else if (arg == QLatin1String("-debug")) { } else if (arg == QLatin1String("-d") || arg == QLatin1String("--debug")) {
appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Run); appOp = Ios::IosDeviceManager::AppOp(appOp | Ios::IosDeviceManager::Run);
debug = true; debug = true;
} else if (arg == QLatin1String("-device-info")) { } else if (arg == QLatin1String("--device-info")) {
deviceInfo = true; deviceInfo = true;
} else if (arg == QLatin1String("-timeout")) { } else if (arg == QLatin1String("-t") || arg == QLatin1String("--timeout")) {
if (++iarg == args.size()) { if (++iarg == args.size()) {
writeMsg("missing timeout value after -timeout"); writeMsg(QStringLiteral("missing timeout value after ") + arg);
printHelp = true; printHelp = true;
} }
bool ok = false; bool ok = false;
@@ -569,10 +571,10 @@ void IosTool::run(const QStringList &args)
writeMsg("timeout value should be an integer"); writeMsg("timeout value should be an integer");
printHelp = true; printHelp = true;
} }
} else if (arg == QLatin1String("-extra-args")) { } else if (arg == QLatin1String("-a") || arg == QLatin1String("--args")) {
extraArgs = args.mid(iarg + 1, args.size() - iarg - 1); extraArgs = args.mid(iarg + 1, args.size() - iarg - 1);
iarg = args.size(); iarg = args.size();
} else if (arg == QLatin1String("-help") || arg == QLatin1String("--help")) { } else if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) {
printHelp = true; printHelp = true;
} else { } else {
writeMsg(QString::fromLatin1("unexpected argument \"%1\"").arg(arg)); writeMsg(QString::fromLatin1("unexpected argument \"%1\"").arg(arg));
@@ -580,9 +582,9 @@ void IosTool::run(const QStringList &args)
} }
if (printHelp) { if (printHelp) {
out.writeStartElement(QLatin1String("msg")); out.writeStartElement(QLatin1String("msg"));
out.writeCharacters(QLatin1String("iosTool [-device-id <deviceId>] [-bundle <pathToBundle>] [-deploy] [-run] [-debug]\n")); out.writeCharacters(QLatin1String("iostool [--id <device_id>] [--bundle <bundle.app>] [--install] [--run] [--debug]\n"));
out.writeCharacters(QLatin1String(" [-device-info] [-timeout <timeoutIn_ms>] [-verbose]\n")); // to do pass in env as stub does out.writeCharacters(QLatin1String(" [--device-info] [--timeout <timeout_in_ms>] [--verbose]\n")); // to do pass in env as stub does
out.writeCharacters(QLatin1String(" [-extra-args <arguments for the target app>]")); out.writeCharacters(QLatin1String(" [--args <arguments for the target app>]"));
out.writeEndElement(); out.writeEndElement();
doExit(-1); doExit(-1);
return; return;
@@ -611,7 +613,7 @@ void IosTool::run(const QStringList &args)
} }
if (deviceInfo) { if (deviceInfo) {
if (!bundlePath.isEmpty()) if (!bundlePath.isEmpty())
writeMsg("-device-info overrides bundlePath"); writeMsg("--device-info overrides --bundle");
++opLeft; ++opLeft;
manager->requestDeviceInfo(deviceId, timeout); manager->requestDeviceInfo(deviceId, timeout);
} else if (!bundlePath.isEmpty()) { } else if (!bundlePath.isEmpty()) {