summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/yaml/functions/_build_target_base.yaml7
-rw-r--r--mesonbuild/interpreter/interpreter.py25
-rw-r--r--test cases/d/9 features/meson.build2
3 files changed, 13 insertions, 21 deletions
diff --git a/docs/yaml/functions/_build_target_base.yaml b/docs/yaml/functions/_build_target_base.yaml
index 1db49a531..1721b29cf 100644
--- a/docs/yaml/functions/_build_target_base.yaml
+++ b/docs/yaml/functions/_build_target_base.yaml
@@ -256,8 +256,11 @@ kwargs:
do not support GNU visibility arguments.
d_import_dirs:
- type: list[str]
- description: List of directories to look in for string imports used in the D programming language.
+ type: list[inc | str]
+ since: 0.62.0
+ description: |
+ the directories to add to the string search path (i.e. `-J` switch for DMD).
+ Must be [[@inc]] objects or plain strings.
d_unittest:
type: bool
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index bd4d15962..9bbab5d60 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2801,6 +2801,12 @@ class Interpreter(InterpreterBase, HoldableObject):
if isinstance(p, build.IncludeDirs):
result.append(p)
elif isinstance(p, str):
+ if key == 'd_import_dirs' and os.path.normpath(p).startswith(self.environment.get_source_dir()):
+ FeatureDeprecated.single_use('Building absolute path to source dir is not supported',
+ '0.45', self.subproject,
+ 'Use a relative path instead.',
+ location=self.current_node)
+ p = os.path.relpath(p, os.path.join(self.environment.get_source_dir(), self.subdir))
result.append(self.build_incdir_object([p]))
else:
raise InterpreterException('Include directory objects can only be created from strings or include directories.')
@@ -3400,7 +3406,7 @@ class Interpreter(InterpreterBase, HoldableObject):
kwargs['language_args'][lang].extend(args)
kwargs['depend_files'].extend(deps)
if targetclass is not build.Jar:
- self.kwarg_strings_to_includedirs(kwargs)
+ kwargs['d_import_dirs'] = self.extract_incdirs(kwargs, 'd_import_dirs')
# Filter out kwargs from other target types. For example 'soversion'
# passed to library() when default_library == 'static'.
@@ -3473,23 +3479,6 @@ class Interpreter(InterpreterBase, HoldableObject):
self.project_args_frozen = True
return target
- def kwarg_strings_to_includedirs(self, kwargs: kwtypes._BuildTarget) -> None:
- if kwargs['d_import_dirs']:
- items = kwargs['d_import_dirs']
- cleaned_items: T.List[build.IncludeDirs] = []
- for i in items:
- if isinstance(i, str):
- # BW compatibility. This was permitted so we must support it
- # for a few releases so people can transition to "correct"
- # path declarations.
- if os.path.normpath(i).startswith(self.environment.get_source_dir()):
- mlog.warning('''Building a path to the source dir is not supported. Use a relative path instead.
-This will become a hard error in the future.''', location=self.current_node)
- i = os.path.relpath(i, os.path.join(self.environment.get_source_dir(), self.subdir))
- i = self.build_incdir_object([i])
- cleaned_items.append(i)
- kwargs['d_import_dirs'] = cleaned_items
-
def add_stdlib_info(self, target):
for l in target.compilers.keys():
dep = self.build.stdlibs[target.for_machine].get(l, None)
diff --git a/test cases/d/9 features/meson.build b/test cases/d/9 features/meson.build
index 50059f169..065ef3a6d 100644
--- a/test cases/d/9 features/meson.build
+++ b/test cases/d/9 features/meson.build
@@ -1,4 +1,4 @@
-project('D Features', 'd', default_options : ['debug=false'])
+project('D Features', 'd', meson_version: '>=1.6', default_options : ['debug=false'])
dc = meson.get_compiler('d')