mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1134633 - convert makefile rules with props2arrays.py to use moz.build GENERATED_FILES; r=mshal
Now that GENERATED_FILES can generate makefile rules for generating files, we can start moving rules from Makefile.in's into moz.build.
This commit is contained in:
parent
a1a8fae426
commit
461d0d9d2b
@ -1,17 +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
|
||||
|
||||
PROPS2ARRAYS = $(topsrcdir)/intl/locale/props2arrays.py
|
||||
labelsencodings.properties.h: $(PROPS2ARRAYS) labelsencodings.properties
|
||||
$(PYTHON) $^ $@
|
||||
localesfallbacks.properties.h: $(PROPS2ARRAYS) localesfallbacks.properties
|
||||
$(PYTHON) $^ $@
|
||||
domainsfallbacks.properties.h: $(PROPS2ARRAYS) domainsfallbacks.properties
|
||||
$(PYTHON) $^ $@
|
||||
encodingsgroups.properties.h: $(PROPS2ARRAYS) encodingsgroups.properties
|
||||
$(PYTHON) $^ $@
|
||||
nonparticipatingdomains.properties.h: $(PROPS2ARRAYS) nonparticipatingdomains.properties
|
||||
$(PYTHON) $^ $@
|
@ -25,13 +25,22 @@ LOCAL_INCLUDES += [
|
||||
'/intl/locale',
|
||||
]
|
||||
|
||||
GENERATED_FILES += [
|
||||
'domainsfallbacks.properties.h',
|
||||
'encodingsgroups.properties.h',
|
||||
'labelsencodings.properties.h',
|
||||
'localesfallbacks.properties.h',
|
||||
'nonparticipatingdomains.properties.h',
|
||||
]
|
||||
props2arrays = TOPSRCDIR + '/intl/locale/props2arrays.py'
|
||||
prefixes = (
|
||||
'domainsfallbacks',
|
||||
'encodingsgroups',
|
||||
'labelsencodings',
|
||||
'localesfallbacks',
|
||||
'nonparticipatingdomains',
|
||||
)
|
||||
|
||||
for prefix in prefixes:
|
||||
input_file = prefix + '.properties'
|
||||
header = prefix + '.properties.h'
|
||||
GENERATED_FILES += [header]
|
||||
props = GENERATED_FILES[header]
|
||||
props.script = props2arrays
|
||||
props.inputs = [input_file]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'test/mochitest.ini',
|
||||
|
@ -1,9 +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
|
||||
|
||||
PROPS2ARRAYS = $(topsrcdir)/intl/locale/props2arrays.py
|
||||
langGroups.properties.h: $(PROPS2ARRAYS) langGroups.properties
|
||||
$(PYTHON) $^ $@
|
@ -64,6 +64,9 @@ RESOURCE_FILES += [
|
||||
GENERATED_FILES += [
|
||||
'langGroups.properties.h',
|
||||
]
|
||||
langgroups = GENERATED_FILES['langGroups.properties.h']
|
||||
langgroups.script = 'props2arrays.py'
|
||||
langgroups.inputs = ['langGroups.properties']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
CXXFLAGS += CONFIG['MOZ_QT_CFLAGS']
|
||||
|
@ -4,36 +4,24 @@
|
||||
|
||||
import sys
|
||||
|
||||
mappings = {}
|
||||
|
||||
propFile = open(sys.argv[1], "r");
|
||||
|
||||
for line in propFile:
|
||||
line = line.strip()
|
||||
if not line.startswith('#'):
|
||||
parts = line.split("=", 1)
|
||||
if len(parts) == 2 and len(parts[0]) > 0:
|
||||
mappings[parts[0].strip()] = parts[1].strip()
|
||||
def main(header, propFile):
|
||||
mappings = {}
|
||||
|
||||
with open(propFile, 'r') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line.startswith('#'):
|
||||
parts = line.split("=", 1)
|
||||
if len(parts) == 2 and len(parts[0]) > 0:
|
||||
mappings[parts[0].strip()] = parts[1].strip()
|
||||
|
||||
propFile.close()
|
||||
keys = mappings.keys()
|
||||
keys.sort()
|
||||
|
||||
keys = mappings.keys()
|
||||
keys.sort()
|
||||
header.write("// This is a generated file. Please do not edit.\n")
|
||||
header.write("// Please edit the corresponding .properties file instead.\n")
|
||||
|
||||
hFile = open(sys.argv[2], "w");
|
||||
|
||||
hFile.write("// This is a generated file. Please do not edit.\n")
|
||||
hFile.write("// Please edit the corresponding .properties file instead.\n")
|
||||
|
||||
first = 1
|
||||
for key in keys:
|
||||
if first:
|
||||
first = 0
|
||||
else:
|
||||
hFile.write(',\n')
|
||||
hFile.write('{ "%s", "%s", (const char*)NS_INT32_TO_PTR(%d) }'
|
||||
% (key, mappings[key], len(mappings[key])));
|
||||
hFile.write('\n')
|
||||
hFile.flush()
|
||||
hFile.close()
|
||||
entries = ['{ "%s", "%s", (const char*)NS_INT32_TO_PTR(%d) }'
|
||||
% (key, mappings[key], len(mappings[key])) for key in keys]
|
||||
header.write(',\n'.join(entries) + '\n')
|
||||
|
||||
|
@ -1,9 +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
|
||||
|
||||
unixcharset.properties.h: $(srcdir)/../props2arrays.py unixcharset.properties
|
||||
$(PYTHON) $^ $@
|
@ -24,6 +24,10 @@ FINAL_LIBRARY = 'xul'
|
||||
GENERATED_FILES = [
|
||||
'unixcharset.properties.h',
|
||||
]
|
||||
unixcharset = GENERATED_FILES['unixcharset.properties.h']
|
||||
unixcharset.script = '../props2arrays.py'
|
||||
unixcharset.inputs = ['unixcharset.properties']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'..',
|
||||
]
|
||||
|
@ -1,9 +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
|
||||
|
||||
wincharset.properties.h: $(srcdir)/../props2arrays.py wincharset.properties
|
||||
$(PYTHON) $^ $@
|
@ -16,6 +16,10 @@ FINAL_LIBRARY = 'xul'
|
||||
GENERATED_FILES = [
|
||||
'wincharset.properties.h',
|
||||
]
|
||||
wincharset = GENERATED_FILES['wincharset.properties.h']
|
||||
wincharset.script = '../props2arrays.py'
|
||||
wincharset.inputs = ['wincharset.properties']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'..',
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user