Skip to content

Commit

Permalink
Bug 1850647 - add an optional argument to py_action to record the tar…
Browse files Browse the repository at this point in the history
…get file name for most actions, r=glandium.

Differential Revision: https://phabricator.services.mozilla.com/D187306
  • Loading branch information
fqueze committed Oct 12, 2023
1 parent a7088bc commit ec1134b
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 59 deletions.
8 changes: 4 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
@# same directory, because that would blow up
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
endif
$(foreach manifest,$(wildcard _build_manifests/install/$(subst /,_,$*)),$(call py_action,process_install_manifest,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install_$(subst /,_,$*).track $* $(manifest)))
$(foreach manifest,$(wildcard _build_manifests/install/$(subst /,_,$*)),$(call py_action,process_install_manifest $*,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install_$(subst /,_,$*).track $* $(manifest)))

# Dummy wrapper rule to allow the faster backend to piggy back
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
Expand All @@ -93,7 +93,7 @@ install-tests: install-test-files

.PHONY: install-test-files
install-test-files:
$(call py_action,process_install_manifest,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install__test_files.track _tests _build_manifests/install/_test_files)
$(call py_action,process_install_manifest test/files,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install__test_files.track _tests _build_manifests/install/_test_files)

include $(topsrcdir)/build/moz-automation.mk

Expand Down Expand Up @@ -168,14 +168,14 @@ endif
.PHONY: symbolsfullarchive
symbolsfullarchive: prepsymbolsarchive
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
$(call py_action,symbols_archive $(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
$(abspath $(DIST)/crashreporter-symbols) \
--full-archive)

.PHONY: symbolsarchive
symbolsarchive: prepsymbolsarchive
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
$(call py_action,symbols_archive $(SYMBOL_ARCHIVE_BASENAME).zip,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
$(abspath $(DIST)/crashreporter-symbols))

ifdef MOZ_CRASHREPORTER
Expand Down
6 changes: 3 additions & 3 deletions browser/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ endif
# steps. See bug 1431342.
libs:: $(srcdir)/profile/channel-prefs.js
$(NSINSTALL) -D $(DIST)/bin/defaults/pref
$(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)
$(call py_action,preprocessor channel-prefs.js,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)

ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))

