Bug 883954 - part 3 - build etld_data.inc using new GENERATED_FILES functionality; r=gps
authorNathan Froyd <froydnj@mozilla.com>
Tue, 16 Dec 2014 15:15:14 -0500
changeset 256807 81256bde8592e79bfd10c0be237a25213aa638d3
parent 256806 21b8e84737816a47e2b0b8ce4c54e4501da3b2d3
child 256808 797672558e447aefe43c3ea6ee812351d3e5e9f1
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs883954
milestone38.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 883954 - part 3 - build etld_data.inc using new GENERATED_FILES functionality; r=gps As a proof-of-usefulness, let's change the build process for etld_data.inc to write out the rules generating it automatically through moz.build.
netwerk/dns/Makefile.in
netwerk/dns/moz.build
netwerk/dns/prepare_tlds.py
deleted file mode 100644
--- a/netwerk/dns/Makefile.in
+++ /dev/null
@@ -1,11 +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/.
-
-include $(topsrcdir)/config/rules.mk
-
-# Generate the include file containing compact, static definitions
-# for effective TLD data.
-etld_data.inc: $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat
-	$(PYTHON) $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat > etld_data.inc
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -54,13 +54,16 @@ MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 GENERATED_FILES = [
     'etld_data.inc',
 ]
+etld_data = GENERATED_FILES['etld_data.inc']
+etld_data.script = 'prepare_tlds.py'
+etld_data.inputs = ['effective_tld_names.dat']
 
 # need to include etld_data.inc
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
--- a/netwerk/dns/prepare_tlds.py
+++ b/netwerk/dns/prepare_tlds.py
@@ -90,27 +90,24 @@ class EffectiveTLDEntry:
     "True if this entry represents a class of effective TLDs."
     return self._wild
 
 
 #################
 # DO EVERYTHING #
 #################
 
-def main():
+def main(output, effective_tld_filename):
   """
-  argv[1] is the effective TLD file to parse.
+  effective_tld_filename is the effective TLD file to parse.
   A C++ array of { domain, exception, wild } entries representing the
-  eTLD file is then printed to stdout.
+  eTLD file is then printed to output.
   """
 
   def boolStr(b):
     if b:
       return "true"
     return "false"
 
-  for etld in getEffectiveTLDs(sys.argv[1]):
+  for etld in getEffectiveTLDs(effective_tld_filename):
     exception = boolStr(etld.exception())
     wild = boolStr(etld.wild())
-    print 'ETLD_ENTRY("%s", %s, %s)' % (etld.domain(), exception, wild)
-
-if __name__ == '__main__':
-  main()
+    output.write('ETLD_ENTRY("%s", %s, %s)\n' % (etld.domain(), exception, wild))