mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1551639 - Always update buildid but avoid rebuilding libxul. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D33772 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
4725fa3b70
commit
6f6e8cbd72
@ -38,19 +38,12 @@ DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
||||
.mozconfig.mk
|
||||
|
||||
ifndef MOZ_PROFILE_USE
|
||||
# Automation builds should always have a new buildid, but for the sake of not
|
||||
# re-linking libxul on every incremental build we do not enforce this for
|
||||
# developer builds. Tests always need a new buildid as well.
|
||||
ifneq (,$(MOZ_AUTOMATION)$(MOZ_BUILD_DATE)$(TEST_MOZBUILD))
|
||||
ifneq (mobile/android,$(MOZ_BUILD_APP))
|
||||
$(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
|
||||
endif
|
||||
# Additionally, provide a dummy target during tests, because
|
||||
# faster/rules.mk will expect these targets to exist.
|
||||
ifdef TEST_MOZBUILD
|
||||
source-repo.h: $(MDDEPDIR)/source-repo.h.stub
|
||||
buildid.h: $(MDDEPDIR)/buildid.h.stub
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
|
||||
|
||||
|
34
toolkit/library/gen_buildid.py
Normal file
34
toolkit/library/gen_buildid.py
Normal file
@ -0,0 +1,34 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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 distibuted with this
|
||||
# file, You can obtain one at http://mozilla.og/MPL/2.0/.
|
||||
|
||||
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
from io import StringIO
|
||||
import buildconfig
|
||||
import os
|
||||
|
||||
|
||||
def main(output, input_file):
|
||||
with open(input_file) as fh:
|
||||
if buildconfig.substs['EXPAND_LIBS_LIST_STYLE'] == 'linkerscript':
|
||||
def cleanup(line):
|
||||
assert line.startswith('INPUT("')
|
||||
assert line.endswith('")')
|
||||
return line[len('INPUT("'):-len('")')]
|
||||
|
||||
objs = [cleanup(l.strip()) for l in fh.readlines()]
|
||||
else:
|
||||
objs = [l.strip() for l in fh.readlines()]
|
||||
|
||||
pp = Preprocessor()
|
||||
pp.out = StringIO()
|
||||
pp.do_include(os.path.join(buildconfig.topobjdir, 'buildid.h'))
|
||||
buildid = pp.context['MOZ_BUILDID']
|
||||
output.write(
|
||||
'extern const char gToolkitBuildID[] = "%s";' % buildid
|
||||
)
|
||||
return set(o for o in objs
|
||||
if os.path.splitext(os.path.basename(o))[0] != 'buildid')
|
@ -371,3 +371,20 @@ if CONFIG['COMPILE_ENVIRONMENT']:
|
||||
# This library is entirely composed of Rust code, and needs to come after
|
||||
# all the C++ code so any possible C++ -> Rust calls can be resolved.
|
||||
USE_LIBS += ['gkrust']
|
||||
|
||||
# The buildid is refreshed on every (incremental) build. But we want to avoid
|
||||
# rebuilding libxul every time, so instead of having a source file that
|
||||
# #include's buildid.h, which would have a dependency on it, and that would
|
||||
# thus trigger make to rebuild everything, we generate a source with the
|
||||
# buildid hard coded in it. Then we make that source file depend on all the
|
||||
# objects files that constitute libxul, so that if any of the files linked into
|
||||
# libxul is rebuilt, we refresh the buildid and link it into libxul.
|
||||
SOURCES += ['!buildid.cpp']
|
||||
GENERATED_FILES += ['buildid.cpp']
|
||||
GENERATED_FILES['buildid.cpp'].script = 'gen_buildid.py'
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
|
||||
libxul_list = 'XUL'
|
||||
else:
|
||||
libxul_list = '%sxul_%s' % (
|
||||
CONFIG['DLL_PREFIX'], CONFIG['DLL_SUFFIX'].lstrip('.'))
|
||||
GENERATED_FILES['buildid.cpp'].inputs = ['!%s.list' % libxul_list]
|
||||
|
@ -253,10 +253,10 @@ static const char kPrefHealthReportUploadEnabled[] =
|
||||
int gArgc;
|
||||
char** gArgv;
|
||||
|
||||
#include "buildid.h"
|
||||
|
||||
static const char gToolkitVersion[] = NS_STRINGIFY(GRE_MILESTONE);
|
||||
static const char gToolkitBuildID[] = NS_STRINGIFY(MOZ_BUILDID);
|
||||
// The gToolkitBuildID global is defined to MOZ_BUILDID via gen_buildid.py
|
||||
// in toolkit/library. See related comment in toolkit/library/moz.build.
|
||||
extern const char gToolkitBuildID[];
|
||||
|
||||
static nsIProfileLock* gProfileLock;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user