macdeployqt: Treat argument parsing errors as fatal
Passing options such as `-codesign` or `-fs` without an additional argument would just print an error, but proceed with deployment, giving the user an app bundle that didn't reflect the intent of passing the command line options. We now treat such errors as fatal. Change-Id: Iff1b3fac3eb8defadea0425dc13996ed80fe3840 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 58615c066707d0c3592e79b5a03f1330e28c64b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
67b3c40ae2
commit
1364db690a
@ -100,39 +100,49 @@ int main(int argc, char **argv)
|
|||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int number = argument.mid(index+1).toInt(&ok);
|
int number = argument.mid(index+1).toInt(&ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
LogError() << "Could not parse verbose level";
|
LogError() << "Could not parse verbose level";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
logLevel = number;
|
logLevel = number;
|
||||||
|
}
|
||||||
} else if (argument.startsWith(QByteArray("-executable"))) {
|
} else if (argument.startsWith(QByteArray("-executable"))) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf('=');
|
int index = argument.indexOf('=');
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
LogError() << "Missing executable path";
|
LogError() << "Missing executable path";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
additionalExecutables << argument.mid(index+1);
|
additionalExecutables << argument.mid(index+1);
|
||||||
|
}
|
||||||
} else if (argument.startsWith(QByteArray("-qmldir"))) {
|
} else if (argument.startsWith(QByteArray("-qmldir"))) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
qmldirArgumentUsed = true;
|
qmldirArgumentUsed = true;
|
||||||
int index = argument.indexOf('=');
|
int index = argument.indexOf('=');
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
LogError() << "Missing qml directory path";
|
LogError() << "Missing qml directory path";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
qmlDirs << argument.mid(index+1);
|
qmlDirs << argument.mid(index+1);
|
||||||
|
}
|
||||||
} else if (argument.startsWith(QByteArray("-qmlimport"))) {
|
} else if (argument.startsWith(QByteArray("-qmlimport"))) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf('=');
|
int index = argument.indexOf('=');
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
LogError() << "Missing qml import path";
|
LogError() << "Missing qml import path";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
qmlImportPaths << argument.mid(index+1);
|
qmlImportPaths << argument.mid(index+1);
|
||||||
|
}
|
||||||
} else if (argument.startsWith(QByteArray("-libpath"))) {
|
} else if (argument.startsWith(QByteArray("-libpath"))) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf('=');
|
int index = argument.indexOf('=');
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
LogError() << "Missing library search path";
|
LogError() << "Missing library search path";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
librarySearchPath << argument.mid(index+1);
|
librarySearchPath << argument.mid(index+1);
|
||||||
|
}
|
||||||
} else if (argument == QByteArray("-always-overwrite")) {
|
} else if (argument == QByteArray("-always-overwrite")) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
alwaysOwerwriteEnabled = true;
|
alwaysOwerwriteEnabled = true;
|
||||||
@ -141,6 +151,7 @@ int main(int argc, char **argv)
|
|||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
if (index < 0 || index >= argument.size()) {
|
if (index < 0 || index >= argument.size()) {
|
||||||
LogError() << "Missing code signing identity";
|
LogError() << "Missing code signing identity";
|
||||||
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
runCodesign = true;
|
runCodesign = true;
|
||||||
codesignIdentiy = argument.mid(index+1);
|
codesignIdentiy = argument.mid(index+1);
|
||||||
@ -150,6 +161,7 @@ int main(int argc, char **argv)
|
|||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
if (index < 0 || index >= argument.size()) {
|
if (index < 0 || index >= argument.size()) {
|
||||||
LogError() << "Missing code signing identity";
|
LogError() << "Missing code signing identity";
|
||||||
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
runCodesign = true;
|
runCodesign = true;
|
||||||
hardenedRuntime = true;
|
hardenedRuntime = true;
|
||||||
@ -174,10 +186,12 @@ int main(int argc, char **argv)
|
|||||||
} else if (argument.startsWith(QByteArray("-fs"))) {
|
} else if (argument.startsWith(QByteArray("-fs"))) {
|
||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf('=');
|
int index = argument.indexOf('=');
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
LogError() << "Missing filesystem type";
|
LogError() << "Missing filesystem type";
|
||||||
else
|
return 1;
|
||||||
|
} else {
|
||||||
filesystem = argument.mid(index+1);
|
filesystem = argument.mid(index+1);
|
||||||
|
}
|
||||||
} else if (argument.startsWith("-")) {
|
} else if (argument.startsWith("-")) {
|
||||||
LogError() << "Unknown argument" << argument << "\n";
|
LogError() << "Unknown argument" << argument << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user