Bug 1221453 - Use ObjDirPaths for GENERATED_INCLUDES and merge with LOCAL_INCLUDES. r=gps

This commit is contained in:
Mike Hommey 2015-11-04 14:20:20 +09:00
parent 10276f39ee
commit 405622a83e
36 changed files with 78 additions and 92 deletions

View File

@ -28,11 +28,8 @@ USE_LIBS += [
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'MOZ_UPDATER'):
DEFINES[var] = CONFIG[var]
GENERATED_INCLUDES += [
'/build',
]
LOCAL_INCLUDES += [
'!/build',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/build',

View File

@ -24,11 +24,8 @@ FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
GENERATED_INCLUDES += [
'/build',
]
LOCAL_INCLUDES += [
'!/build',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/build',

View File

@ -28,11 +28,8 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
GENERATED_INCLUDES += [
'/xpcom',
]
LOCAL_INCLUDES += [
'!/xpcom',
'/dom/base',
'/netwerk/base',
'/netwerk/protocol/res',

View File

@ -41,8 +41,8 @@ WEBIDL_EXAMPLE_INTERFACES += [
'TestExampleProxyInterface',
]
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'/dom/bindings',
'/js/xpconnect/src',
'/js/xpconnect/wrappers',

View File

@ -5,14 +5,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
LOCAL_INCLUDES += [
'!/ipc/ipdl/_ipdlheaders',
'/ipc/chromium/src',
'/ipc/glue',
]
GENERATED_INCLUDES += [
'/ipc/ipdl/_ipdlheaders',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'psapi',

View File

@ -23,8 +23,10 @@ UNIFIED_SOURCES += [
DEFINES['EXPORT_JS_API'] = True
LOCAL_INCLUDES += ['..']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'..',
]
USE_LIBS += [
'static:js',

View File

@ -104,8 +104,10 @@ if CONFIG['ENABLE_ION']:
DEFINES['EXPORT_JS_API'] = True
LOCAL_INCLUDES += ['..']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'..',
]
USE_LIBS += [
'static:js',

View File

@ -541,8 +541,8 @@ if CONFIG['JS_HAS_CTYPES']:
'ctypes/Library.cpp',
]
if not CONFIG['MOZ_NATIVE_FFI']:
GENERATED_INCLUDES += [
'ctypes/libffi/include',
LOCAL_INCLUDES += [
'!ctypes/libffi/include',
]
if CONFIG['MOZ_VTUNE']:

View File

@ -24,8 +24,10 @@ if CONFIG['_MSC_VER']:
# for PGO.
NO_PGO = True
LOCAL_INCLUDES += ['..']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'..',
]
OS_LIBS += CONFIG['EDITLINE_LIBS']
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']

View File

@ -11,10 +11,8 @@ for var in ('MOZILLA_EXTERNAL_LINKAGE', 'USE_FAKE_MEDIA_STREAMS', 'USE_FAKE_PCOB
'NR_SOCKET_IS_VOID_PTR', 'HAVE_STRDUP'):
DEFINES[var] = True
GENERATED_INCLUDES += [
'/dom/bindings',
]
LOCAL_INCLUDES += [
'!/dom/bindings',
'/dom/media/',
'/ipc/chromium/src',
'/media/mtransport',

View File

@ -27,7 +27,7 @@ if CONFIG['MOZ_JEMALLOC4']:
SOURCES += [
'mozjemalloc_compat.c',
]
GENERATED_INCLUDES += ['../jemalloc/src/include']
LOCAL_INCLUDES += ['!../jemalloc/src/include']
if CONFIG['_MSC_VER']:
LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
if not CONFIG['HAVE_INTTYPES_H']:

View File

@ -69,8 +69,10 @@ if CONFIG['GNU_CC']:
DEFINES['abort'] = 'moz_abort'
GENERATED_INCLUDES += ['src/include']
LOCAL_INCLUDES += ['src/include']
LOCAL_INCLUDES += [
'!src/include',
'src/include',
]
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

View File

@ -36,8 +36,6 @@ FINAL_LIBRARY = 'mozglue'
# The strndup declaration in string.h is in an ifdef __USE_GNU section
DEFINES['_GNU_SOURCE'] = True
GENERATED_INCLUDES += ['/xpcom']
DISABLE_STL_WRAPPING = True
DEFINES['IMPL_MFBT'] = True
@ -45,7 +43,10 @@ DEFINES['IMPL_MFBT'] = True
if CONFIG['_MSC_VER']:
DIRS += ['staticruntime']
LOCAL_INCLUDES += ['/memory/build']
LOCAL_INCLUDES += [
'!/xpcom',
'/memory/build',
]
DIST_INSTALL = True

View File

@ -19,7 +19,7 @@ UNIFIED_SOURCES += [
'../mozalloc_oom.cpp',
]
GENERATED_INCLUDES += ['/xpcom']
LOCAL_INCLUDES += ['!/xpcom']
DISABLE_STL_WRAPPING = True

View File

@ -26,7 +26,7 @@ USE_LIBS += [
DEFINES['MOZ_JEMALLOC4'] = True
DEFINES['MOZ_REPLACE_JEMALLOC'] = True
GENERATED_INCLUDES += ['../../jemalloc/src/include']
LOCAL_INCLUDES += ['!../../jemalloc/src/include']
if CONFIG['_MSC_VER']:
LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
if not CONFIG['HAVE_INTTYPES_H']:

View File

@ -26,8 +26,8 @@ for var in ('ANDROID_PACKAGE_NAME',
if CONFIG['MOZ_FOLD_LIBS']:
DEFINES['MOZ_FOLD_LIBS'] = True
GENERATED_INCLUDES += ['/build']
LOCAL_INCLUDES += [
'!/build',
'../linker',
'/db/sqlite3/src',
'/ipc/chromium/src',

View File

@ -73,6 +73,6 @@ if CONFIG['MOZ_RTSP']:
'/netwerk/protocol/rtsp',
]
GENERATED_INCLUDES += [
'/netwerk/dns',
LOCAL_INCLUDES += [
'!/netwerk/dns',
]

View File

@ -47,7 +47,6 @@ from ..frontend.data import (
ExternalLibrary,
FinalTargetFiles,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
HostDefines,
HostLibrary,
@ -561,9 +560,6 @@ class RecursiveMakeBackend(CommonBackend):
elif isinstance(obj, LocalInclude):
self._process_local_include(obj.path, backend_file)
elif isinstance(obj, GeneratedInclude):
self._process_generated_include(obj.path, backend_file)
elif isinstance(obj, PerSourceFlag):
self._process_per_source_flag(obj, backend_file)
@ -1245,13 +1241,6 @@ INSTALL_TARGETS += %(prefix)s
else:
backend_file.write('LOCAL_INCLUDES += -I%s\n' % path)
def _process_generated_include(self, generated_include, backend_file):
if generated_include.startswith('/'):
path = self.environment.topobjdir.replace('\\', '/')
else:
path = ''
backend_file.write('LOCAL_INCLUDES += -I%s%s\n' % (path, generated_include))
def _process_per_source_flag(self, per_source_flag, backend_file):
for flag in per_source_flag.flags:
backend_file.write('%s_FLAGS += %s\n' % (mozpath.basename(per_source_flag.file_name), flag))

View File

@ -1077,11 +1077,6 @@ VARIABLES = {
This variable only has an effect when building with MSVC.
""", None),
'GENERATED_INCLUDES' : (StrictOrderingOnAppendList, list,
"""Directories generated by the build system to be searched for include
files by the compiler.
""", None),
'HOST_SOURCES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
"""Source code files to compile with the host compiler.
@ -1169,7 +1164,7 @@ VARIABLES = {
"""List of system libraries for host programs and libraries.
""", None),
'LOCAL_INCLUDES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
'LOCAL_INCLUDES': (ContextDerivedTypedList(Path, StrictOrderingOnAppendList), list,
"""Additional directories to be searched for include files by the compiler.
""", None),
@ -2110,6 +2105,16 @@ DEPRECATION_HINTS = {
GENERATED_SOURCES += [ 'foo.cpp']
''',
'GENERATED_INCLUDES': '''
Please use
LOCAL_INCLUDES += [ '!foo' ]
instead of
GENERATED_INCLUDES += [ 'foo' ]
''',
}
# Make sure that all template variables have a deprecation hint.

View File

@ -648,18 +648,6 @@ class LocalInclude(ContextDerived):
self.path = path
class GeneratedInclude(ContextDerived):
"""Describes an individual generated include path."""
__slots__ = (
'path',
)
def __init__(self, context, path):
ContextDerived.__init__(self, context)
self.path = path
class PerSourceFlag(ContextDerived):
"""Describes compiler flags specified for individual source files."""

View File

@ -38,7 +38,6 @@ from .data import (
FinalTargetFiles,
GeneratedEventWebIDLFile,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
GeneratedWebIDLFile,
ExampleWebIDLInterface,
@ -659,7 +658,6 @@ class TreeMetadataEmitter(LoggingMixin):
('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
('IPDL_SOURCES', IPDLFile),
('GENERATED_INCLUDES', GeneratedInclude),
('PREPROCESSED_TEST_WEBIDL_FILES', PreprocessedTestWebIDLFile),
('PREPROCESSED_WEBIDL_FILES', PreprocessedWebIDLFile),
('TEST_WEBIDL_FILES', TestWebIDLFile),
@ -671,7 +669,8 @@ class TreeMetadataEmitter(LoggingMixin):
yield klass(context, name)
for local_include in context.get('LOCAL_INCLUDES', []):
if not os.path.exists(local_include.full_path):
if (not isinstance(local_include, ObjDirPath) and
not os.path.exists(local_include.full_path)):
raise SandboxValidationError('Path specified in LOCAL_INCLUDES '
'does not exist: %s (resolved to %s)' % (local_include,
local_include.full_path), context)

View File

@ -221,10 +221,10 @@ def read_from_gyp(config, path, output, vars, non_unified_sources = set()):
# Add some features to all contexts. Put here in case LOCAL_INCLUDES
# order matters.
context['LOCAL_INCLUDES'] += [
'!/ipc/ipdl/_ipdlheaders',
'/ipc/chromium/src',
'/ipc/glue',
]
context['GENERATED_INCLUDES'] += ['/ipc/ipdl/_ipdlheaders']
# These get set via VC project file settings for normal GYP builds.
if config.substs['OS_TARGET'] == 'WINNT':
context['DEFINES']['UNICODE'] = True

View File

@ -2,4 +2,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
GENERATED_INCLUDES += ['/bar/baz', 'foo']
LOCAL_INCLUDES += ['!/bar/baz', '!foo']

View File

@ -627,7 +627,7 @@ class TestRecursiveMakeBackend(BackendTester):
topobjdir = env.topobjdir.replace('\\', '/')
expected = [
'LOCAL_INCLUDES += -I%s/bar/baz' % topobjdir,
'LOCAL_INCLUDES += -Ibar/baz',
'LOCAL_INCLUDES += -Ifoo',
]

View File

@ -2,4 +2,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
GENERATED_INCLUDES += ['/bar/baz', 'foo']
LOCAL_INCLUDES += ['!/bar/baz', '!foo']

View File

@ -18,7 +18,6 @@ from mozbuild.frontend.data import (
DirectoryTraversal,
Exports,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
HostDefines,
HostSources,
@ -661,10 +660,19 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('generated_includes')
objs = self.read_topsrcdir(reader)
generated_includes = [o.path for o in objs if isinstance(o, GeneratedInclude)]
generated_includes = [o.path for o in objs if isinstance(o, LocalInclude)]
expected = [
'/bar/baz',
'foo',
'!/bar/baz',
'!foo',
]
self.assertEqual(generated_includes, expected)
generated_includes = [o.path.full_path
for o in objs if isinstance(o, LocalInclude)]
expected = [
mozpath.join(reader.config.topobjdir, 'bar/baz'),
mozpath.join(reader.config.topobjdir, 'foo'),
]
self.assertEqual(generated_includes, expected)

View File

@ -19,8 +19,8 @@ UNIFIED_SOURCES += [
'nsPKIModule.cpp',
]
GENERATED_INCLUDES += [
'/dist/public/nss',
LOCAL_INCLUDES += [
'!/dist/public/nss',
]
FINAL_LIBRARY = 'xul'

View File

@ -161,8 +161,8 @@ LOCAL_INCLUDES += [
'/security/pkix/include',
]
GENERATED_INCLUDES += [
'/dist/public/nss',
LOCAL_INCLUDES += [
'!/dist/public/nss',
]
if CONFIG['NSS_DISABLE_DBM']:

View File

@ -12,8 +12,8 @@ SOURCES += [
'webapprt.cpp',
]
GENERATED_INCLUDES += ['/build']
LOCAL_INCLUDES += [
'!/build',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/build',

View File

@ -15,8 +15,8 @@ SOURCES += [
DEFINES['XPCOM_GLUE'] = True
GENERATED_INCLUDES += ['/build']
LOCAL_INCLUDES += [
'!/build',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/build',

View File

@ -20,8 +20,8 @@ DEFINES['APP_VERSION'] = CONFIG['FIREFOX_VERSION']
# Statically link against the CRT
USE_STATIC_LIBS = True
GENERATED_INCLUDES += ['/build']
LOCAL_INCLUDES += [
'!/build',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/build',

View File

@ -79,8 +79,8 @@ FINAL_LIBRARY = 'xul'
DEFINES['_IMPL_NS_STRINGAPI'] = True
DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'../base',
'../components',
'../ds',

View File

@ -44,8 +44,8 @@ if CONFIG['GNU_CXX']:
FINAL_LIBRARY = 'xul'
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'../base',
'../build',
'../ds',

View File

@ -134,4 +134,4 @@ FINAL_LIBRARY = 'xul'
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
DEFINES['HAVE_USR_LIB64_DIR'] = True
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += ['!..']

View File

@ -119,8 +119,8 @@ if CONFIG['INTEL_ARCHITECTURE']:
sse_string_path = '/xpcom/string/nsUTF8UtilsSSE2.cpp'
SOURCES[sse_string_path].flags += CONFIG['SSE2_FLAGS']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES = [
'!..',
'../base',
'../build',
'../components',

View File

@ -22,8 +22,10 @@ EXPORTS += [
FINAL_LIBRARY = 'xul'
GENERATED_INCLUDES += ['/xpcom/base']
LOCAL_INCLUDES += ['/xpcom/base']
LOCAL_INCLUDES += [
'!/xpcom/base',
'/xpcom/base',
]
if CONFIG['_MSC_VER']:
CFLAGS += ['-Zl']