[androidtestrunner] Add option for the AndroidManifest.xml
Allow specifying path AndroidManifest.xml from command line. Change-Id: I4a2301b98befe32c27602ff63b65aea8a4686123 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
ea575585e7
commit
086bb48768
@ -38,6 +38,7 @@ struct Options
|
|||||||
int timeoutSecs = 600; // 10 minutes
|
int timeoutSecs = 600; // 10 minutes
|
||||||
int resultsPullRetries = 3;
|
int resultsPullRetries = 3;
|
||||||
QString buildPath;
|
QString buildPath;
|
||||||
|
QString manifestPath;
|
||||||
QString adbCommand{"adb"_L1};
|
QString adbCommand{"adb"_L1};
|
||||||
QString serial;
|
QString serial;
|
||||||
QString makeCommand;
|
QString makeCommand;
|
||||||
@ -137,6 +138,11 @@ static bool parseOptions()
|
|||||||
g_options.helpRequested = true;
|
g_options.helpRequested = true;
|
||||||
else
|
else
|
||||||
g_options.buildPath = arguments.at(++i);
|
g_options.buildPath = arguments.at(++i);
|
||||||
|
} else if (argument.compare("--manifest"_L1, Qt::CaseInsensitive) == 0) {
|
||||||
|
if (i + 1 == arguments.size())
|
||||||
|
g_options.helpRequested = true;
|
||||||
|
else
|
||||||
|
g_options.manifestPath = arguments.at(++i);
|
||||||
} else if (argument.compare("--make"_L1, Qt::CaseInsensitive) == 0) {
|
} else if (argument.compare("--make"_L1, Qt::CaseInsensitive) == 0) {
|
||||||
if (i + 1 == arguments.size())
|
if (i + 1 == arguments.size())
|
||||||
g_options.helpRequested = true;
|
g_options.helpRequested = true;
|
||||||
@ -208,6 +214,9 @@ static bool parseOptions()
|
|||||||
g_options.ndkStackPath = ndkStackPath;
|
g_options.ndkStackPath = ndkStackPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_options.manifestPath.isEmpty())
|
||||||
|
g_options.manifestPath = g_options.buildPath + "/AndroidManifest.xml"_L1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +263,8 @@ static void printHelp()
|
|||||||
" --pre-test-adb-command <command>: call the adb <command> after\n"
|
" --pre-test-adb-command <command>: call the adb <command> after\n"
|
||||||
" installation and before the test run.\n"
|
" installation and before the test run.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" --manifest <path>: Custom path to the AndroidManifest.xml.\n"
|
||||||
|
"\n"
|
||||||
" --help: Displays this information.\n",
|
" --help: Displays this information.\n",
|
||||||
qPrintable(QCoreApplication::arguments().at(0))
|
qPrintable(QCoreApplication::arguments().at(0))
|
||||||
);
|
);
|
||||||
@ -860,14 +871,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
g_testInfo.userId = userId();
|
g_testInfo.userId = userId();
|
||||||
|
|
||||||
QString manifest = g_options.buildPath + "/AndroidManifest.xml"_L1;
|
if (!QFile::exists(g_options.manifestPath)) {
|
||||||
if (!QFile::exists(manifest)) {
|
qCritical("Unable to find '%s'.", qPrintable(g_options.manifestPath));
|
||||||
qCritical("Unable to find '%s'.", qPrintable(manifest));
|
|
||||||
return EXIT_ERROR;
|
return EXIT_ERROR;
|
||||||
}
|
}
|
||||||
g_options.package = packageNameFromAndroidManifest(manifest);
|
g_options.package = packageNameFromAndroidManifest(g_options.manifestPath);
|
||||||
if (g_options.activity.isEmpty())
|
if (g_options.activity.isEmpty())
|
||||||
g_options.activity = activityFromAndroidManifest(manifest);
|
g_options.activity = activityFromAndroidManifest(g_options.manifestPath);
|
||||||
|
|
||||||
// parseTestArgs depends on g_options.package
|
// parseTestArgs depends on g_options.package
|
||||||
if (!parseTestArgs())
|
if (!parseTestArgs())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user