Bug 1457321: Part 1 - Add bundled dictionaries to built_in_addons.json. r?ted,rhelmer
MozReview-Commit-ID: GxCSXXaz8kz
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -98,9 +98,9 @@ ifdef MOZ_UPDATER
mv -f '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater' '$(dist_dest)/Contents/Library/LaunchServices'
ln -s ../../../../Library/LaunchServices/org.mozilla.updater '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater'
endif
printf APPLMOZB > '$(dist_dest)/Contents/PkgInfo'
endif
.PHONY: features
tools features::
- $(PYTHON) -c 'import os, json; listing = {"system": sorted(os.listdir("$(DIST)/bin/browser/features"))}; print json.dumps(listing)' > $(DIST)/bin/browser/chrome/browser/content/browser/built_in_addons.json
+ $(call py_action,generate_builtin_addons,--features=browser/features browser/chrome/browser/content/browser/built_in_addons.json)
--- a/config/faster/rules.mk
+++ b/config/faster/rules.mk
@@ -107,8 +107,11 @@ endif
$(TOPOBJDIR)/build/application.ini: $(TOPOBJDIR)/buildid.h $(TOPOBJDIR)/source-repo.h
# The manifest of allowed system add-ons should be re-built when using
# "build faster".
ifeq ($(MOZ_BUILD_APP),browser/app)
default: $(TOPOBJDIR)/browser/app/features
endif
+ifeq ($(MOZ_BUILD_APP),mobile/android)
+default: $(TOPOBJDIR)/mobile/android/base/features
+endif
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -76,16 +76,20 @@ update-fennec-wrappers:
$(ABS_DIST)/fennec/$(OMNIJAR_NAME): FORCE
$(REPORT_BUILD)
$(MAKE) -C ../../../faster
$(MAKE) -C ../installer stage-package
$(MKDIR) -p $(@D)
rsync --update $(DIST)/fennec/$(notdir $(OMNIJAR_NAME)) $@
$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
+.PHONY: features
+features::
+ $(call py_action,generate_builtin_addons,chrome/chrome/content/built_in_addons.json)
+
ifndef MOZILLA_OFFICIAL
# Targets built very early during a Gradle build. In automation,
# these are built before Gradle is invoked, and gradle-targets is not
# made at all. This is required to avoid building gradle-targets with
# AB_CD=multi during multi-l10n builds.
gradle-targets: $(generated_resources) $(generated_files)
# Local developers update omni.ja during their builds. There's a
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/action/generate_builtin_addons.py
@@ -0,0 +1,46 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import argparse
+import json
+import os.path
+import sys
+
+import buildconfig
+
+
+def main(argv):
+ parser = argparse.ArgumentParser(
+ description='Produces a JSON manifest of built-in add-ons')
+ parser.add_argument('--features', type=str, dest='featuresdir',
+ action='store', help=('The distribution sub-directory '
+ 'containing feature add-ons'))
+ parser.add_argument('outputfile', help='File to write output to')
+ args = parser.parse_args(argv)
+
+ bindir = os.path.join(buildconfig.topobjdir, 'dist/bin')
+
+ def find_dictionaries(path):
+ dicts = {}
+ for filename in os.listdir(os.path.join(bindir, path)):
+ base, ext = os.path.splitext(filename)
+ if ext == '.dic':
+ dicts[base] = '%s/%s' % (path, filename)
+ return dicts
+
+ listing = {
+ "dictionaries": find_dictionaries("dictionaries"),
+ }
+ if args.featuresdir:
+ listing["system"] = sorted(os.listdir(os.path.join(bindir,
+ args.featuresdir)))
+
+ with open(os.path.join(bindir, args.outputfile), 'w') as fh:
+ json.dump(listing, fh, sort_keys=True)
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))