aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-11-19 12:36:05 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-11-19 15:21:13 +0100
commit9435f11b17ac428c80ac8af80724aced6c02133a (patch)
tree2adaa02d0b287834b5d7666560a23572cc4c4743 /mesonbuild
parentb4af3328a4213d92edca4fa74b04d1bd5800962b (diff)
downloadmeson-9435f11b17ac428c80ac8af80724aced6c02133a.zip
meson-9435f11b17ac428c80ac8af80724aced6c02133a.tar.gz
meson-9435f11b17ac428c80ac8af80724aced6c02133a.tar.bz2
ci: Add CI command to include text files in the CI log
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py1
-rw-r--r--mesonbuild/cmake/fileapi.py2
-rw-r--r--mesonbuild/interpreter.py1
-rw-r--r--mesonbuild/mlog.py10
4 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 50ac44f..3c5cdf0 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -334,6 +334,7 @@ int dummy;
# Only overwrite the old build file after the new one has been
# fully created.
os.replace(tempfilename, outfilename)
+ mlog.cmd_ci_include(outfilename) # For CI debugging
self.generate_compdb()
# http://clang.llvm.org/docs/JSONCompilationDatabase.html
diff --git a/mesonbuild/cmake/fileapi.py b/mesonbuild/cmake/fileapi.py
index e33a0af..c62eadb 100644
--- a/mesonbuild/cmake/fileapi.py
+++ b/mesonbuild/cmake/fileapi.py
@@ -14,6 +14,7 @@
from .common import CMakeException, CMakeBuildFile, CMakeConfiguration
from typing import Any, List, Tuple
+from .. import mlog
import os
import json
import re
@@ -76,6 +77,7 @@ class CMakeFileAPI:
debug_json = os.path.normpath(os.path.join(self.build_dir, '..', 'fileAPI.json'))
with open(debug_json, 'w') as fp:
json.dump(index, fp, indent=2)
+ mlog.cmd_ci_include(debug_json)
# parse the JSON
for i in index['objects']:
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 3179fb4..ac6bbd3 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2596,6 +2596,7 @@ external dependencies (including libraries) must go to "dependencies".''')
f.write(printer.result)
mlog.log('Build file:', meson_filename)
+ mlog.cmd_ci_include(meson_filename)
mlog.log()
result = self._do_subproject_meson(dirname, subdir, default_options, kwargs, ast, cm_int.bs_files)
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 14ad92f..ace47f4 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -56,6 +56,7 @@ log_timestamp_start = None # type: Optional[float]
log_fatal_warnings = False # type: bool
log_disable_stdout = False # type: bool
log_errors_only = False # type: bool
+_in_ci = 'CI' in os.environ # type: bool
def disable() -> None:
global log_disable_stdout
@@ -186,6 +187,15 @@ def debug(*args: Union[str, AnsiDecorator], **kwargs: Any) -> None:
print(*arr, file=log_file, **kwargs)
log_file.flush()
+def _debug_log_cmd(cmd: str, args: List[str]) -> None:
+ if not _in_ci:
+ return
+ args = ['"{}"'.format(x) for x in args] # Quote all args, just in case
+ debug('!meson_ci!/{} {}'.format(cmd, ' '.join(args)))
+
+def cmd_ci_include(file: str) -> None:
+ _debug_log_cmd('ci_include', [file])
+
def log(*args: Union[str, AnsiDecorator], is_error: bool = False,
**kwargs: Any) -> None:
global log_errors_only