diff options
-rw-r--r-- | docs/markdown/Compiler-properties.md | 2 | ||||
-rw-r--r-- | docs/markdown/Reference-manual.md | 12 | ||||
-rw-r--r-- | docs/markdown/Release-notes-for-0.41.0.md | 5 | ||||
-rw-r--r-- | docs/markdown/Wrap-dependency-system-manual.md | 1 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 6 | ||||
-rwxr-xr-x | run_project_tests.py | 10 | ||||
-rw-r--r-- | test cases/common/73 vcstag/meson.build | 4 |
7 files changed, 30 insertions, 10 deletions
diff --git a/docs/markdown/Compiler-properties.md b/docs/markdown/Compiler-properties.md index d6ee823..50615a1 100644 --- a/docs/markdown/Compiler-properties.md +++ b/docs/markdown/Compiler-properties.md @@ -140,7 +140,7 @@ In older versions (<= 0.30) meson would error out if the size could not be deter Does a function exist? == -Just having a header does say anything about its contents. Sometimes you need to explicitly check if some function exists. This is how we would check whether the function `somefunc` exists in header `someheader.h` +Just having a header doesn't say anything about its contents. Sometimes you need to explicitly check if some function exists. This is how we would check whether the function `somefunc` exists in header `someheader.h` ```meson if compiler.has_function('somefunc', prefix : '#include<someheader.h>') diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 116fd58..9c4df7e 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -635,13 +635,15 @@ Defined tests can be run in a backend-agnostic way by calling `mesontest` inside ctarget vcs_tag(...) ``` -This command detects revision control commit information at build time and places it in the specified output file. This file is guaranteed to be up to date on every build. Keywords are similar to `custom_target` and all of them are mandatory. +This command detects revision control commit information at build time and places it in the specified output file. This file is guaranteed to be up to date on every build. Keywords are similar to `custom_target`. -- `input` file to modify (e.g. `version.c.in`) -- `output` file to write the results to (e.g. `version.c`) -- `fallback` version number to use when no revision control information is present, such as when building from a release tarball +- `input` file to modify (e.g. `version.c.in`) (required) +- `output` file to write the results to (e.g. `version.c`) (required) +- `fallback` version number to use when no revision control information is present, such as when building from a release tarball (defaults to `meson.project_version()`) +- `command` string list with the command to execute, see [`custom_target`](#custom_target) for details on how this command must be specified +- `replace_string` string in the input file to substitute with the commit information (defaults to `@VCS_TAG@`) -Meson will read the contents of `input`, replace the string `@VCS_TAG@` with the detected revision number and write the result to `output`. This method returns an opaque [`custom_target`](#custom_target) object that you should put in your main program. If you desire more specific behavior than what this command provides, you should use `custom_target`. +Meson will read the contents of `input`, substitute the `replace_string` with the detected revision number, and write the result to `output`. This method returns an opaque [`custom_target`](#custom_target) object that can be used as source. If you desire more specific behavior than what this command provides, you should use `custom_target`. ## Built-in objects diff --git a/docs/markdown/Release-notes-for-0.41.0.md b/docs/markdown/Release-notes-for-0.41.0.md index 6e00ecd..9c02cdc 100644 --- a/docs/markdown/Release-notes-for-0.41.0.md +++ b/docs/markdown/Release-notes-for-0.41.0.md @@ -12,3 +12,8 @@ Add features here as code is merged to master. ## Dependency Handler for LLVM Native support for linking against LLVM using the `dependency` function. + +## vcs_tag keyword fallback is is now optional + +The `fallback` keyword in `vcs_tag` is now optional. If not given, its value +defaults to the return value of `meson.project_version()`. diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md index fe5a566..fc41b61 100644 --- a/docs/markdown/Wrap-dependency-system-manual.md +++ b/docs/markdown/Wrap-dependency-system-manual.md @@ -69,6 +69,7 @@ To use a subproject simply do this in your top level `meson.build`. ```meson foobar_sp = subproject('foobar') +``` Usually dependencies consist of some header files plus a library to link against. To do this you would declare this internal dependency like this: diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index d8f3b2b..0e3f039 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2022,9 +2022,11 @@ class Interpreter(InterpreterBase): raise InterpreterException('Unknown target_type.') def func_vcs_tag(self, node, args, kwargs): - fallback = kwargs.pop('fallback', None) + if 'input' not in kwargs or 'output' not in kwargs: + raise InterpreterException('Keyword arguments input and output must exist') + fallback = kwargs.pop('fallback', self.project_version) if not isinstance(fallback, str): - raise InterpreterException('Keyword argument fallback must exist and be a string.') + raise InterpreterException('Keyword argument fallback must be a string.') replace_string = kwargs.pop('replace_string', '@VCS_TAG@') regex_selector = '(.*)' # default regex selector for custom command: use complete output vcs_cmd = kwargs.get('command', None) diff --git a/run_project_tests.py b/run_project_tests.py index 9bba632..1abc199 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -283,14 +283,19 @@ def run_test_inprocess(testdir): sys.stderr = mystderr = StringIO() old_cwd = os.getcwd() os.chdir(testdir) + test_log_fname = 'meson-logs/testlog.txt' try: returncode_test = mesontest.run(['--no-rebuild']) + if os.path.exists(test_log_fname): + test_log = open(test_log_fname, errors='ignore').read() + else: + test_log = '' returncode_benchmark = mesontest.run(['--no-rebuild', '--benchmark', '--logbase', 'benchmarklog']) finally: sys.stdout = old_stdout sys.stderr = old_stderr os.chdir(old_cwd) - return max(returncode_test, returncode_benchmark), mystdout.getvalue(), mystderr.getvalue() + return max(returncode_test, returncode_benchmark), mystdout.getvalue(), mystderr.getvalue(), test_log def parse_test_args(testdir): args = [] @@ -357,10 +362,11 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, compiler, backen os.utime(os.path.join(testdir, 'meson.build')) test_start = time.time() # Test in-process - (returncode, tstdo, tstde) = run_test_inprocess(test_build_dir) + (returncode, tstdo, tstde, test_log) = run_test_inprocess(test_build_dir) test_time = time.time() - test_start stdo += tstdo stde += tstde + mesonlog += test_log if should_fail == 'test': if returncode != 0: return TestResult('', BuildStep.test, stdo, stde, mesonlog, gen_time) diff --git a/test cases/common/73 vcstag/meson.build b/test cases/common/73 vcstag/meson.build index 001b42d..7e5983a 100644 --- a/test cases/common/73 vcstag/meson.build +++ b/test cases/common/73 vcstag/meson.build @@ -9,6 +9,10 @@ output : 'vcstag-custom.c', command : ['git', 'show-ref', '-s', 'refs/heads/master'], fallback : '1.0.0') +version_src_fallback = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-fallback.c') + executable('tagprog', 'tagprog.c', version_src) executable('tagprog-custom', 'tagprog.c', version_src_custom) +executable('tagprog-fallback', 'tagprog.c', version_src_fallback) |