aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-04 09:06:00 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-05 08:11:28 +1000
commit7a3be163cbceb9f569ff454dc23fdfecadc166cc (patch)
treebe20093056b7bdfc46c71a4de59f7b6d3902b730
parent44131226761913bba297a0cf5d20d37d9408d02e (diff)
downloadmeson-7a3be163cbceb9f569ff454dc23fdfecadc166cc.zip
meson-7a3be163cbceb9f569ff454dc23fdfecadc166cc.tar.gz
meson-7a3be163cbceb9f569ff454dc23fdfecadc166cc.tar.bz2
Default to project_version() in vcs_tag fallback
-rw-r--r--docs/markdown/Reference-manual.md2
-rw-r--r--docs/markdown/Release-notes-for-0.41.0.md5
-rw-r--r--mesonbuild/interpreter.py4
-rw-r--r--test cases/common/73 vcstag/meson.build4
4 files changed, 12 insertions, 3 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 66027c2..9c4df7e 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -639,7 +639,7 @@ This command detects revision control commit information at build time and place
- `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 (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@`)
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/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index fed3e10..0e3f039 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2024,9 +2024,9 @@ class Interpreter(InterpreterBase):
def func_vcs_tag(self, node, args, kwargs):
if 'input' not in kwargs or 'output' not in kwargs:
raise InterpreterException('Keyword arguments input and output must exist')
- fallback = kwargs.pop('fallback', None)
+ 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/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)