Bug 1055281 - check for existence of paths in LOCAL_INCLUDES in moz.build; r=mshal

This commit is contained in:
Nathan Froyd 2014-08-20 11:51:33 -04:00
Родитель 9e4152607c
Коммит a088ec81d5
35 изменённых файлов: 40 добавлений и 83 удалений

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

@ -18,10 +18,6 @@ UNIFIED_SOURCES += [
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'../base',
]
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True

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

@ -65,10 +65,6 @@ if CONFIG['ANDROID_VERSION'] >= '18'and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'../base',
]
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True

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

@ -114,7 +114,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
# media/mtransport so we work with --disable-webrtc
LOCAL_INCLUDES += [
'../base',
'/media/mtransport',
'/xpcom/base',
'/xpcom/build',

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

@ -54,7 +54,6 @@ LOCAL_INCLUDES += [
'/dom/bluetooth',
'/dom/camera',
'/dom/canvas',
'/dom/file',
'/dom/indexedDB',
'/dom/src/geolocation',
'/dom/workers',

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

@ -100,7 +100,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../src/base',
'../src/geolocation',
'../src/storage',
'/chrome',
@ -137,11 +136,6 @@ for var in ('MOZ_PERMISSIONS', 'MOZ_CHILD_PERMISSIONS'):
if CONFIG[var]:
DEFINES[var] = True
if CONFIG['ENABLE_TESTS']:
LOCAL_INCLUDES += [
'ipc/glue',
]
JAR_MANIFESTS += ['jar.mn']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']

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

@ -30,7 +30,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'/dom/plugins/base',
'/dom/plugins/base/android/include',
'/gfx/gl',
'/widget/android',
'/widget/xpwidgets',

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

@ -99,8 +99,6 @@ MSVC_ENABLE_PGO = True
LOCAL_INCLUDES += [
'/content/base/src',
'/dom/base',
'/gfx/skia/include/config',
'/gfx/skia/include/core',
'/layout/generic',
'/layout/xul',
'/widget/android',

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

@ -56,7 +56,6 @@ LOCAL_INCLUDES += [
'trunk/include/effects',
'trunk/include/gpu',
'trunk/include/images',
'trunk/include/lazy',
'trunk/include/pathops',
'trunk/include/pipe',
'trunk/include/ports',
@ -73,7 +72,6 @@ LOCAL_INCLUDES += [
'trunk/src/opts',
'trunk/src/sfnt',
'trunk/src/utils',
'trunk/src/utils/android',
'trunk/src/utils/mac',
'trunk/src/utils/win',
]

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

@ -888,7 +888,6 @@ LOCAL_INCLUDES += [
'trunk/include/effects',
'trunk/include/gpu',
'trunk/include/images',
'trunk/include/lazy',
'trunk/include/pathops',
'trunk/include/pipe',
'trunk/include/ports',
@ -905,7 +904,6 @@ LOCAL_INCLUDES += [
'trunk/src/opts',
'trunk/src/sfnt',
'trunk/src/utils',
'trunk/src/utils/android',
'trunk/src/utils/mac',
'trunk/src/utils/win',
]

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

@ -10,10 +10,6 @@ CPP_UNIT_TESTS += [
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
LOCAL_INCLUDES += [
'../public',
]
USE_LIBS += [
'mozalloc',
'nspr',

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

@ -15,10 +15,6 @@ SIMPLE_PROGRAMS += [
"%s" % (fyl[0:-4]) for fyl in SOURCES
]
LOCAL_INCLUDES += [
'../public',
]
USE_STATIC_LIBS = True
USE_LIBS += [

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

@ -12,5 +12,4 @@ FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'..',
'../../src',
]

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

@ -27,10 +27,6 @@ FORCE_STATIC_LIB = True
SDK_LIBRARY = True
LOCAL_INCLUDES += [
'../src',
]
USE_STATIC_LIBS = True
if CONFIG['_MSC_VER']:

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

@ -49,7 +49,6 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/camera',
'/dom/canvas',
'/dom/file',
'/dom/filesystem',
'/dom/media',
'/dom/speakermanager',
@ -76,11 +75,7 @@ LOCAL_INCLUDES += [
'/view',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3'):
LOCAL_INCLUDES += [
'/dom/system/unix',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/dom/system/windows',
]
@ -124,11 +119,6 @@ if CONFIG['MOZ_WEBSPEECH']:
'/content/media/webspeech/synth',
]
if CONFIG['MOZ_FFMPEG']:
LOCAL_INCLUDES += [
'/content/media/fmp4/ffmpeg/include',
]
if CONFIG['MOZ_GSTREAMER']:
CXXFLAGS += CONFIG['GSTREAMER_CFLAGS']

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

@ -126,16 +126,6 @@
'LIBYUV_DISABLE_AVX2',
]
}],
['build_with_mozilla==1', {
'include_dirs': [
'$(DEPTH)/dist/include',
],
'direct_dependent_settings': {
'include_dirs': [
'$(DEPTH)/dist/include',
],
},
}],
],
'defines': [
# Enable the following 3 macros to turn off assembly for specified CPU.

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

@ -32,9 +32,6 @@ SOURCES += mtransport_cppsrcs
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES = [
'/media/webrtc/trunk/third_party/libjingle/source/',
]
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',

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

@ -11,9 +11,6 @@ SOURCES += mtransport_cppsrcs
LIBRARY_NAME = 'mtransport_s'
LOCAL_INCLUDES = [
'/media/webrtc/trunk/third_party/libjingle/source/',
]
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',

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

@ -13,7 +13,6 @@ LIBRARY_NAME = 'omxpluginfroyo'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../../content/media/plugins',
'../include/froyo',
'../include/froyo/media/stagefright/openmax',
]

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

@ -13,7 +13,6 @@ LIBRARY_NAME = 'omxplugingb'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../../content/media/plugins',
'../include/gb',
'../include/gb/media/stagefright/openmax',
]

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

@ -13,7 +13,6 @@ LIBRARY_NAME = 'omxplugingb235'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../../content/media/plugins',
'../include/gb',
'../include/gb/media/stagefright/openmax',
]

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

@ -13,7 +13,6 @@ LIBRARY_NAME = 'omxpluginhc'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../../content/media/plugins',
'../include/gb',
'../include/gb/media/stagefright/openmax',
]

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

