Bug 883254 - Add the duckduckgo searchplugin to certain locales. f=glandium, r=mfinkle, a=lmandel
authorNick Alexander <nalexander@mozilla.com>
Tue, 04 Nov 2014 17:03:55 -0500
changeset 218169 9b6e72bafd64
parent 218168 6233fa4970a4
child 218171 204173cef30b
child 218172 6994f1c79260
push id567
push userryanvm@gmail.com
push date2014-11-04 22:03 +0000
treeherdermozilla-release@9b6e72bafd64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lmandel
bugs883254
milestone33.1
Bug 883254 - Add the duckduckgo searchplugin to certain locales. f=glandium, r=mfinkle, a=lmandel The purpose of this patch is to union a set of extra search plugins into the set of search plugins for a specific subset of locales in a multi-locale build. This is a temporary hack for a single release; for this release, we don't care about burning single-locale repacks. I don't think we support finding a localized JAR resource -- like (%searchplugins/list.txt) -- from the object directory directly, so: * I made the list filename depend on the locale; * generated the locale-dependent list at build time; * had the generated JAR include the list from the object directory.
mobile/locales/Makefile.in
mobile/locales/jar.mn
--- a/mobile/locales/Makefile.in
+++ b/mobile/locales/Makefile.in
@@ -62,17 +62,18 @@ GARBAGE += $(bookmarks) $(bookmarks-ts)
 
 ## Searchlist plugin config
 plugin-file-array = \
   $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \
   $(srcdir)/en-US/searchplugins/list.txt \
   $(NULL)
 
 ###########################################################################
-plugin_file    = $(firstword $(plugin-file-array))
+plugin_source_file = $(firstword $(plugin-file-array))
+plugin_file = overrides/list_$(AB_CD).txt
 plugin-file-ts = $(tgt-gendir)/$(subst $(topsrcdir)/,$(NULL),$(plugin_file)).ts
 
 GARBAGE += $(plugin-file-ts)
 # ---------------------------------------------------------------------------
 # plugin-file-ts track searchlist file used ($path/list.txt)
 # and time when the file was last modified.
 ###########################################################################
 plugin-file-ts-preqs = \
@@ -91,32 +92,59 @@ plugin-file-ts-preqs = \
 search-jar-common = tmp-search.jar.mn
 search-jar        = $(tgt-gendir)/$(search-jar-common)
 search-jar-ts     = $(search-jar).ts
 
 GARBAGE += $(search-jar) $(search-jar-ts) $(search-jar-common)
 # ---------------------------------------------------------------------------
 # search-jar contains a list of providers for the search plugin
 ###########################################################################
-SEARCH_PLUGINS = $(shell cat $(plugin_file))
-$(call errorIfEmpty,SEARCH_PLUGINS)
 
 search-jar-preqs = \
   $(plugin-file-ts) \
   $(if $(IS_LANGUAGE_REPACK),FORCE) \
+  $(GLOBAL_DEPS) \
   $(NULL)
 
+# These locales will have the additional search plugins listed in
+# extra_search_plugins merged into their set of search plugins.
+extra_search_plugin_locales := \
+  de \
+  en-GB \
+  en-US \
+  es-ES \
+  es-MX \
+  fr \
+  $(NULL)
+
+# These additional search plugins will be merged into the set of search plugins
+# for each locale listed in extra_search_plugin_locales.
+extra_search_plugins := \
+  duckduckgo \
+  $(NULL)
+
+# Take the set of locale specified search plugins, possible add extra search
+# plugins, sort, and then make unique.  The order of search plugins is not
+# important: we order the top plugins using region.properties and then sort the
+# remainder alphabetically.
+$(plugin_file): $(plugin_source_file) $(call mkdir_deps,$(dir $(plugin_file)))
+	(cat $(plugin_source_file);\
+		$(if $(filter $(AB_CD),$(extra_search_plugin_locales)),\
+			$(foreach plugin,$(extra_search_plugins),echo $(plugin);))\
+	) | sort -u > $@
+
 .PHONY: search-jar
 search-jar: $(search-jar)
 $(search-jar): $(search-jar-preqs)
 	@echo '\nGenerating: search-jar'
 	printf '$(AB_CD).jar:' > $@
 	ln -fn $@ .
-	printf '$(foreach plugin,$(SEARCH_PLUGINS),$(subst __PLUGIN_SUBST__,$(plugin), \n locale/$(AB_CD)/browser/searchplugins/__PLUGIN_SUBST__.xml (__PLUGIN_SUBST__.xml)))' >>  $@
-	@echo   >> $@
+	$(foreach plugin,$(shell cat $(plugin_file)),\
+		echo " locale/$(AB_CD)/browser/searchplugins/$(plugin).xml ($(plugin).xml)" >> $@;)
+	echo " locale/$(AB_CD)/browser/searchplugins/list.txt ($(plugin_file))" >> $@
 
 ###################
 search-dir-deps = \
   $(plugin-file) \
   $(dir-chrome) \
   $(NULL)
 
 search-preqs =\
--- a/mobile/locales/jar.mn
+++ b/mobile/locales/jar.mn
@@ -2,17 +2,19 @@
 # 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/.
 
 
 @AB_CD@.jar:
 % locale browser @AB_CD@ %locale/@AB_CD@/browser/
   locale/@AB_CD@/browser/region.properties        (%chrome/region.properties)
-  locale/@AB_CD@/browser/searchplugins/list.txt   (%searchplugins/list.txt)
+
+# In addition, per-locale searchplugin XML files, and the master
+# searchplugins/list.txt, are generated at build-time.
 
 # Fennec-specific overrides of generic strings
 * locale/@AB_CD@/browser/netError.dtd             (%overrides/netError.dtd)
 % override chrome://global/locale/netError.dtd    chrome://browser/locale/netError.dtd
 * locale/@AB_CD@/browser/appstrings.properties    (%overrides/appstrings.properties)
 % override chrome://global/locale/appstrings.properties chrome://browser/locale/appstrings.properties
 * locale/@AB_CD@/browser/passwordmgr.properties    (%overrides/passwordmgr.properties)
 % override chrome://passwordmgr/locale/passwordmgr.properties chrome://browser/locale/passwordmgr.properties