Bug 1628709 - add --full-version r=mossop

This patch adds --full-version, which returns the build
and platform build ids alongside what --version returns

Differential Revision: https://phabricator.services.mozilla.com/D70370

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tarek Ziadé 2020-04-09 16:16:24 +00:00
Родитель a38a0f26de
Коммит 13d0ebffc8
1 изменённых файлов: 27 добавлений и 2 удалений

Просмотреть файл

@ -1427,6 +1427,7 @@ static void DumpHelp() {
printf(
" -h or --help Print this message.\n"
" -v or --version Print %s version.\n"
" --full-version Print %s version, build and platform build ids.\n"
" -P <profile> Start with <profile>.\n"
" --profile <path> Start with profile at <path>.\n"
" --migration Start with migration wizard.\n"
@ -1452,7 +1453,7 @@ static void DumpHelp() {
" argument or as an environment variable, logging "
"will be\n"
" written to stdout.\n",
(const char*)gAppData->name);
(const char*)gAppData->name, (const char*)gAppData->name);
#if defined(XP_WIN)
printf(" --console Start %s with a debugging console.\n",
@ -1485,6 +1486,24 @@ static inline void DumpVersion() {
printf("\n");
}
static inline void DumpFullVersion() {
if (gAppData->vendor) {
printf("%s ", (const char*)gAppData->vendor);
}
printf("%s ", (const char*)gAppData->name);
// Use the displayed version
// For example, for beta, we would display 42.0b2 instead of 42.0
printf("%s ", MOZ_STRINGIFY(MOZ_APP_VERSION_DISPLAY));
printf("%s ", (const char*)gAppData->buildID);
printf("%s ", (const char*)PlatformBuildID());
if (gAppData->copyright) {
printf(", %s", (const char*)gAppData->copyright);
}
printf("\n");
}
void XRE_InitOmnijar(nsIFile* greOmni, nsIFile* appOmni) {
mozilla::Omnijar::Init(greOmni, appOmni);
}
@ -3479,7 +3498,7 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
mStartOffline = true;
}
// Handle --help and --version command line arguments.
// Handle --help, --full-version and --version command line arguments.
// They should return quickly, so we deal with them here.
if (CheckArg("h") || CheckArg("help") || CheckArg("?")) {
DumpHelp();
@ -3493,6 +3512,12 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
return 0;
}
if (CheckArg("full-version")) {
DumpFullVersion();
*aExitFlag = true;
return 0;
}
rv = XRE_InitCommandLine(gArgc, gArgv);
NS_ENSURE_SUCCESS(rv, 1);