Bug 1050708 buildid no longer being set on Thunderbird comm-central builds - port to use application.ini.h to load and avoid the previous work arounds. r=pending-review-from-jcranmer-for-mainly-build-system-peer-port. CLOSED TREE

This commit is contained in:
Mark Banner 2014-08-08 22:41:05 +01:00
Родитель 9f9d754eee
Коммит c881e74fe3
5 изменённых файлов: 83 добавлений и 55 удалений

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

@ -46,8 +46,6 @@ include $(topsrcdir)/config/rules.mk
else
# Build a binary bootstrapping with XRE_main
DIST_FILES = application.ini
DEFINES += -DXPCOM_GLUE
STL_FLAGS=

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

@ -1,30 +0,0 @@
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
#filter substitution
[App]
Name=Thunderbird
Version=@APP_VERSION@
BuildID=@GRE_BUILDID@
#ifdef MOZ_SOURCE_REPO
SourceRepository=@MOZ_SOURCE_REPO@
#endif
#ifdef MOZ_SOURCE_STAMP
SourceStamp=@MOZ_SOURCE_STAMP@
#endif
ID={3550f703-e582-4d05-9a08-453d09bdfdc6}
[Gecko]
MinVersion=@GRE_MILESTONE@
MaxVersion=@GRE_MILESTONE@
[XRE]
EnableProfileMigrator=1
EnableExtensionManager=1
[Crash Reporter]
#if MOZILLA_OFFICIAL
Enabled=1
#endif
ServerURL=https://crash-reports.mozilla.com/submit

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

@ -5,6 +5,10 @@
DIRS += ['profile']
GENERATED_INCLUDES += [
'/build',
]
if not CONFIG['LIBXUL_SDK']:
PROGRAM = CONFIG['MOZ_APP_NAME']
SOURCES += ['nsMailApp.cpp']

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

@ -5,6 +5,8 @@
#include "nsXPCOMGlue.h"
#include "nsXULAppAPI.h"
#include "mozilla/AppData.h"
#include "application.ini.h"
#if defined(XP_WIN)
#include <windows.h>
#include <stdlib.h>
@ -37,6 +39,8 @@
#include "mozilla/Telemetry.h"
#include "mozilla/WindowsDllBlocklist.h"
using namespace mozilla;
static void Output(const char *fmt, ... )
{
va_list ap;
@ -77,6 +81,26 @@ static void Output(const char *fmt, ... )
va_end(ap);
}
/**
* Return true if |arg| matches the given argument name.
*/
static bool IsArg(const char* arg, const char* s)
{
if (*arg == '-')
{
if (*++arg == '-')
++arg;
return !strcasecmp(arg, s);
}
#if defined(XP_WIN)
if (*arg == '/')
return !strcasecmp(++arg, s);
#endif
return false;
}
XRE_GetFileFromPathType XRE_GetFileFromPath;
XRE_CreateAppDataType XRE_CreateAppData;
XRE_FreeAppDataType XRE_FreeAppData;
@ -94,34 +118,65 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
static int do_main(const char *exePath, int argc, char* argv[])
{
nsCOMPtr<nsIFile> appini;
NS_LogInit();
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
getter_AddRefs(appini));
#else
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
getter_AddRefs(appini));
#endif
if (NS_FAILED(rv)) {
return 255;
nsCOMPtr<nsIFile> appini;
nsresult rv;
uint32_t mainFlags = 0;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("Invalid path found: '%s'", appDataFile);
return 255;
}
}
else if (argc > 1 && IsArg(argv[1], "app")) {
if (argc == 2) {
Output("Incorrect number of arguments passed to -app");
return 255;
}
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("application.ini path not recognized: '%s'", argv[2]);
return 255;
}
char appEnv[MAXPATHLEN];
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
if (putenv(appEnv)) {
Output("Couldn't set %s.\n", appEnv);
return 255;
}
argv[2] = argv[0];
argv += 2;
argc -= 2;
}
appini->AppendNative(NS_LITERAL_CSTRING("application.ini"));
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
if (NS_FAILED(rv)) {
Output("Couldn't read application.ini");
return 255;
int result;
if (appini) {
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
if (NS_FAILED(rv)) {
Output("Couldn't read application.ini");
return 255;
}
result = XRE_main(argc, argv, appData, 0);
XRE_FreeAppData(appData);
} else {
ScopedAppData appData(&sAppData);
nsCOMPtr<nsIFile> exeFile;
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
if (NS_FAILED(rv)) {
Output("Couldn't find the application directory.\n");
return 255;
}
result = XRE_main(argc, argv, &appData, mainFlags);
}
int result = XRE_main(argc, argv, appData, 0);
XRE_FreeAppData(appData);
return result;
}

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

@ -7,6 +7,7 @@ MOZ_APP_BASENAME=Thunderbird
MOZ_APP_NAME=thunderbird
MOZ_UPDATER=1
MOZ_THUNDERBIRD=1
MOZ_APP_STATIC_INI=1
MOZ_CHROME_FILE_FORMAT=omni
MOZ_NO_ACTIVEX_SUPPORT=1
MOZ_ACTIVEX_SCRIPTING_SUPPORT=