aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-01-06 12:12:10 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2020-01-28 21:18:25 +0200
commitd0c7b5169303fb0a394201d90be1e74426d7b2d9 (patch)
treed1c90de54924f5c9e572fd894227343e28091bfa
parent668610c0d2b0f3a66d96022eb57afe5b09c3a2b7 (diff)
downloadmeson-d0c7b5169303fb0a394201d90be1e74426d7b2d9.zip
meson-d0c7b5169303fb0a394201d90be1e74426d7b2d9.tar.gz
meson-d0c7b5169303fb0a394201d90be1e74426d7b2d9.tar.bz2
mintro: use interpreter data for buildsystem-files (fixes #6390)
-rw-r--r--mesonbuild/backend/backends.py6
-rw-r--r--mesonbuild/interpreter.py1
-rw-r--r--mesonbuild/mintro.py28
3 files changed, 16 insertions, 19 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index dfbc8be..a614be0 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -789,12 +789,6 @@ class Backend:
deps.extend(self.environment.coredata.cross_files)
deps.extend(self.environment.coredata.config_files)
deps.append('meson-private/coredata.dat')
- if os.path.exists(os.path.join(self.environment.get_source_dir(), 'meson_options.txt')):
- deps.append(os.path.join(self.build_to_src, 'meson_options.txt'))
- for sp in self.build.subprojects.keys():
- fname = os.path.join(self.environment.get_source_dir(), sp, 'meson_options.txt')
- if os.path.isfile(fname):
- deps.append(os.path.join(self.build_to_src, sp, 'meson_options.txt'))
self.check_clock_skew(deps)
return deps
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 9cb5621..8a04842 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2807,6 +2807,7 @@ external dependencies (including libraries) must go to "dependencies".''')
oi = optinterpreter.OptionInterpreter(self.subproject)
oi.process(self.option_file)
self.coredata.merge_user_options(oi.options)
+ self.add_build_def_file(self.option_file)
# Do not set default_options on reconfigure otherwise it would override
# values previously set from command line. That means that changing
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index ba5901b..dff5ecc 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -26,9 +26,10 @@ from .ast import IntrospectionInterpreter, build_target_functions, AstConditionL
from . import mlog
from .backend import backends
from .mparser import FunctionNode, ArrayNode, ArgumentNode, StringNode
+from .interpreter import Interpreter
+from pathlib import PurePath
import typing as T
import os
-import pathlib
def get_meson_info_file(info_dir: str) -> str:
return os.path.join(info_dir, 'meson-info.json')
@@ -56,19 +57,20 @@ def get_meson_introspection_types(coredata: T.Optional[cdata.CoreData] = None,
benchmarkdata = backend.create_test_serialisation(builddata.get_benchmarks())
testdata = backend.create_test_serialisation(builddata.get_tests())
installdata = backend.create_install_data()
+ interpreter = backend.interpreter
else:
benchmarkdata = testdata = installdata = None
return {
- 'benchmarks': IntroCommand('T.List all benchmarks', func=lambda: list_benchmarks(benchmarkdata)),
- 'buildoptions': IntroCommand('T.List all build options', func=lambda: list_buildoptions(coredata), no_bd=list_buildoptions_from_source),
- 'buildsystem_files': IntroCommand('T.List files that make up the build system', func=lambda: list_buildsystem_files(builddata)),
- 'dependencies': IntroCommand('T.List external dependencies', func=lambda: list_deps(coredata), no_bd=list_deps_from_source),
+ 'benchmarks': IntroCommand('List all benchmarks', func=lambda: list_benchmarks(benchmarkdata)),
+ 'buildoptions': IntroCommand('List all build options', func=lambda: list_buildoptions(coredata), no_bd=list_buildoptions_from_source),
+ 'buildsystem_files': IntroCommand('List files that make up the build system', func=lambda: list_buildsystem_files(builddata, interpreter)),
+ 'dependencies': IntroCommand('List external dependencies', func=lambda: list_deps(coredata), no_bd=list_deps_from_source),
'scan_dependencies': IntroCommand('Scan for dependencies used in the meson.build file', no_bd=list_deps_from_source),
- 'installed': IntroCommand('T.List all installed files and directories', func=lambda: list_installed(installdata)),
+ 'installed': IntroCommand('List all installed files and directories', func=lambda: list_installed(installdata)),
'projectinfo': IntroCommand('Information about projects', func=lambda: list_projinfo(builddata), no_bd=list_projinfo_from_source),
- 'targets': IntroCommand('T.List top level targets', func=lambda: list_targets(builddata, installdata, backend), no_bd=list_targets_from_source),
- 'tests': IntroCommand('T.List all unit tests', func=lambda: list_tests(testdata)),
+ 'targets': IntroCommand('List top level targets', func=lambda: list_targets(builddata, installdata, backend), no_bd=list_targets_from_source),
+ 'tests': IntroCommand('List all unit tests', func=lambda: list_tests(testdata)),
}
def add_arguments(parser):
@@ -152,7 +154,7 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend)
install_lookuptable = {}
for i in installdata.targets:
outname = os.path.join(installdata.prefix, i.outdir, os.path.basename(i.fname))
- install_lookuptable[os.path.basename(i.fname)] = str(pathlib.PurePath(outname))
+ install_lookuptable[os.path.basename(i.fname)] = str(PurePath(outname))
for (idname, target) in builddata.get_targets().items():
if not isinstance(target, build.Target):
@@ -254,10 +256,10 @@ def find_buildsystem_files_list(src_dir) -> T.List[str]:
filelist.append(os.path.relpath(os.path.join(root, f), src_dir))
return filelist
-def list_buildsystem_files(builddata: build.Build) -> T.List[str]:
+def list_buildsystem_files(builddata: build.Build, interpreter: Interpreter) -> T.List[str]:
src_dir = builddata.environment.get_source_dir()
- filelist = find_buildsystem_files_list(src_dir)
- filelist = [os.path.join(src_dir, x) for x in filelist]
+ filelist = interpreter.get_build_def_files()
+ filelist = [PurePath(src_dir, x).as_posix() for x in filelist]
return filelist
def list_deps_from_source(intr: IntrospectionInterpreter) -> T.List[T.Dict[str, T.Union[str, bool]]]:
@@ -367,7 +369,7 @@ def run(options) -> int:
if 'meson.build' in [os.path.basename(options.builddir), options.builddir]:
# Make sure that log entries in other parts of meson don't interfere with the JSON output
mlog.disable()
- backend = backends.get_backend_from_name(options.backend, None)
+ backend = backends.get_backend_from_name(options.backend)
intr = IntrospectionInterpreter(sourcedir, '', backend.name, visitors = [AstIDGenerator(), AstIndentationGenerator(), AstConditionLevel()])
intr.analyze()
# Re-enable logging just in case