Bug 1752968 - Pre: Convert `MOZ_PACKAGER_MINIFY{_JS}` to `moz.configure`. r=firefox-build-system-reviewers,mhentges

There's no current use for setting `JS_BINARY` in `packager.mk`, so
remove it while we're here.  I elected to make it easy to add new file
types to minify rather than to make it easy to specify `JS_BINARY`,
since the latter mechanism is strictly more general and could be used
in future for things other than minification.

Differential Revision: https://phabricator.services.mozilla.com/D138364
This commit is contained in:
Nick Alexander 2022-02-23 23:11:49 +00:00
Родитель 92cb06f294
Коммит fb38db6876
4 изменённых файлов: 38 добавлений и 32 удалений

Просмотреть файл

@ -109,15 +109,6 @@ MOZ_PKG_MAC_ICON=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/disk.icns
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
endif
# The packager minifies two different types of files: non-JS (mostly property
# files for l10n), and JS. Setting MOZ_PACKAGER_MINIFY only minifies the
# former. We don't yet minify JS, due to concerns about debuggability.
#
# Also, the JS minification setup really only works correctly on Android:
# we need extra setup to use the newly-built shell for Linux and Windows,
# and Mac requires some extra care due to cross-compilation.
MOZ_PACKAGER_MINIFY=1
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
ifeq (Darwin,$(OS_TARGET))

Просмотреть файл

@ -48,21 +48,8 @@ ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
DEFINES += -DMOZ_ANDROID_FAT_AAR_ARCHITECTURES=1
endif
MOZ_PACKAGER_MINIFY=1
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
# Note that JS_BINARY can be defined in packager.mk, so this test must come
# after including that file. MOZ_PACKAGER_MINIFY_JS is used in packager.mk, but
# since recipe evaluation is deferred, we can set it here after the inclusion.
ifneq (,$(JS_BINARY))
ifndef MOZ_DEBUG
ifndef NIGHTLY_BUILD
MOZ_PACKAGER_MINIFY_JS=1
endif
endif
endif
ifeq (Darwin,$(OS_TARGET))
BINPATH = $(_BINPATH)
DEFINES += -DAPPNAME=$(_APPNAME)

Просмотреть файл

@ -710,6 +710,44 @@ def packager_format(value):
set_config("MOZ_PACKAGER_FORMAT", packager_format)
# The packager minifies two different types of files: non-JS (mostly property
# files for l10n), and JS. Setting MOZ_PACKAGER_MINIFY only minifies the
# former. Firefox doesn't yet minify JS, due to concerns about debuggability.
#
# Also, the JS minification setup really only works correctly on Android:
# we need extra setup to use the newly-built shell for Linux and Windows,
# and cross-compilation for macOS requires some extra care.
@depends(target_is_android, "--enable-debug", milestone.is_nightly)
def enable_minify_default(is_android, debug, is_nightly):
if is_android and not debug and not is_nightly:
return ("properties", "js")
return ("properties",)
option(
name="--enable-minify",
help="Select types of files to minify during packaging.",
nargs="*",
choices=("properties", "js"),
default=enable_minify_default,
)
@depends("--enable-minify")
def enable_minify(value):
if "js" in value and "properties" not in value:
die("--enable-minify=js requires --enable-minify=properties.")
return namespace(
properties="properties" in value,
js="js" in value,
)
set_config("MOZ_PACKAGER_MINIFY", True, when=enable_minify.properties)
set_config("MOZ_PACKAGER_MINIFY_JS", True, when=enable_minify.js)
@depends(host, build_project)
def jar_maker_format(host, build_project):

Просмотреть файл

@ -313,16 +313,6 @@ ifneq (android,$(MOZ_WIDGET_TOOLKIT))
JAR_COMPRESSION ?= none
endif
# A js binary is needed to perform verification of JavaScript minification.
# We can only use the built binary when not cross-compiling. Environments
# (such as release automation) can provide their own js binary to enable
# verification when cross-compiling.
ifndef JS_BINARY
ifndef CROSS_COMPILE
JS_BINARY = $(wildcard $(DIST)/bin/js)
endif
endif
ifeq ($(OS_TARGET), WINNT)
INSTALLER_PACKAGE = $(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
endif