Bug 1953817 - Avoid rebuilding toolkit/components/telemetry/test packages when not needed r=glandium

Achieve this by syndicating code with rule from bug 1944955.

Differential Revision: https://phabricator.services.mozilla.com/D241424
This commit is contained in:
serge-sans-paille
2025-03-19 08:00:17 +00:00
parent 77a7e399a8
commit ab85f96d2a
2 changed files with 21 additions and 9 deletions

View File

@@ -887,16 +887,29 @@ endif
endif
# Usage:
# xpi_package_rule(package-name,directory-to-package,relative-target-directory,parent-rule)
# where:
# - package-name is the name of the xpi package, without suffix
# - directory-to-package is the path to the directory to package
# - relative-target-directory is the path to the directory where
# the archive is generated, relative to directory-to-package
# - parent-rule is the name(s) of the rule(s) this rule should be added to
define xpi_package_rule
$$(realpath $(3))/$(1).xpi: $$(call mkdir_deps,$(3))
@echo 'Packaging $(1).xpi...'
$$(call py_action,zip $(1).xpi,-C $(2) $$@ '*' --dep-target $$@ --dep-file $$(MDDEPDIR)/$(1).d)
$(4):: $$(realpath $(3))/$(1).xpi
EXTRA_MDDEPEND_FILES += $$(MDDEPDIR)/$(1).d
endef
# When you move this out of the tools tier, please remove the corresponding
# hacks in recursivemake.py that check if Makefile.in sets the variable.
ifneq ($(XPI_PKGNAME),)
tools realchrome::$(FINAL_TARGET)/../$(XPI_PKGNAME).xpi
XPI_PKGNAME_DEPS=$(MDDEPDIR)/$(XPI_PKGNAME).d
EXTRA_MDDEPEND_FILES += $(XPI_PKGNAME_DEPS)
$(FINAL_TARGET)/../$(XPI_PKGNAME).xpi:
@echo 'Packaging $(XPI_PKGNAME).xpi...'
$(call py_action,zip $(XPI_PKGNAME).xpi,-C $(FINAL_TARGET) ../$(XPI_PKGNAME).xpi '*' --dep-target $(FINAL_TARGET)/../$(XPI_PKGNAME).xpi --dep-file $(XPI_PKGNAME_DEPS))
$(eval $(call xpi_package_rule,$(XPI_PKGNAME),$(FINAL_TARGET),$(FINAL_TARGET)/..,tools realchrome))
endif
#############################################################################

View File

@@ -9,5 +9,4 @@ include $(topsrcdir)/config/rules.mk
addondir = $(srcdir)/tests/addons
testdir = $(topobjdir)/_tests/xpcshell/toolkit/components/telemetry/tests/unit
misc:: $(call mkdir_deps,$(testdir))
$(foreach dir,$(wildcard $(addondir)/*),$(call py_action,zip $(notdir $(dir)).xpi,-C $(dir) $(testdir)/$(notdir $(dir)).xpi \*))
$(foreach dir,$(wildcard $(addondir)/*),$(eval $(call xpi_package_rule,$(notdir $(dir)),$(dir),$(testdir),misc)))