diff --git a/build/automation-build.mk b/build/automation-build.mk deleted file mode 100644 index e25f90c5d3ab..000000000000 --- a/build/automation-build.mk +++ /dev/null @@ -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 diff --git a/build/automation.py.in b/build/automation.py.in index 60c252c072d3..99c633b0de3d 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -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", diff --git a/build/gen_automation.py b/build/gen_automation.py new file mode 100644 index 000000000000..24b89862e6ef --- /dev/null +++ b/build/gen_automation.py @@ -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:]) diff --git a/build/moz.build b/build/moz.build index 2f2d3efd64f3..64b4f8e5f5eb 100644 --- a/build/moz.build +++ b/build/moz.build @@ -96,6 +96,20 @@ 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'] + + TEST_HARNESS_FILES.reftest += [ + '!automation.py', + ] + + TEST_HARNESS_FILES.testing.mochitest += [ + '!automation.py', + ] + # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir. OBJDIR_FILES += ['/.gdbinit'] diff --git a/layout/tools/reftest/Makefile.in b/layout/tools/reftest/Makefile.in index 7ff59cd8b6af..1baf9594bc2b 100644 --- a/layout/tools/reftest/Makefile.in +++ b/layout/tools/reftest/Makefile.in @@ -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. diff --git a/layout/tools/reftest/moz.build b/layout/tools/reftest/moz.build index b307d9affb90..ad6bea5cef53 100644 --- a/layout/tools/reftest/moz.build +++ b/layout/tools/reftest/moz.build @@ -14,9 +14,7 @@ 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/mobile/remoteautomation.py', '/build/pgo/server-locations.txt', '/testing/mochitest/server.js', diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py index acb0982c6d0b..94d50e9dd1dd 100644 --- a/python/mozbuild/mozbuild/backend/tup.py +++ b/python/mozbuild/mozbuild/backend/tup.py @@ -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 [] diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in index 861c273dc7a1..91b422c4815f 100644 --- a/testing/mochitest/Makefile.in +++ b/testing/mochitest/Makefile.in @@ -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 -) diff --git a/testing/mochitest/moz.build b/testing/mochitest/moz.build index 71fa79181cf2..2ad6fa89a87a 100644 --- a/testing/mochitest/moz.build +++ b/testing/mochitest/moz.build @@ -26,12 +26,7 @@ MOCHITEST_MANIFESTS += [ ] MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini'] -GENERATED_FILES += [ - 'automation.py', -] - TEST_HARNESS_FILES.testing.mochitest += [ - '!automation.py', '/build/mobile/remoteautomation.py', '/build/pgo/server-locations.txt', '/build/sanitizers/lsan_suppressions.txt',