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 19:49:08 +00:00
parent c9a8e17873
commit acd0196364
2 changed files with 21 additions and 10 deletions

View File

@@ -887,16 +887,29 @@ endif
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
$$(abspath $(3))/$(1).xpi: $$(call mkdir_deps,$(3) $$(MDDEPDIR))
@echo 'Packaging $(1).xpi...'
$$(call py_action,zip $(1).xpi,-C $(2) $$@ '*' --dep-target $$@ --dep-file $$(MDDEPDIR)/$(1).d)
$(4):: $$(abspath $(3))/$(1).xpi
-include $$(MDDEPDIR)/$(1).d
endef
# When you move this out of the tools tier, please remove the corresponding # 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. # hacks in recursivemake.py that check if Makefile.in sets the variable.
ifneq ($(XPI_PKGNAME),) ifneq ($(XPI_PKGNAME),)
tools realchrome::$(FINAL_TARGET)/../$(XPI_PKGNAME).xpi $(eval $(call xpi_package_rule,$(XPI_PKGNAME),$(FINAL_TARGET),$(FINAL_TARGET)/..,tools realchrome))
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))
endif endif
############################################################################# #############################################################################

View File

@@ -8,6 +8,4 @@ include $(topsrcdir)/config/rules.mk
# This is so hacky. Waiting on bug 988938. # This is so hacky. Waiting on bug 988938.
addondir = $(srcdir)/tests/addons addondir = $(srcdir)/tests/addons
testdir = $(topobjdir)/_tests/xpcshell/toolkit/components/telemetry/tests/unit testdir = $(topobjdir)/_tests/xpcshell/toolkit/components/telemetry/tests/unit
$(foreach dir,$(wildcard $(addondir)/*),$(eval $(call xpi_package_rule,$(notdir $(dir)),$(dir),$(testdir),misc)))
misc:: $(call mkdir_deps,$(testdir))
$(foreach dir,$(wildcard $(addondir)/*),$(call py_action,zip $(notdir $(dir)).xpi,-C $(dir) $(testdir)/$(notdir $(dir)).xpi \*))