aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml14
-rw-r--r--mesonbuild/backend/ninjabackend.py4
-rw-r--r--mesonbuild/coredata.py1
-rw-r--r--mesonbuild/interpreter.py24
-rw-r--r--test cases/failing/34 dependency not-required then required/meson.build2
-rw-r--r--test cases/failing/34 non-root subproject/meson.build3
-rw-r--r--test cases/failing/34 non-root subproject/some/meson.build1
7 files changed, 34 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index cf3a5a6..bc52ffa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,17 @@
-sudo: required
+sudo: false
os:
- linux
- osx
+compiler:
+ - gcc
+ - clang
+
+env:
+ - MESON_ARGS=""
+ - MESON_ARGS="--unity"
+
language:
- cpp
@@ -22,5 +30,5 @@ script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM jpakkane/mesonci:yakkety > Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true ./run_tests.py"; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) ./run_tests.py --backend=ninja ; fi
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true ./run_tests.py -- $MESON_ARGS"; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) ./run_tests.py --backend=ninja -- $MESON_ARGS ; fi
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 738d316..8329b59 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2100,5 +2100,9 @@ rule FORTRAN_DEP_HACK
elem.add_item('pool', 'console')
elem.write(outfile)
+ elem = NinjaBuildElement(self.all_outputs, 'reconfigure', 'REGENERATE_BUILD', 'PHONY')
+ elem.add_item('pool', 'console')
+ elem.write(outfile)
+
elem = NinjaBuildElement(self.all_outputs, deps, 'phony', '')
elem.write(outfile)
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index c8ee13f..fad39e6 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -247,4 +247,5 @@ forbidden_target_names = {'clean': None,
'install': None,
'build.ninja': None,
'scan-build': None,
+ 'reconfigure': None,
}
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e01c54d..561cc19 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1557,7 +1557,7 @@ class Interpreter():
if dirname in self.subproject_stack:
fullstack = self.subproject_stack + [dirname]
incpath = ' => '.join(fullstack)
- raise InterpreterException('Recursive include of subprojects: %s.' % incpath)
+ raise InvalidCode('Recursive include of subprojects: %s.' % incpath)
if dirname in self.subprojects:
return self.subprojects[dirname]
r = wrap.Resolver(os.path.join(self.build.environment.get_source_dir(), self.subproject_dir))
@@ -1858,12 +1858,10 @@ requirements use the version keyword argument instead.''')
# Cached dep has the wrong version. Check if an external
# dependency or a fallback dependency provides it.
cached_dep = None
-
# Don't re-use cached dep if it wasn't required but this one is,
# so we properly go into fallback/error code paths
- if 'required' in kwargs and cached_dep is not None:
- if not cached_dep.required and kwargs.get('required', True):
- cached_dep = None
+ if kwargs.get('required', True) and not getattr(cached_dep, 'required', False):
+ cached_dep = None
if cached_dep:
dep = cached_dep
@@ -1910,8 +1908,14 @@ requirements use the version keyword argument instead.''')
def dependency_fallback(self, name, kwargs):
dirname, varname = self.get_subproject_infos(kwargs)
+ # Try to execute the subproject
try:
self.do_subproject(dirname, {})
+ # Invalid code is always an error
+ except InvalidCode:
+ raise
+ # If the subproject execution failed in a non-fatal way, don't raise an
+ # exception; let the caller handle things.
except:
mlog.log('Also couldn\'t find a fallback subproject in',
mlog.bold(os.path.join(self.subproject_dir, dirname)),
@@ -1920,13 +1924,11 @@ requirements use the version keyword argument instead.''')
try:
dep = self.subprojects[dirname].get_variable_method([varname], {})
except KeyError:
- mlog.log('Fallback variable', mlog.bold(varname),
- 'in the subproject', mlog.bold(dirname), 'does not exist')
- return None
+ raise InvalidCode('Fallback variable {!r} in the subproject '
+ '{!r} does not exist'.format(varname, dirname))
if not isinstance(dep, DependencyHolder):
- mlog.log('Fallback variable', mlog.bold(varname),
- 'in the subproject', mlog.bold(dirname),
- 'is not a dependency object.')
+ raise InvalidCode('Fallback variable {!r} in the subproject {!r} is '
+ 'not a dependency object.'.format(varname, dirname))
return None
# Check if the version of the declared dependency matches what we want
if 'version' in kwargs:
diff --git a/test cases/failing/34 dependency not-required then required/meson.build b/test cases/failing/34 dependency not-required then required/meson.build
index f33c41c..1796699 100644
--- a/test cases/failing/34 dependency not-required then required/meson.build
+++ b/test cases/failing/34 dependency not-required then required/meson.build
@@ -1,4 +1,4 @@
project('dep-test', 'c', version : '1.0')
foo_dep = dependency('foo-bar-xyz-12.3', required : false)
-bar_dep = dependency('foo-bar-xyz-12.3', required : true)
+bar_dep = dependency('foo-bar-xyz-12.3')
diff --git a/test cases/failing/34 non-root subproject/meson.build b/test cases/failing/34 non-root subproject/meson.build
new file mode 100644
index 0000000..c84dce7
--- /dev/null
+++ b/test cases/failing/34 non-root subproject/meson.build
@@ -0,0 +1,3 @@
+project('non-root subproject', 'c')
+
+subdir('some')
diff --git a/test cases/failing/34 non-root subproject/some/meson.build b/test cases/failing/34 non-root subproject/some/meson.build
new file mode 100644
index 0000000..d82f451
--- /dev/null
+++ b/test cases/failing/34 non-root subproject/some/meson.build
@@ -0,0 +1 @@
+dependency('definitely-doesnt-exist', fallback : ['someproj', 'some_dep'])