Skip to content

Commit

Permalink
Bug 1221453 - Use ObjDirPaths for GENERATED_INCLUDES and merge with L…
Browse files Browse the repository at this point in the history
…OCAL_INCLUDES. r=gps
  • Loading branch information
glandium committed Nov 6, 2015
1 parent e855ef1 commit 762aba0
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 92 deletions.
5 changes: 1 addition & 4 deletions b2g/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 1 addition & 4 deletions browser/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 1 addition & 4 deletions chrome/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/test/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ WEBIDL_EXAMPLE_INTERFACES += [
'TestExampleProxyInterface',
]

GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'/dom/bindings',
'/js/xpconnect/src',
'/js/xpconnect/wrappers',
Expand Down
5 changes: 1 addition & 4 deletions ipc/chromium/chromium-config.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 4 additions & 2 deletions js/src/gdb/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ UNIFIED_SOURCES += [

DEFINES['EXPORT_JS_API'] = True

LOCAL_INCLUDES += ['..']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'..',
]

USE_LIBS += [
'static:js',
Expand Down
6 changes: 4 additions & 2 deletions js/src/jsapi-tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ if CONFIG['ENABLE_ION']:

DEFINES['EXPORT_JS_API'] = True

LOCAL_INCLUDES += ['..']
GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'!..',
'..',
]

USE_LIBS += [
'static:js',
Expand Down
4 changes: 2 additions & 2 deletions js/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
6 changes: 4 additions & 2 deletions js/src/shell/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
4 changes: 1 addition & 3 deletions media/webrtc/signaling/test/common.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion memory/build/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
6 changes: 4 additions & 2 deletions memory/jemalloc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions memory/mozalloc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ 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

if CONFIG['_MSC_VER']:
DIRS += ['staticruntime']

LOCAL_INCLUDES += ['/memory/build']
LOCAL_INCLUDES += [
'!/xpcom',
'/memory/build',
]

DIST_INSTALL = True

Expand Down
2 changes: 1 addition & 1 deletion memory/mozalloc/staticruntime/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ UNIFIED_SOURCES += [
'../mozalloc_oom.cpp',
]

GENERATED_INCLUDES += ['/xpcom']
LOCAL_INCLUDES += ['!/xpcom']

DISABLE_STL_WRAPPING = True

Expand Down
2 changes: 1 addition & 1 deletion memory/replace/jemalloc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
2 changes: 1 addition & 1 deletion mozglue/android/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions netwerk/build/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ if CONFIG['MOZ_RTSP']:
'/netwerk/protocol/rtsp',
]

GENERATED_INCLUDES += [
'/netwerk/dns',
LOCAL_INCLUDES += [
'!/netwerk/dns',
]
11 changes: 0 additions & 11 deletions python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
ExternalLibrary,
FinalTargetFiles,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
HostDefines,
HostLibrary,
Expand Down Expand Up @@ -561,9 +560,6 @@ def consume_object(self, obj):
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)

Expand Down Expand Up @@ -1245,13 +1241,6 @@ def _process_local_include(self, local_include, backend_file):
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))
Expand Down
17 changes: 11 additions & 6 deletions python/mozbuild/mozbuild/frontend/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,6 @@ def aggregate(files):
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.
Expand Down Expand Up @@ -1169,7 +1164,7 @@ def aggregate(files):
"""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),

Expand Down Expand Up @@ -2110,6 +2105,16 @@ def Program(name):
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.
Expand Down
12 changes: 0 additions & 12 deletions python/mozbuild/mozbuild/frontend/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,18 +648,6 @@ def __init__(self, context, path):

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."""
Expand Down
5 changes: 2 additions & 3 deletions python/mozbuild/mozbuild/frontend/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
FinalTargetFiles,
GeneratedEventWebIDLFile,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
GeneratedWebIDLFile,
ExampleWebIDLInterface,
Expand Down Expand Up @@ -659,7 +658,6 @@ def emit_from_context(self, context):
('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),
Expand All @@ -671,7 +669,8 @@ def emit_from_context(self, context):
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)
Expand Down
2 changes: 1 addition & 1 deletion python/mozbuild/mozbuild/frontend/gyp_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def test_generated_includes(self):
topobjdir = env.topobjdir.replace('\\', '/')

expected = [
'LOCAL_INCLUDES += -I%s/bar/baz' % topobjdir,
'LOCAL_INCLUDES += -Ibar/baz',
'LOCAL_INCLUDES += -Ifoo',
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
16 changes: 12 additions & 4 deletions python/mozbuild/mozbuild/test/frontend/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
DirectoryTraversal,
Exports,
GeneratedFile,
GeneratedInclude,
GeneratedSources,
HostDefines,
HostSources,
Expand Down Expand Up @@ -661,10 +660,19 @@ def test_generated_includes(self):
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)
Expand Down
4 changes: 2 additions & 2 deletions security/manager/pki/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ UNIFIED_SOURCES += [
'nsPKIModule.cpp',
]

GENERATED_INCLUDES += [
'/dist/public/nss',
LOCAL_INCLUDES += [
'!/dist/public/nss',
]

FINAL_LIBRARY = 'xul'
Loading

0 comments on commit 762aba0

Please sign in to comment.