Bug 1372381 - Generate automation.py with GENERATED_FILES rather than Makefile.in r=mshal

This commit also removes "DEFAULT_APP", which is unused.

MozReview-Commit-ID: 5YYaC5LJqUn

--HG--
extra : rebase_source : 11a5264758ab3b2d8faef1e50a666981988457f2
This commit is contained in:
Chris Manchester 2018-04-30 11:08:59 -07:00
parent de99bf8e10
commit d0a6e686c9
9 changed files with 58 additions and 86 deletions

View File

@ -1,67 +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/.
include $(MOZILLA_DIR)/build/binary-location.mk
browser_path := '"$(browser_path)"'
_PROFILE_DIR = $(TARGET_DEPTH)/_profile/pgo
ABSOLUTE_TOPSRCDIR = $(abspath $(MOZILLA_DIR))
_CERTS_SRC_DIR = $(ABSOLUTE_TOPSRCDIR)/build/pgo/certs
AUTOMATION_PPARGS = \
-DBROWSER_PATH=$(browser_path) \
-DXPC_BIN_PATH='"$(DIST)/bin"' \
-DBIN_SUFFIX='"$(BIN_SUFFIX)"' \
-DPROFILE_DIR='"$(_PROFILE_DIR)"' \
-DCERTS_SRC_DIR='"$(_CERTS_SRC_DIR)"' \
-DPERL='"$(PERL)"' \
$(NULL)
ifeq ($(OS_ARCH),Darwin)
AUTOMATION_PPARGS += -DIS_MAC=1
else
AUTOMATION_PPARGS += -DIS_MAC=0
endif
ifeq ($(OS_ARCH),Linux)
AUTOMATION_PPARGS += -DIS_LINUX=1
else
AUTOMATION_PPARGS += -DIS_LINUX=0
endif
ifeq ($(host_os), cygwin)
AUTOMATION_PPARGS += -DIS_CYGWIN=1
endif
ifeq ($(ENABLE_TESTS), 1)
AUTOMATION_PPARGS += -DIS_TEST_BUILD=1
else
AUTOMATION_PPARGS += -DIS_TEST_BUILD=0
endif
ifeq ($(MOZ_DEBUG), 1)
AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=1
else
AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
endif
ifdef MOZ_CRASHREPORTER
AUTOMATION_PPARGS += -DCRASHREPORTER=1
else
AUTOMATION_PPARGS += -DCRASHREPORTER=0
endif
ifdef MOZ_ASAN
AUTOMATION_PPARGS += -DIS_ASAN=1
else
AUTOMATION_PPARGS += -DIS_ASAN=0
endif
automation.py: $(MOZILLA_DIR)/build/automation.py.in $(MOZILLA_DIR)/build/automation-build.mk
$(call py_action,preprocessor, \
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< -o $@)
GARBAGE += automation.py automation.pyc

View File

@ -53,7 +53,6 @@ _IS_CYGWIN = False
#endif
#expand _BIN_SUFFIX = __BIN_SUFFIX__
#expand _DEFAULT_APP = "./" + __BROWSER_PATH__
#expand _CERTS_SRC_DIR = __CERTS_SRC_DIR__
#expand _IS_TEST_BUILD = __IS_TEST_BUILD__
#expand _IS_DEBUG_BUILD = __IS_DEBUG_BUILD__
@ -99,7 +98,6 @@ class Automation(object):
UNIXISH = not IS_WIN32 and not IS_MAC
DEFAULT_APP = _DEFAULT_APP
CERTS_SRC_DIR = _CERTS_SRC_DIR
IS_TEST_BUILD = _IS_TEST_BUILD
IS_DEBUG_BUILD = _IS_DEBUG_BUILD
@ -138,7 +136,6 @@ class Automation(object):
"runApp",
"Process",
"DIST_BIN",
"DEFAULT_APP",
"CERTS_SRC_DIR",
"environment",
"IS_TEST_BUILD",

48
build/gen_automation.py Normal file
View File

