Bug 1457321: Part 1 - Add bundled dictionaries to built_in_addons.json. r=ted,rhelmer

MozReview-Commit-ID: GxCSXXaz8kz

--HG--
extra : rebase_source : a334cfbeee786aeaca373b5a7fc8107fa44c2243
This commit is contained in:
Kris Maglione 2018-04-27 15:42:55 -07:00
parent d9040aac36
commit 4900714df7
4 changed files with 54 additions and 1 deletions

View File

@ -103,4 +103,4 @@ 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)

View File

@ -112,3 +112,6 @@ $(TOPOBJDIR)/build/application.ini: $(TOPOBJDIR)/buildid.h $(TOPOBJDIR)/source-r
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

View File

@ -48,6 +48,10 @@ $(ABS_DIST)/fennec/$(OMNIJAR_NAME): FORCE
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

View File

@ -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:]))