Bug 1372381 - Generate automation.py with GENERATED_FILES rather than Makefile.in
This commit also removes "DEFAULT_APP", which is unused.
MozReview-Commit-ID: 5YYaC5LJqUn
deleted file mode 100644
--- 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
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -48,17 +48,16 @@ from mozscreenshot import printstatus, d
#expand _IS_LINUX = __IS_LINUX__ != 0
#ifdef IS_CYGWIN
#expand _IS_CYGWIN = __IS_CYGWIN__ == 1
#else
_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__
#expand _CRASHREPORTER = __CRASHREPORTER__ == 1
#expand _IS_ASAN = __IS_ASAN__ == 1
if _IS_WIN32:
@@ -94,17 +93,16 @@ class Automation(object):
IS_WIN32 = _IS_WIN32
IS_MAC = _IS_MAC
IS_LINUX = _IS_LINUX
IS_CYGWIN = _IS_CYGWIN
BIN_SUFFIX = _BIN_SUFFIX
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
CRASHREPORTER = _CRASHREPORTER
IS_ASAN = _IS_ASAN
# timeout, in seconds
DEFAULT_TIMEOUT = 60.0
@@ -133,17 +131,16 @@ class Automation(object):
return [
"UNIXISH",
"IS_WIN32",
"IS_MAC",
"log",
"runApp",
"Process",
"DIST_BIN",
- "DEFAULT_APP",
"CERTS_SRC_DIR",
"environment",
"IS_TEST_BUILD",
"IS_DEBUG_BUILD",
"DEFAULT_TIMEOUT",
]
class Process(subprocess.Popen):
new file mode 100644
--- /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:])
--- a/build/moz.build
+++ b/build/moz.build
@@ -91,16 +91,30 @@ if CONFIG['MOZ_APP_BASENAME']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
FINAL_TARGET_PP_FILES += ['update-settings.ini']
GENERATED_FILES += ['application.ini.h']
appini = GENERATED_FILES['application.ini.h']
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']
# Put a .lldbinit in the bin directory and the objdir, to be picked up
# automatically by LLDB when we debug executables using either of those two
# directories as the current working directory. The .lldbinit file will
# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
DEFINES['topsrcdir'] = TOPSRCDIR
--- a/layout/tools/reftest/Makefile.in
+++ b/layout/tools/reftest/Makefile.in
@@ -2,17 +2,13 @@
# 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/.
_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.
libs::
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - reftest) | (cd $(_DEST_DIR) && tar -xf -)
--- a/layout/tools/reftest/moz.build
+++ b/layout/tools/reftest/moz.build
@@ -9,19 +9,17 @@ with Files('**'):
SCHEDULES.exclusive = ['reftest']
XPI_NAME = 'reftest'
USE_EXTENSION_MANIFEST = True
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',
'mach_test_package_commands.py',
'output.py',
'reftest-preferences.js',
'reftestcommandline.py',
'remotereftest.py',
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -564,17 +564,18 @@ class TupBackend(CommonBackend):
extra_exports = {
'buildid.h': ['MOZ_BUILD_DATE'],
}
for f in obj.outputs:
exports = extra_exports.get(f)
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 []
full_inputs += [self._early_generated_files]
backend_file.rule(
display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),
cmd=cmd,
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -2,18 +2,14 @@
# 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/.
_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 -)
$(_DEST_DIR):
$(NSINSTALL) -D $@
--- a/testing/mochitest/moz.build
+++ b/testing/mochitest/moz.build
@@ -21,22 +21,17 @@ FINAL_TARGET_PP_FILES += ['install.rdf']
FINAL_TARGET_FILES += ['bootstrap.js']
MOCHITEST_MANIFESTS += [
'tests/MochiKit-1.4.2/tests/mochitest.ini',
]
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',
'/build/sanitizers/ubsan_suppressions.txt',
'/build/valgrind/cross-architecture.sup',
'/build/valgrind/i386-pc-linux-gnu.sup',
'/build/valgrind/x86_64-pc-linux-gnu.sup',
'/netwerk/test/httpserver/httpd.js',