Skip to content

Commit 086bb48

Browse files
committed
[androidtestrunner] Add option for the AndroidManifest.xml
Allow specifying path AndroidManifest.xml from command line. Change-Id: I4a2301b98befe32c27602ff63b65aea8a4686123 Reviewed-by: Assam Boudjelthia <[email protected]>
1 parent ea57558 commit 086bb48

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/tools/androidtestrunner/main.cpp

+15-5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct Options
3838
int timeoutSecs = 600; // 10 minutes
3939
int resultsPullRetries = 3;
4040
QString buildPath;
41+
QString manifestPath;
4142
QString adbCommand{"adb"_L1};
4243
QString serial;
4344
QString makeCommand;
@@ -137,6 +138,11 @@ static bool parseOptions()
137138
g_options.helpRequested = true;
138139
else
139140
g_options.buildPath = arguments.at(++i);
141+
} else if (argument.compare("--manifest"_L1, Qt::CaseInsensitive) == 0) {
142+
if (i + 1 == arguments.size())
143+
g_options.helpRequested = true;
144+
else
145+
g_options.manifestPath = arguments.at(++i);
140146
} else if (argument.compare("--make"_L1, Qt::CaseInsensitive) == 0) {
141147
if (i + 1 == arguments.size())
142148
g_options.helpRequested = true;
@@ -208,6 +214,9 @@ static bool parseOptions()
208214
g_options.ndkStackPath = ndkStackPath;
209215
}
210216

217+
if (g_options.manifestPath.isEmpty())
218+
g_options.manifestPath = g_options.buildPath + "/AndroidManifest.xml"_L1;
219+
211220
return true;
212221
}
213222

@@ -254,6 +263,8 @@ static void printHelp()
254263
" --pre-test-adb-command <command>: call the adb <command> after\n"
255264
" installation and before the test run.\n"
256265
"\n"
266+
" --manifest <path>: Custom path to the AndroidManifest.xml.\n"
267+
"\n"
257268
" --help: Displays this information.\n",
258269
qPrintable(QCoreApplication::arguments().at(0))
259270
);
@@ -860,14 +871,13 @@ int main(int argc, char *argv[])
860871

861872
g_testInfo.userId = userId();
862873

863-
QString manifest = g_options.buildPath + "/AndroidManifest.xml"_L1;
864-
if (!QFile::exists(manifest)) {
865-
qCritical("Unable to find '%s'.", qPrintable(manifest));
874+
if (!QFile::exists(g_options.manifestPath)) {
875+
qCritical("Unable to find '%s'.", qPrintable(g_options.manifestPath));
866876
return EXIT_ERROR;
867877
}
868-
g_options.package = packageNameFromAndroidManifest(manifest);
878+
g_options.package = packageNameFromAndroidManifest(g_options.manifestPath);
869879
if (g_options.activity.isEmpty())
870-
g_options.activity = activityFromAndroidManifest(manifest);
880+
g_options.activity = activityFromAndroidManifest(g_options.manifestPath);
871881

872882
// parseTestArgs depends on g_options.package
873883
if (!parseTestArgs())

0 commit comments

Comments
 (0)