moz-automation.mk (3777B)
1 # 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/. 5 6 ifndef ENABLE_TESTS 7 # We can't package tests if they aren't enabled. 8 MOZ_AUTOMATION_PACKAGE_TESTS = 0 9 endif 10 11 ifdef CROSS_COMPILE 12 # Narrow the definition of cross compilation to not include win32 builds 13 # on win64. 14 ifeq ($(HOST_OS_ARCH),$(OS_TARGET)) 15 ifneq (,$(filter x86%,$(TARGET_CPU))) 16 FUZZY_CROSS_COMPILE = 17 else 18 FUZZY_CROSS_COMPILE = 1 19 endif 20 else 21 FUZZY_CROSS_COMPILE = 1 22 endif 23 endif 24 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 30 31 ifneq (,$(filter automation/%,$(MAKECMDGOALS))) 32 ifneq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION)))) 33 .NOTPARALLEL: 34 endif 35 endif 36 37 ifndef JS_STANDALONE 38 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk 39 include $(topsrcdir)/toolkit/mozapps/installer/upload-files.mk 40 41 # Clear out DIST_FILES if it was set by upload-files.mk (for Android builds) 42 DIST_FILES = 43 endif 44 45 # Helper variables to convert from MOZ_AUTOMATION_* variables to the 46 # corresponding the make target 47 tier_MOZ_AUTOMATION_BUILD_SYMBOLS = buildsymbols 48 tier_MOZ_AUTOMATION_PACKAGE = package 49 tier_MOZ_AUTOMATION_PACKAGE_TESTS = package-tests 50 tier_MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES = package-generated-sources 51 tier_MOZ_AUTOMATION_UPLOAD_SYMBOLS = uploadsymbols 52 tier_MOZ_AUTOMATION_UPLOAD = upload 53 tier_MOZ_AUTOMATION_CHECK = check 54 55 # Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in 56 # TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted 57 # here in the order that they will be executed (since mach doesn't know of the 58 # dependencies between them). 59 moz_automation_symbols = \ 60 MOZ_AUTOMATION_PACKAGE_TESTS \ 61 MOZ_AUTOMATION_UPLOAD \ 62 $(NULL) 63 64 ifneq (,$(COMPILE_ENVIRONMENT)$(MOZ_ARTIFACT_BUILDS)) 65 moz_automation_symbols += \ 66 MOZ_AUTOMATION_BUILD_SYMBOLS \ 67 MOZ_AUTOMATION_UPLOAD_SYMBOLS \ 68 MOZ_AUTOMATION_PACKAGE \ 69 MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES \ 70 MOZ_AUTOMATION_CHECK \ 71 $(NULL) 72 endif 73 MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$($(sym))),$(tier_$(sym)))) 74 75 # Dependencies between automation build steps 76 automation/uploadsymbols: automation/buildsymbols 77 78 automation/upload: automation/package 79 automation/upload: automation/package-tests 80 automation/upload: automation/buildsymbols 81 automation/upload: automation/package-generated-sources 82 83 # Run the check tier after everything else. 84 automation/check: $(addprefix automation/,$(filter-out check,$(MOZ_AUTOMATION_TIERS))) 85 86 automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS)) 87 @echo Automation steps completed. 88 89 # Run as many tests as possible, even in case of one of them failing. 90 AUTOMATION_EXTRA_CMDLINE-check = --keep-going 91 92 # The commands only run if the corresponding MOZ_AUTOMATION_* variable is 93 # enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then 94 # 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set. 95 # However, the target automation/buildsymbols will still be executed in this 96 # case because it is a prerequisite of automation/upload. 97 define automation_commands 98 @+$(PYTHON3) $(topsrcdir)/config/run-and-prefix.py $1 $(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1) 99 endef 100 101 automation/%: 102 $(if $(filter $*,$(filter-out $(ALL_TIERS),$(MOZ_AUTOMATION_TIERS))),$(call BUILDSTATUS,TIER_START $*)) 103 $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*)) 104 $(if $(filter $*,$(filter-out $(ALL_TIERS),$(MOZ_AUTOMATION_TIERS))),$(call BUILDSTATUS,TIER_FINISH $*))