@ -0,0 +1,48 @@
# -*- 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/.
import sys
import buildconfig
from mozbuild.preprocessor import Preprocessor
def main(output, input_file):
pp = Preprocessor()
pp.context.update(buildconfig.defines['ALLDEFINES'])
substs = buildconfig.substs
# Substs taken verbatim.
substs_vars = (
'BIN_SUFFIX',
)
for var in substs_vars:
pp.context[var] = '"%s"' % substs[var]
# Derived values.
for key, condition in (
('IS_MAC', substs['OS_ARCH'] == 'Darwin'),
('IS_LINUX', substs['OS_ARCH'] == 'Linux'),
('IS_TEST_BUILD', substs.get('ENABLE_TESTS') == '1'),
('IS_DEBUG_BUILD', substs.get('MOZ_DEBUG') == '1'),
('CRASHREPORTER', substs.get('MOZ_CRASHREPORTER')),
('IS_ASAN', substs.get('MOZ_ASAN'))):
if condition:
pp.context[key] = '1'
else:
pp.context[key] = '0'
pp.context.update({
'XPC_BIN_PATH': '"%s/dist/bin"' % buildconfig.topobjdir,
'CERTS_SRC_DIR': '"%s/build/pgo/certs"' % buildconfig.topsrcdir,
})
pp.out = output
pp.do_include(input_file)
if __name__ == '__main__':
main(*sys.agv[1:])

View File

@ -96,6 +96,12 @@ if CONFIG['MOZ_APP_BASENAME']:
appini.script = 'appini_header.py'
appini.inputs = ['!application.ini']
if CONFIG['ENABLE_TESTS']:
GENERATED_FILES += ['automation.py']
auto = GENERATED_FILES['automation.py']
auto.script = 'gen_automation.py'
auto.inputs = ['automation.py.in']
# NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
OBJDIR_FILES += ['/.gdbinit']

View File

@ -7,10 +7,6 @@ _DEST_DIR = $(DEPTH)/_tests/reftest
include $(topsrcdir)/config/rules.mk
# We're installing to _tests/reftest
TARGET_DEPTH = ../..
include $(topsrcdir)/build/automation-build.mk
# copy harness and the reftest extension bits to $(_DEST_DIR)
# This needs to happen after jar.mn handling from rules.mk included above.
# The order of the :: rules ensures that.

View File

@ -14,9 +14,8 @@ JAR_MANIFESTS += ['jar.mn']
FINAL_TARGET_PP_FILES += ['install.rdf']
FINAL_TARGET_FILES += ['bootstrap.js']
GENERATED_FILES += ['automation.py']
TEST_HARNESS_FILES.reftest += [
'!automation.py',
'!/build/automation.py',
'/build/mobile/remoteautomation.py',
'/build/pgo/server-locations.txt',
'/testing/mochitest/server.js',

View File

@ -569,7 +569,8 @@ class TupBackend(CommonBackend):
if exports:
backend_file.export(exports)
if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
if any(f.endswith(('automation.py', 'source-repo.h', 'buildid.h'))
for f in obj.outputs):
extra_outputs = [self._early_generated_files]
else:
extra_outputs = [self._installed_files] if obj.required_for_compile else []

View File

@ -7,10 +7,6 @@
_DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir)
include $(topsrcdir)/config/rules.mk
# We're installing to _tests/testing/mochitest, so this is the depth
# necessary for relative objdir paths.
TARGET_DEPTH = ../../..
include $(topsrcdir)/build/automation-build.mk
libs::
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - mochijar) | (cd $(_DEST_DIR) && tar -xf -)

View File

@ -26,12 +26,8 @@ MOCHITEST_MANIFESTS += [
]
MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
GENERATED_FILES += [
'automation.py',
]
TEST_HARNESS_FILES.testing.mochitest += [
'!automation.py',
'!/build/automation.py',
'/build/mobile/remoteautomation.py',
'/build/pgo/server-locations.txt',
'/build/sanitizers/lsan_suppressions.txt',