Expand Down Expand Up @@ -86,8 +86,8 @@ tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME) $(objdir)/macbuild/Contents/MacOS-
$(MKDIR) -p '$(dist_dest)/$(LPROJ)'
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents '$(dist_dest)' --exclude English.lproj
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ '$(dist_dest)/$(LPROJ)'
$(call py_action,preprocessor,-Fsubstitution -DAPP_VERSION='$(MOZ_APP_VERSION)' -DMOZ_APP_NAME='$(MOZ_APP_NAME)' -DMAC_APP_NAME='$(MAC_APP_NAME)' -DMOZ_MACBUNDLE_ID='$(MOZ_MACBUNDLE_ID)' -DMAC_BUNDLE_VERSION='$(MAC_BUNDLE_VERSION)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o '$(dist_dest)/Contents/Info.plist')
$(call py_action,preprocessor,-Fsubstitution --output-encoding utf-16 -DMAC_APP_NAME='$(MAC_APP_NAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o '$(dist_dest)/$(LPROJ)/InfoPlist.strings')
$(call py_action,preprocessor Info.plist,-Fsubstitution -DAPP_VERSION='$(MOZ_APP_VERSION)' -DMOZ_APP_NAME='$(MOZ_APP_NAME)' -DMAC_APP_NAME='$(MAC_APP_NAME)' -DMOZ_MACBUNDLE_ID='$(MOZ_MACBUNDLE_ID)' -DMAC_BUNDLE_VERSION='$(MAC_BUNDLE_VERSION)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o '$(dist_dest)/Contents/Info.plist')
$(call py_action,preprocessor InfoPlist.strings,-Fsubstitution --output-encoding utf-16 -DMAC_APP_NAME='$(MAC_APP_NAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o '$(dist_dest)/$(LPROJ)/InfoPlist.strings')
rsync -a --exclude-from='$(objdir)/macbuild/Contents/MacOS-files.txt' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
rsync -a --include-from='$(objdir)/macbuild/Contents/MacOS-files.txt' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
# MacOS-files-copy.in is a list of files that should be copies rather
Expand Down
2 changes: 1 addition & 1 deletion browser/installer/windows/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $(CONFIG_DIR)/setup.exe::
$(MKDIR) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
$(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \
$(call py_action,preprocessor defines.nsi,-Fsubstitution $(DEFINES) $(ACDEFINES) \
$(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi)
$(PYTHON3) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
--preprocess-locale $(topsrcdir) \
Expand Down
12 changes: 9 additions & 3 deletions config/makefiles/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ core_winabspath = $(error core_winabspath is unsupported)
#
# libs::
# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest)
#
# The first argument can optionally contain the name of the file being created
# or processed. e.g.
# libs::
# $(call py_action,purge_manifests foo.manifest,_build_manifests/purge/foo.manifest)
# This optional name will be displayed in build profiles.
define py_action
$(call BUILDSTATUS,START_$(1) $(subst ','\'',$(2)))
$(if $(3),cd $(3) && )$(PYTHON3) -m mozbuild.action.$(1) $(2)
$(call BUILDSTATUS,END_$(1) $(subst ','\'',$(2)))
$(call BUILDSTATUS,START_$(firstword $(1)) $(or $(word 2,$(1)),$(2)))
$(if $(3),cd $(3) && )$(PYTHON3) -m mozbuild.action.$(firstword $(1)) $(2)
$(call BUILDSTATUS,END_$(firstword $(1)) $(or $(word 2,$(1)),$(2)))

endef
2 changes: 1 addition & 1 deletion config/makefiles/rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ ifeq ($(OS_ARCH), Linux)
ifeq (,$(rustflags_sancov)$(MOZ_ASAN)$(MOZ_TSAN)$(MOZ_UBSAN))
ifndef MOZ_LTO_RUST_CROSS
ifneq (,$(filter -Clto,$(cargo_rustc_flags)))
$(call py_action,check_binary,--networking $@)
$(call py_action,check_binary $(@F),--networking $@)
endif
endif
endif
Expand Down
12 changes: 6 additions & 6 deletions config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
else # !WINNT || GNU_CC
$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
$(call py_action,check_binary,$@)
$(call py_action,check_binary $(@F),$@)
endif # WINNT && !GNU_CC

ifdef ENABLE_STRIP
Expand Down Expand Up @@ -468,7 +468,7 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
$(LINKER) -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
else
$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) -o $@ $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
$(call py_action,check_binary,$@)
$(call py_action,check_binary $(@F),$@)
endif # WINNT && !GNU_CC

ifdef ENABLE_STRIP
Expand Down Expand Up @@ -624,7 +624,7 @@ define syms_template
syms:: $(2)
$(2): $(1)
ifdef MOZ_CRASHREPORTER
$$(call py_action,dumpsymbols,$$(abspath $$<) $$(abspath $$@) $$(DUMP_SYMBOLS_FLAGS))
$$(call py_action,dumpsymbols $$@,$$(abspath $$<) $$(abspath $$@) $$(DUMP_SYMBOLS_FLAGS))
ifeq ($(OS_ARCH),WINNT)
ifdef WINCHECKSEC
$$(PYTHON3) $$(topsrcdir)/build/win32/autowinchecksec.py $$<
Expand Down Expand Up @@ -864,7 +864,7 @@ endif
endif

misc realchrome:: $(FINAL_TARGET)/chrome
$(call py_action,jar_maker,\
$(call py_action,jar_maker $(subst $(topsrcdir)/,,$(JAR_MANIFEST)),\
$(QUIET) -d $(FINAL_TARGET) \
$(MAKE_JARS_FLAGS) $(DEFINES) $(ACDEFINES) \
$(JAR_MANIFEST))
Expand All @@ -882,7 +882,7 @@ endif
ifneq ($(XPI_PKGNAME),)
tools realchrome::
@echo 'Packaging $(XPI_PKGNAME).xpi...'
$(call py_action,zip,-C $(FINAL_TARGET) ../$(XPI_PKGNAME).xpi '*')
$(call py_action,zip $(XPI_PKGNAME).xpi,-C $(FINAL_TARGET) ../$(XPI_PKGNAME).xpi '*')
endif

#############################################################################
Expand Down Expand Up @@ -1049,7 +1049,7 @@ PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS
$(PP_TARGETS_ALL_RESULTS):
$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
$(RM) '$@'
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) '$<' -o '$@')
$(call py_action,preprocessor $(@F),--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) '$<' -o '$@')

$(filter %.css,$(PP_TARGETS_ALL_RESULTS)): PP_TARGET_FLAGS+=--marker %

Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export:: webidl.stub
-include codegen.pp

webidl.stub: $(codegen_dependencies)
$(call py_action,webidl,$(srcdir))
$(call py_action,webidl $(relativesrcdir),$(srcdir))
@$(TOUCH) $@

.PHONY: compiletests
Expand Down
8 changes: 4 additions & 4 deletions ipc/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ libs::
# plugin-container
$(NSINSTALL) -D $(DIST)/bin/$(PROGRAM).app
rsync -a -C --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app
$(call py_action,preprocessor,-Fsubstitution -DEXECUTABLE='$(MOZ_CHILD_PROCESS_NAME)' -DBUNDLEID='$(MOZ_CHILD_PROCESS_BUNDLEID)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Info.plist)
$(call py_action,preprocessor,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_CHILD_PROCESS_APPNAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings)
$(call py_action,preprocessor $(MOZ_CHILD_PROCESS_NAME).app/Contents/Info.plist,-Fsubstitution -DEXECUTABLE='$(MOZ_CHILD_PROCESS_NAME)' -DBUNDLEID='$(MOZ_CHILD_PROCESS_BUNDLEID)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Info.plist)
$(call py_action,preprocessor $(MOZ_CHILD_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_CHILD_PROCESS_APPNAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings)
$(NSINSTALL) -D $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/MacOS
$(NSINSTALL) $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME) $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/MacOS
# media-plugin-helper
$(NSINSTALL) -D $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app
rsync -a -C --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app
$(call py_action,preprocessor,-Fsubstitution -DEXECUTABLE='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DBUNDLEID='$(MOZ_EME_PROCESS_BUNDLEID)' -DMOZ_EME_PROCESS_NAME_BRANDED='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Info.plist)
$(call py_action,preprocessor,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_EME_PROCESS_BUNDLENAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings)
$(call py_action,preprocessor $(MOZ_EME_PROCESS_NAME).app/Contents/Info.plist,-Fsubstitution -DEXECUTABLE='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DBUNDLEID='$(MOZ_EME_PROCESS_BUNDLEID)' -DMOZ_EME_PROCESS_NAME_BRANDED='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Info.plist)
$(call py_action,preprocessor $(MOZ_EME_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_EME_PROCESS_BUNDLENAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings)
$(NSINSTALL) -D $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/MacOS
cp $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME) "$(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/MacOS/$(MOZ_EME_PROCESS_NAME_BRANDED)"
endif #}
2 changes: 1 addition & 1 deletion python/mozbuild/mozbuild/backend/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _format_statements_for_generated_file(self, obj, tier, extra_dependencies=""
(
"""{stub}: {script}{inputs}{backend}{force}
\t$(REPORT_BUILD)
\t$(call py_action,file_generate,{locale}{script} """ # wrap for E501
\t$(call py_action,file_generate {output},{locale}{script} """ # wrap for E501
"""{method} {output} {dep_file} {stub}{inputs}{flags})
\t@$(TOUCH) $@
"""
Expand Down
19 changes: 10 additions & 9 deletions python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1683,20 +1683,21 @@ def _process_chrome_manifest_entry(self, obj, backend_file):

top_level = mozpath.join(obj.install_target, "chrome.manifest")
if obj.path != top_level:
path = mozpath.relpath(obj.path, obj.install_target)
args = [
mozpath.join("$(DEPTH)", top_level),
make_quote(
shell_quote(
"manifest %s" % mozpath.relpath(obj.path, obj.install_target)
)
),
make_quote(shell_quote("manifest %s" % path)),
]
rule.add_commands(["$(call py_action,buildlist,%s)" % " ".join(args)])
rule.add_commands(
["$(call py_action,buildlist %s,%s)" % (path, " ".join(args))]
)
args = [
mozpath.join("$(DEPTH)", obj.path),
make_quote(shell_quote(str(obj.entry))),
]
rule.add_commands(["$(call py_action,buildlist,%s)" % " ".join(args)])
rule.add_commands(
["$(call py_action,buildlist %s,%s)" % (obj.entry.path, " ".join(args))]
)
fragment.dump(backend_file.fh, removal_guard=False)

self._no_skip["misc"].add(obj.relsrcdir)
Expand Down Expand Up @@ -1785,7 +1786,7 @@ def _handle_ipdl_sources(
rule.add_commands(
[
"$(RM) $@",
"$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) "
"$(call py_action,preprocessor $@,$(DEFINES) $(ACDEFINES) "
"$< -o $@)",
]
)
Expand Down Expand Up @@ -1860,7 +1861,7 @@ def _handle_webidl_build(
# static to preprocessed don't end up writing to a symlink,
# which would modify content in the source directory.
"$(RM) $@",
"$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) "
"$(call py_action,preprocessor $@,$(DEFINES) $(ACDEFINES) "
"$< -o $@)",
]
)
Expand Down
Loading

0 comments on commit ec1134b

Please sign in to comment.