@ -13,7 +13,6 @@ LIBRARY_NAME = 'omxpluginkk'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../../content/media/plugins',
'../include/ics',
'../include/ics/media/stagefright/openmax',
]

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

@ -22,10 +22,6 @@ LIBRARY_NAME = 'omxplugin'
FORCE_SHARED_LIB = True
LOCAL_INCLUDES += [
'../../content/media/plugins',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
pass
else:

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

@ -50,7 +50,6 @@
'./include',
'./src/sipcc/include',
'./src/sipcc/cpr/include',
'../../../ipc/chromium/src/base/third_party/nspr',
'../../../xpcom/base',
'../../../dom/base',
'../../../content/media',
@ -60,7 +59,6 @@
'../trunk/webrtc/video_engine/include',
'../trunk/webrtc/voice_engine/include',
'../trunk/webrtc/modules/interface',
'../trunk/webrtc/peerconnection',
'../../libyuv/include',
'../../mtransport/third_party/nrappkit/src/util/libekr',
],
@ -334,10 +332,6 @@
'./src/sipcc/plat/common',
'../../../media/mtransport',
'../../../dom/base',
'../trunk/third_party/libsrtp/srtp/include',
'../trunk/third_party/libsrtp/srtp/crypto/include',
# Danger: this is to include config.h. This could be bad.
'../trunk/third_party/libsrtp/config',
'../../../netwerk/sctp/datachannel',
],

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

