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.
This commit is contained in:
Nathan Froyd 2014-12-16 15:15:14 -05:00
parent 9e97e8867e
commit c70882c00e
3 changed files with 8 additions and 19 deletions

View File

@ -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

View File

@ -59,6 +59,9 @@ 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 += [

View File

@ -95,11 +95,11 @@ class EffectiveTLDEntry:
# 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):
@ -107,10 +107,7 @@ def main():
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))