Bug 1390461 - Update langpack-webext to use WEBEXT_LANGPACKS mk flag. r?pike draft
authorZibi Braniecki <zbraniecki@mozilla.com>
Sun, 27 Aug 2017 17:27:19 -0700
changeset 656716 b79ce60d3b86a30da5eb142b2e15eb9f19808399
parent 656346 04b6be50a2526c7a26a63715f441c47e1aa1f9be
child 729220 527867744ff759b8175b1808c8611fc4679a9408
push id77298
push userbmo:gandalf@aviary.pl
push dateThu, 31 Aug 2017 15:43:56 +0000
reviewerspike
bugs1390461
milestone57.0a1
Bug 1390461 - Update langpack-webext to use WEBEXT_LANGPACKS mk flag. r?pike MozReview-Commit-ID: HdfCwaDvjTa
browser/locales/Makefile.in
toolkit/locales/l10n.mk
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -198,9 +198,27 @@ l10n-check::
 	echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
 	@# ZIP_IN='$(ZIP_IN)' will pass down the *current* value of ZIP_IN, and
 	@# we do the same for WIN32_INSTALLER_IN, which are based on MOZ_SIMPLE_PACKAGE_NAME
 	@# not being reset, overwriting the value they would get with MOZ_SIMPLE_PACKAGE_NAME
 	@# reset.
 	$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' \
 	    ZIP_IN='$(ZIP_IN)' MOZ_SIMPLE_PACKAGE_NAME=
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(MOZ_PKG_DIR)$(_RESPATH)
-	cd $(DIST)/l10n-stage && test $$(cat $(MOZ_PKG_DIR)$(_RESPATH)/update.locale) = x-test
+	(cd $(DIST)/l10n-stage && test $$(cat $(MOZ_PKG_DIR)$(_RESPATH)/update.locale) = x-test)
+	@# package langpack as web extension, too, run some tests on it
+	$(MAKE) package-langpack-x-test L10NBASEDIR='$(PWD)' WEBEXT_LANGPACKS=1
+	$(MAKE) analyze-langpack-x-test
+	$(MAKE) check-clobber-l10n-x-test
+
+# Helper rules to have AB_CD set to the locale we test for testing
+# We need to split this out from l10n-check, as that needs AB_CD to be en-US
+# at the top level to unpack the right file
+analyze-langpack-%: AB_CD=$*
+analyze-langpack-%:
+	$(if $(shell unzip -qql $(ABS_DIST)/$(LANGPACK) manifest.json),$(info Found manifest.json),$(error manifest.json is missing))
+	$(if $(shell unzip -qql $(ABS_DIST)/$(LANGPACK) chrome.manifest),$(error Found chrome.manifest),$(info Not packaging chrome.manifest))
+
+check-clobber-l10n-%: AB_CD=$*
+check-clobber-l10n-%:
+	$(MAKE) clobber-x-test
+	find -P $(ABS_DIST) -name \*$(AB_CD)\* -type f -delete
+	$(RM) -r $(DIST)/l10n-stage $(UNPACKED_INSTALLER)
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -201,28 +201,24 @@ langpack-%:
 	@$(MAKE) libs-$(AB_CD)
 	@$(MAKE) package-langpack-$(AB_CD)
 
 package-langpack-%: LANGPACK_FILE=$(ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
 package-langpack-%: XPI_NAME=locale-$*
 package-langpack-%: AB_CD=$*
 package-langpack-%:
 	$(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)
+ifdef WEBEXT_LANGPACKS
+	$(call py_action,langpack_manifest,--locales $(AB_CD) --appver $(MOZ_APP_VERSION) --defines $(NEW_APP_DEFINES) --input $(DIST)/xpi-stage/locale-$(AB_CD))
+	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) -x **/*.manifest -x **/*.js -x **/*.ini $(LANGPACK_FILE) $(PKG_ZIP_DIRS) manifest.json)
+else
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \
 	  -DTK_DEFINES=$(TK_DEFINES) -DAPP_DEFINES=$(APP_DEFINES) $(MOZILLA_DIR)/toolkit/locales/generic/install.rdf -o $(DIST)/xpi-stage/$(XPI_NAME)/install.rdf)
 	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) $(LANGPACK_FILE) install.rdf $(PKG_ZIP_DIRS) chrome.manifest)
-
-langpack-webext-%: LANGPACK_FILE=$(ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
-langpack-webext-%: AB_CD=$*
-langpack-webext-%: XPI_NAME=locale-$*
-langpack-webext-%: libs-%
-	@echo 'Making new-langpack $(LANGPACK_FILE)'
-	$(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)
-	$(call py_action,langpack_manifest,--locales $(AB_CD) --appver $(MOZ_APP_VERSION) --defines $(NEW_APP_DEFINES) --input $(DIST)/xpi-stage/locale-$(AB_CD))
-	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) -x **/*.manifest -x **/*.js -x **/*.ini $(LANGPACK_FILE) $(PKG_ZIP_DIRS) manifest.json)
+endif
 
 # This variable is to allow the wget-en-US target to know which ftp server to download from
 ifndef EN_US_BINARY_URL 
 EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL)
 endif
 # In taskcluster the installer comes from another location
 ifndef EN_US_INSTALLER_BINARY_URL
 EN_US_INSTALLER_BINARY_URL = $(EN_US_BINARY_URL)