Bug 1641693 - Replace a bunch of uses of `GENERATED_FILES` with the `GeneratedFile` template r=necko-reviewers,geckoview-reviewers,aklotz,dragana,froydnj

Also update documentation to suggest using the `GeneratedFile` template rather than directly referencing `GENERATED_FILES` where possible.

Differential Revision: https://phabricator.services.mozilla.com/D77496
This commit is contained in:
Ricky Stewart 2020-06-01 16:00:28 +00:00
Родитель 0740f48e07
Коммит 0bbaac721b
12 изменённых файлов: 64 добавлений и 113 удалений

Просмотреть файл

@ -47,16 +47,12 @@ LOCAL_INCLUDES += [
'/widget/cocoa',
]
GENERATED_FILES += [
'MacSelectorMap.h',
'MacSelectorMap.mm',
]
GENERATED_FILES['MacSelectorMap.mm'].script = '/accessible/mac/SelectorMapGen.py:gen_mm'
GENERATED_FILES['MacSelectorMap.mm'].inputs = ['MOXAccessibleProtocol.h']
GENERATED_FILES['MacSelectorMap.h'].script = '/accessible/mac/SelectorMapGen.py:gen_h'
GENERATED_FILES['MacSelectorMap.h'].inputs = ['MOXAccessibleProtocol.h']
GeneratedFile('MacSelectorMap.h',
script='/accessible/mac/SelectorMapGen.py', entry_point='gen_h',
inputs=['MOXAccessibleProtocol.h'])
GeneratedFile('MacSelectorMap.mm',
script='/accessible/mac/SelectorMapGen.py', entry_point='gen_mm',
inputs=['MOXAccessibleProtocol.h'])
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -55,11 +55,9 @@ if CONFIG['WRAP_STL_INCLUDES']:
# file_generate action will create it for us, but we want to create all
# the files in gen_wrappers()
outputs = tuple(['stl.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers])
GENERATED_FILES += [outputs]
stl = GENERATED_FILES[outputs]
stl.script = 'make-stl-wrappers.py:gen_wrappers'
stl.flags = [output_dir, stl_compiler, template_file]
stl.flags.extend(stl_headers)
GeneratedFile(
*outputs, script='make-stl-wrappers.py', entry_point='gen_wrappers',
flags=[output_dir, stl_compiler, template_file] + stl_headers)
# Wrap <windows.h> to make it easier to use correctly
# NOTE: If we aren't wrapping STL includes, we're building part of the browser
@ -78,9 +76,6 @@ if CONFIG['WRAP_SYSTEM_INCLUDES']:
include('system-headers.mozbuild')
output_dir = '../dist/system_wrappers'
outputs = tuple(['system-header.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers + system_headers])
GENERATED_FILES += [outputs]
system = GENERATED_FILES[outputs]
system.script = 'make-system-wrappers.py:gen_wrappers'
system.flags = [output_dir]
system.flags.extend(stl_headers)
system.flags.extend(system_headers)
GeneratedFile(*outputs, script='make-system-wrappers.py',
entry_point='gen_wrappers',
flags = [output_dir] + stl_headers + system_headers)

Просмотреть файл

@ -137,10 +137,8 @@ TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test['css-visited'] += [
DEFINES['MOZILLA_INTERNAL_API'] = True
if CONFIG['COMPILE_ENVIRONMENT']:
GENERATED_FILES += ['css_properties.js']
GENERATED_FILES['css_properties.js'].script = 'gen-css-properties.py'
GENERATED_FILES['css_properties.js'].inputs = [
'css_properties_like_longhand.js',
'!host_ListCSSProperties%s' % CONFIG['HOST_BIN_SUFFIX'],
]
GeneratedFile('css_properties.js', script='gen-css-properties.py',
inputs=[
'css_properties_like_longhand.js',
'!host_ListCSSProperties%s' % CONFIG['HOST_BIN_SUFFIX']])
TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test += ['!css_properties.js']

Просмотреть файл

@ -115,33 +115,21 @@ if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
'mc_init_tmpl.c',
]
GENERATED_FILES += [
'16bd_%s' % p for p in bitdepth_basenames
]
SOURCES += [
'!16bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['16bd_%s' % f]
a.script = '../generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '16']
SOURCES += [
'!16bd_%s' % f
]
GeneratedFile('16bd_%s' % f, script='../generate_source.py',
entry_point='add_define', inputs=[relative_path + f],
flags=['BITDEPTH', '16'])
SOURCES += [
'!8bd_%s' % f
]
GeneratedFile('8bd_%s' % f, script='../generate_source.py',
entry_point='add_define', inputs=[relative_path + f],
flags=['BITDEPTH', '8'])
GENERATED_FILES += [
'8bd_%s' % p for p in bitdepth_basenames
]
SOURCES += [
'!8bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['8bd_%s' % f]
a.script = '../generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '8']
elif CONFIG['CPU_ARCH'] == 'arm' or CONFIG['CPU_ARCH'] == 'aarch64':
SOURCES += [
'../../../third_party/dav1d/src/arm/cpu.c',
@ -162,33 +150,19 @@ elif CONFIG['CPU_ARCH'] == 'arm' or CONFIG['CPU_ARCH'] == 'aarch64':
'mc_init_tmpl.c',
]
GENERATED_FILES += [
'16bd_%s' % p for p in bitdepth_basenames
]
SOURCES += [
'!16bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['16bd_%s' % f]
a.script = '../generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '16']
GENERATED_FILES += [
'8bd_%s' % p for p in bitdepth_basenames
]
SOURCES += [
'!8bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['8bd_%s' % f]
a.script = '../generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '8']
SOURCES += [
'!16bd_%s' % f
]
GeneratedFile('16bd_%s' % f, script='../generate_source.py',
entry_point='add_define', inputs=[relative_path + f],
flags=['BITDEPTH', '16'])
SOURCES += [
'!8bd_%s' % f
]
GeneratedFile('8bd_%s' % f, script='../generate_source.py',
entry_point='add_define', inputs=[relative_path + f],
flags=['BITDEPTH', '8'])
# BITDEPTH .S files
if CONFIG['CPU_ARCH'] == 'aarch64':

Просмотреть файл

@ -9,19 +9,12 @@ EXPORTS += [
]
if CONFIG['COMPILE_ENVIRONMENT']:
GENERATED_FILES += [
'mp4parse_ffi_generated.h',
]
GeneratedFile('mp4parse_ffi_generated.h',
script='/build/RunCbindgen.py', entry_point='generate',
inputs=['/third_party/rust/mp4parse_capi'])
EXPORTS += [ # Should this be namespaced? EXPORTS.mozilla.media
'!mp4parse_ffi_generated.h',
]
ffi_generated = GENERATED_FILES['mp4parse_ffi_generated.h']
ffi_generated.script = '/build/RunCbindgen.py:generate'
ffi_generated.inputs = [
'/third_party/rust/mp4parse_capi',
]
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -121,11 +121,8 @@ UNIFIED_SOURCES += [
gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
GENERATED_FILES += [gen_all_tuple]
static_pref_list = GENERATED_FILES[gen_all_tuple]
static_pref_list.script = 'init/generate_static_pref_list.py:emit_code'
static_pref_list.inputs = ['init/StaticPrefList.yaml']
GeneratedFile(*gen_all_tuple, script='init/generate_static_pref_list.py',
entry_point='emit_code', inputs=['init/StaticPrefList.yaml'])
PYTHON_UNITTEST_MANIFESTS += [
'test/python.ini',

Просмотреть файл

@ -47,12 +47,10 @@ blocklist_header_types = ['A11y', 'Launcher', 'Legacy', 'Test']
blocklist_file_leaf_tpl = 'WindowsDllBlocklist{0}Defs.h'
blocklist_files = tuple([blocklist_file_leaf_tpl.format(type)
for type in blocklist_header_types])
GENERATED_FILES += [
blocklist_files
]
blocklist_defs = GENERATED_FILES[blocklist_files]
blocklist_defs.script = 'gen_dll_blocklist_defs.py:gen_blocklists'
blocklist_defs.inputs = ['WindowsDllBlocklistDefs.in']
GeneratedFile(*blocklist_files, script='gen_dll_blocklist_defs.py',
entry_point='gen_blocklists',
inputs=['WindowsDllBlocklistDefs.in'])
EXPORTS.mozilla += ['!' + hdr for hdr in blocklist_files]
FINAL_LIBRARY = 'mozglue'

Просмотреть файл

@ -4,11 +4,7 @@
# 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/.
GENERATED_FILES = ['fake_remote_dafsa.bin']
fake_remote_dafsa = GENERATED_FILES['fake_remote_dafsa.bin']
fake_remote_dafsa.script = '../../../prepare_tlds.py'
fake_remote_dafsa.inputs = ['fake_public_suffix_list.dat']
fake_remote_dafsa.flags = ['bin']
GeneratedFile('fake_remote_dafsa.bin', script='../../../prepare_tlds.py',
inputs=['fake_public_suffix_list.dat'], flags = ['bin'])
TEST_HARNESS_FILES.xpcshell.netwerk.dns.tests.unit.data += ['!fake_remote_dafsa.bin']

Просмотреть файл

@ -1423,6 +1423,12 @@ VARIABLES = {
list,
"""Generic generated files.
Unless you have a reason not to, use the GeneratedFile template rather
than referencing GENERATED_FILES directly. The GeneratedFile template
has all the same arguments as the attributes listed below (``script``,
``inputs``, ``flags``, ``force``), plus an additional ``entry_point``
argument to specify a particular function to run in the given script.
This variable contains a list of files for the build system to
generate at export time. The generation method may be declared
with optional ``script``, ``inputs``, ``flags``, and ``force``

Просмотреть файл

@ -1,3 +1,5 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
@ -18,8 +20,6 @@ for addon in addons:
indir = 'addons/%s' % addon
xpi = '%s.xpi' % indir
GENERATED_FILES += [xpi]
GENERATED_FILES[xpi].script = '../create_xpi.py'
GENERATED_FILES[xpi].inputs = [indir]
GeneratedFile(xpi, script='../create_xpi.py', inputs=[indir])
output_dir += ['!%s' % xpi]

Просмотреть файл

@ -24,9 +24,7 @@ for addon in addons:
indir = 'addons/%s' % addon
path = '%s.%s' % (indir, file_type)
GENERATED_FILES += [path]
GENERATED_FILES[path].script = '../create_xpi.py'
GENERATED_FILES[path].inputs = [indir]
GeneratedFile(path, script='../create_xpi.py', inputs=[indir])
output_dir += ['!%s' % path]

Просмотреть файл

@ -37,9 +37,9 @@ t = tuple(['sdk_bindings'] +
['%s.cpp' % stem for stem in generated] +
['%s.h' % stem for stem in generated])
GENERATED_FILES += [t]
GENERATED_FILES[t].script = '/mobile/android/gradle.py:generate_sdk_bindings'
GENERATED_FILES[t].inputs += ['%s-classes.txt' % stem for stem in generated]
GeneratedFile(*t, script='/mobile/android/gradle.py',
entry_point='generate_sdk_bindings',
inputs=['%s-classes.txt' % stem for stem in generated])
FINAL_LIBRARY = 'xul'