Bug 923950 - Fix Android single locale repacks. r=glandium

There are two parts to this.  The first is to add AndroidManifest.xml
as a dependency to the "no dependencies" ap_ built during packaging.
The aapt call requires it.  So "no dependencies" is more accurately
"no *resource* dependencies".

The second is to avoid including the Android res/ directory in the
language repack step.  What happens is that the l10n.py script sees
the Android res/ files left in the dist/ directory after unpacking and
expects to find them in the objdir.  They're not there, so the script
fails.  To avoid this, we delete them after unpacking.  See the
comments in packager.mk describing this process.

--HG--
extra : rebase_source : 35c3c125dddcd575c1a5e8ad58f9aa13ff2db4c3
This commit is contained in:
Nick Alexander 2013-12-14 15:36:17 -08:00
parent 357b12898a
commit 709a4a7087
3 changed files with 22 additions and 7 deletions

View File

@ -180,7 +180,7 @@ res/values/strings.xml: FORCE
$(MAKE) -C locales
all_resources = \
AndroidManifest.xml \
$(CURDIR)/AndroidManifest.xml \
$(android_res_files) \
$(ANDROID_GENERATED_RESFILES) \
$(NULL)
@ -228,8 +228,8 @@ endef
# .aapt.deps: $(all_resources)
$(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,$(gecko_package_dir)/,./))
# .aapt.nodeps: FORCE
$(eval $(call aapt_command,.aapt.nodeps,FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
# .aapt.nodeps: $(CURDIR)/AndroidManifest.xml FORCE
$(eval $(call aapt_command,.aapt.nodeps,$(CURDIR)/AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
fennec_ids.txt: $(gecko_package_dir)/R.java fennec-ids-generator.py
$(PYTHON) $(topsrcdir)/mobile/android/base/fennec-ids-generator.py -i $< -o $@

View File

@ -507,8 +507,8 @@ def main(args=None):
jm.relativesrcdir = options.relativesrcdir
jm.l10nmerge = options.locale_mergedir
if jm.l10nmerge and not os.path.isdir(jm.l10nmerge):
logging.warning("WARNING: --locale-mergedir passed, but '%s' does not exist. Ignore this message if the locale is complete."
)
logging.warning("WARNING: --locale-mergedir passed, but '%s' does not exist. "
"Ignore this message if the locale is complete." % jm.l10nmerge)
elif options.locale_mergedir:
p.error('l10n-base required when using locale-mergedir')
jm.localedirs = options.l10n_src

View File

@ -445,14 +445,28 @@ OMNIJAR_NAME := $(notdir $(OMNIJAR_NAME))
# thing if there are resource changes in between build time and
# package time. We try to prevent mismatched resources by erroring
# out if the compiled resource IDs are not the same as the resource
# IDs being packaged.
# IDs being packaged. If we're doing a single locale repack, however,
# we don't have a complete object directory, so we can't compare
# resource IDs.
# A note on the res/ directory. We unzip the ap_ during packaging,
# which produces the res/ directory. This directory is then included
# in the final package. When we unpack (during locale repacks), we
# need to remove the res/ directory because these resources confuse
# the l10n packaging script that updates omni.ja: the script tries to
# localize the contents of the res/ directory, which fails. Instead,
# after the l10n packaging script completes, we build the ap_
# described above (which includes freshly localized Android resources)
# and the res/ directory is taken from the ap_ as part of the regular
# packaging.
PKG_SUFFIX = .apk
INNER_MAKE_PACKAGE = \
$(if $(ALREADY_SZIPPED),,$(foreach lib,$(SZIP_LIBRARIES),host/bin/szip $(MOZ_SZIP_FLAGS) $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(lib) && )) \
make -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
cp $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ $(_ABS_DIST)/gecko.ap_ && \
( diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \
( (test ! -f $(GECKO_APP_AP_PATH)/R.txt && echo "*** Warning: The R.txt that is being packaged might not agree with the R.txt that was built. This is normal during l10n repacks.") || \
diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \
(echo "*** Error: The R.txt that was built and the R.txt that is being packaged are not the same. Rebuild mobile/android/base and re-package." && exit 1)) && \
( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
mkdir -p lib/$(ABI_DIR) && \
@ -487,6 +501,7 @@ INNER_UNMAKE_PACKAGE = \
mv lib/$(ABI_DIR)/libmozglue.so . && \
mv lib/$(ABI_DIR)/*plugin-container* $(MOZ_CHILD_PROCESS_NAME) && \
rm -rf lib/$(ABI_DIR) \
rm -rf res \
$(if $(filter-out ./,$(OMNIJAR_DIR)), \
&& mv $(OMNIJAR_DIR)$(OMNIJAR_NAME) $(OMNIJAR_NAME)) )
endif