@ -41,7 +41,6 @@ LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc/signaling/include',
'/media/webrtc/signaling/media-conduit',
'/media/webrtc/signaling/src/common/browser_logging',
'/media/webrtc/signaling/src/common/time_profiling',
'/media/webrtc/signaling/src/media',
@ -54,7 +53,6 @@ LOCAL_INCLUDES += [
'/media/webrtc/signaling/src/sipcc/include',
'/media/webrtc/trunk',
'/media/webrtc/trunk/testing/gtest/include',
'/media/webrtc/trunk/third_party/libjingle/source',
'/xpcom/base',
]

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

@ -23,7 +23,6 @@ FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'../src',
'/media/mtransport',
'/media/webrtc/trunk/third_party/libjingle/source',
]
DEFINES['INET'] = 1

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

@ -557,7 +557,6 @@ class TreeMetadataEmitter(LoggingMixin):
('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
('IPDL_SOURCES', IPDLFile),
('LOCAL_INCLUDES', LocalInclude),
('GENERATED_INCLUDES', GeneratedInclude),
('PREPROCESSED_TEST_WEBIDL_FILES', PreprocessedTestWebIDLFile),
('PREPROCESSED_WEBIDL_FILES', PreprocessedWebIDLFile),
@ -569,6 +568,20 @@ class TreeMetadataEmitter(LoggingMixin):
for name in context.get(context_var, []):
yield klass(context, name)
for local_include in context.get('LOCAL_INCLUDES', []):
if local_include.startswith('/'):
path = self.config.topsrcdir
relative_include = local_include[1:]
else:
path = context.srcdir
relative_include = local_include
actual_include = os.path.join(path, relative_include)
if not os.path.exists(actual_include):
raise SandboxValidationError('Path specified in LOCAL_INCLUDES '
'does not exist: %s (resolved to %s)' % (local_include, actual_include), context)
yield LocalInclude(context, local_include)
if context.get('FINAL_TARGET') or context.get('XPI_NAME') or \
context.get('DIST_SUBDIR'):
yield InstallationTarget(context)

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

@ -189,6 +189,20 @@ def read_from_gyp(config, path, output, vars, non_unified_sources = set()):
context['DEFINES'][define] = True
for include in target_conf.get('include_dirs', []):
# moz.build expects all LOCAL_INCLUDES to exist, so ensure they do.
#
# NB: gyp files sometimes have actual absolute paths (e.g.
# /usr/include32) and sometimes paths that moz.build considers
# absolute, i.e. starting from topsrcdir. There's no good way
# to tell them apart here, and the actual absolute paths are
# likely bogus. In any event, actual absolute paths will be
# filtered out by trying to find them in topsrcdir.
if include.startswith('/'):
resolved = mozpath.abspath(mozpath.join(config.topsrcdir, include[1:]))
else:
resolved = mozpath.abspath(mozpath.join(mozpath.dirname(build_file), include))
if not os.path.exists(resolved):
continue
context['LOCAL_INCLUDES'] += [include]
context['EXTRA_ASSEMBLER_FLAGS'] = target_conf.get('asflags_mozilla', [])

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

@ -0,0 +1,5 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
LOCAL_INCLUDES += ['/bar/baz', 'foo']

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

@ -574,6 +574,12 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('xpidl-module-no-sources')
self.read_topsrcdir(reader)
def test_missing_local_includes(self):
"""LOCAL_INCLUDES containing non-existent directories should be rejected."""
with self.assertRaisesRegexp(SandboxValidationError, 'Path specified in '
'LOCAL_INCLUDES does not exist'):
reader = self.reader('missing-local-includes')
self.read_topsrcdir(reader)
if __name__ == '__main__':
main()

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

@ -20,7 +20,6 @@ LOCAL_INCLUDES += [
'../downloads',
'../feeds',
'../find',
'../intl',
'../jsdownloads/src',
'../protobuf',
'../startup',