Bug 1856616 - Force a snap refresh r=releng-reviewers,gbrown
[gecko.git] / build / moz-automation.mk
blob28628065e1c7e24b6ad1c227d6733b8b1ac8af4a
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 ifndef ENABLE_TESTS
7 # We can't package tests if they aren't enabled.
8 MOZ_AUTOMATION_PACKAGE_TESTS = 0
9 endif
11 ifdef CROSS_COMPILE
12 # Narrow the definition of cross compilation to not include win32 builds
13 # on win64 and linux32 builds on linux64.
14 ifeq ($(HOST_OS_ARCH),$(OS_TARGET))
15 ifneq (,$(filter x86%,$(CPU_ARCH)))
16 FUZZY_CROSS_COMPILE =
17 else
18 FUZZY_CROSS_COMPILE = 1
19 endif
20 else
21 FUZZY_CROSS_COMPILE = 1
22 endif
23 endif
25 # Don't run make check when cross compiling, when doing artifact builds
26 # or when building instrumented builds for PGO.
27 ifneq (,$(USE_ARTIFACT)$(FUZZY_CROSS_COMPILE)$(MOZ_PROFILE_GENERATE))
28 MOZ_AUTOMATION_CHECK := 0
29 endif
31 ifneq (,$(filter automation/%,$(MAKECMDGOALS)))
32 ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION))))
33 MAKEFLAGS += --output-sync=target
34 else
35 .NOTPARALLEL:
36 endif
37 endif
39 ifndef JS_STANDALONE
40 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
41 include $(topsrcdir)/toolkit/mozapps/installer/upload-files.mk
43 # Clear out DIST_FILES if it was set by upload-files.mk (for Android builds)
44 DIST_FILES =
45 endif
47 # Helper variables to convert from MOZ_AUTOMATION_* variables to the
48 # corresponding the make target
49 tier_MOZ_AUTOMATION_BUILD_SYMBOLS = buildsymbols
50 tier_MOZ_AUTOMATION_PACKAGE = package
51 tier_MOZ_AUTOMATION_PACKAGE_TESTS = package-tests
52 tier_MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES = package-generated-sources
53 tier_MOZ_AUTOMATION_UPLOAD_SYMBOLS = uploadsymbols
54 tier_MOZ_AUTOMATION_UPLOAD = upload
55 tier_MOZ_AUTOMATION_CHECK = check
57 # Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in
58 # TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted
59 # here in the order that they will be executed (since mach doesn't know of the
60 # dependencies between them).
61 moz_automation_symbols = \
62 MOZ_AUTOMATION_PACKAGE_TESTS \
63 MOZ_AUTOMATION_UPLOAD \
64 $(NULL)
66 ifneq (,$(COMPILE_ENVIRONMENT)$(MOZ_ARTIFACT_BUILDS))
67 moz_automation_symbols += \
68 MOZ_AUTOMATION_BUILD_SYMBOLS \
69 MOZ_AUTOMATION_UPLOAD_SYMBOLS \
70 MOZ_AUTOMATION_PACKAGE \
71 MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES \
72 MOZ_AUTOMATION_CHECK \
73 $(NULL)
74 endif
75 MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$($(sym))),$(tier_$(sym))))
77 # Dependencies between automation build steps
78 automation-start/uploadsymbols: automation/buildsymbols
80 automation-start/upload: automation/package
81 automation-start/upload: automation/package-tests
82 automation-start/upload: automation/buildsymbols
83 automation-start/upload: automation/package-generated-sources
85 # Run the check tier after everything else.
86 automation-start/check: $(addprefix automation/,$(filter-out check,$(MOZ_AUTOMATION_TIERS)))
88 automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
89 @echo Automation steps completed.
91 # Run as many tests as possible, even in case of one of them failing.
92 AUTOMATION_EXTRA_CMDLINE-check = --keep-going
94 # The commands only run if the corresponding MOZ_AUTOMATION_* variable is
95 # enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then
96 # 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set.
97 # However, the target automation/buildsymbols will still be executed in this
98 # case because it is a prerequisite of automation/upload.
99 define automation_commands
100 @+$(PYTHON3) $(topsrcdir)/config/run-and-prefix.py $1 $(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
101 $(call BUILDSTATUS,TIER_FINISH $1)
102 endef
104 # The tier start message is in a separate target so make doesn't buffer it
105 # until the step completes with output syncing enabled.
106 automation-start/%:
107 $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call BUILDSTATUS,TIER_START $*))
109 automation/%: automation-start/%
110 $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*))