Bug 1209401 - Don't use preprocessor forced includes for API keys in nsURLFormatter.js. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 25 Sep 2015 15:47:42 +0900
changeset 265145 0eedb958866d
parent 265144 e5fa86cd2980
child 265146 a775aa12120a
push id29456
push usercbook@mozilla.com
push date2015-09-30 10:48 +0000
treeherdermozilla-central@97e537f85183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1209401
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1209401 - Don't use preprocessor forced includes for API keys in nsURLFormatter.js. r=gps
config/faster/rules.mk
toolkit/components/urlformatter/Makefile.in
toolkit/components/urlformatter/api_keys.in
toolkit/components/urlformatter/moz.build
toolkit/components/urlformatter/nsURLFormatter.js
--- a/config/faster/rules.mk
+++ b/config/faster/rules.mk
@@ -184,25 +184,16 @@ jar-%:
 
 # GENERATED_FILES are not supported yet, and even if they were, the
 # dependencies are missing information.
 $(foreach p,linux osx windows,jar-browser-themes-$(p)-jar.mn): \
 jar-browser-themes-%-jar.mn: \
 	$(TOPOBJDIR)/browser/themes/%/tab-selected-end.svg \
 	$(TOPOBJDIR)/browser/themes/%/tab-selected-start.svg
 
-# These files are manually generated from
-# toolkit/components/urlformatter/Makefile.in and are force-included so that
-# the corresponding defines don't end up in the command lines.
-KEYS = mozilla_api_key google_api_key google_oauth_api_key bing_api_key
-$(TOPOBJDIR)/dist/bin/components/nsURLFormatter.js: \
-	$(addprefix $(TOPOBJDIR)/toolkit/components/urlformatter/, $(KEYS))
-$(TOPOBJDIR)/dist/bin/components/nsURLFormatter.js: defines += \
-	$(addprefix -I $(TOPOBJDIR)/toolkit/components/urlformatter/,$(KEYS))
-
 # Extra dependencies and/or definitions for preprocessed files.
 $(TOPOBJDIR)/dist/bin/application.ini: $(TOPOBJDIR)/config/buildid
 $(TOPOBJDIR)/dist/bin/application.ini: defines += \
 	-DAPP_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid)
 
 # Files to build with the recursive backend and simply copy
 $(TOPOBJDIR)/dist/bin/greprefs.js: $(TOPOBJDIR)/modules/libpref/greprefs.js
 $(TOPOBJDIR)/dist/bin/platform.ini: $(TOPOBJDIR)/toolkit/xre/platform.ini
deleted file mode 100644
--- a/toolkit/components/urlformatter/Makefile.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# 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/.
-
-export:: mozilla_api_key google_api_key google_oauth_api_key bing_api_key
-
-EXTRA_PP_COMPONENTS_FLAGS = -I mozilla_api_key -I google_api_key -I google_oauth_api_key -I bing_api_key
-
-include $(topsrcdir)/config/rules.mk
-
-mozilla_api_key:
-	@echo '#define MOZ_MOZILLA_API_KEY $(MOZ_MOZILLA_API_KEY)' > $@
-
-google_api_key:
-	@echo '#define MOZ_GOOGLE_API_KEY $(MOZ_GOOGLE_API_KEY)' > $@
-
-google_oauth_api_key:
-	@echo '#define MOZ_GOOGLE_OAUTH_API_KEY $(MOZ_GOOGLE_OAUTH_API_KEY)' >> $@
-	@echo '#define MOZ_GOOGLE_OAUTH_API_CLIENTID $(MOZ_GOOGLE_OAUTH_API_CLIENTID)' >> $@
-
-bing_api_key:
-	@echo '#define MOZ_BING_API_KEY $(MOZ_BING_API_KEY)' > $@
-	@echo '#define MOZ_BING_API_CLIENTID $(MOZ_BING_API_CLIENTID)' >> $@
-
-GARBAGE += mozilla_api_key google_api_key google_oauth_api_key bing_api_key
new file mode 100644
--- /dev/null
+++ b/toolkit/components/urlformatter/api_keys.in
@@ -0,0 +1,6 @@
+#define MOZ_MOZILLA_API_KEY @MOZ_MOZILLA_API_KEY@
+#define MOZ_GOOGLE_API_KEY @MOZ_GOOGLE_API_KEY@
+#define MOZ_GOOGLE_OAUTH_API_KEY @MOZ_GOOGLE_OAUTH_API_KEY@
+#define MOZ_GOOGLE_OAUTH_API_CLIENTID @MOZ_GOOGLE_OAUTH_API_CLIENTID@
+#define MOZ_BING_API_KEY @MOZ_BING_API_KEY@
+#define MOZ_BING_API_CLIENTID @MOZ_BING_API_CLIENTID@
--- a/toolkit/components/urlformatter/moz.build
+++ b/toolkit/components/urlformatter/moz.build
@@ -14,8 +14,14 @@ XPIDL_MODULE = 'urlformatter'
 
 EXTRA_COMPONENTS += [
     'nsURLFormatter.manifest',
 ]
 
 EXTRA_PP_COMPONENTS += [
     'nsURLFormatter.js',
 ]
+
+CONFIGURE_SUBST_FILES += [
+    'api_keys',
+]
+
+DEFINES['OBJDIR'] = OBJDIR
--- a/toolkit/components/urlformatter/nsURLFormatter.js
+++ b/toolkit/components/urlformatter/nsURLFormatter.js
@@ -1,9 +1,10 @@
 #filter substitution
+#include @OBJDIR@/api_keys
 
 /* 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/. */
 
  /**
  * @class nsURLFormatterService
  *