summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/rust.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-02-03 15:22:57 -0800
committerEli Schwartz <eschwartz93@gmail.com>2023-10-09 17:33:48 -0400
commit523a27c6f0b40c7ed1cc04d4d5c2d74cc9f6b30e (patch)
treed1977175b377ee1d8c63fa8f0486f02614ffcfd9 /mesonbuild/modules/rust.py
parentcbca1919481902efbd5dadda3cc80db84fd75f0c (diff)
downloadmeson-523a27c6f0b40c7ed1cc04d4d5c2d74cc9f6b30e.tar.gz
build: Use typed_kwargs for language args
This also moves the repacking into the interpreter, making the build implementation simpler and removing a layering violation. This also makes use a defaultdict to remove the need to call `.get()`
Diffstat (limited to 'mesonbuild/modules/rust.py')
-rw-r--r--mesonbuild/modules/rust.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 08aee16c8..98bf05312 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
-
import os
import typing as T
from mesonbuild.interpreterbase.decorators import FeatureNew
@@ -160,12 +159,14 @@ class RustModule(ExtensionModule):
new_target_kwargs = base_target.original_kwargs.copy()
# Don't mutate the shallow copied list, instead replace it with a new
# one
- new_target_kwargs['rust_args'] = \
- new_target_kwargs.get('rust_args', []) + kwargs['rust_args'] + ['--test']
new_target_kwargs['install'] = False
new_target_kwargs['dependencies'] = new_target_kwargs.get('dependencies', []) + kwargs['dependencies']
new_target_kwargs['link_with'] = new_target_kwargs.get('link_with', []) + kwargs['link_with']
+ lang_args = base_target.extra_args.copy()
+ lang_args['rust'] = base_target.extra_args['rust'] + kwargs['rust_args'] + ['--test']
+ new_target_kwargs['language_args'] = lang_args
+
sources = T.cast('T.List[SourceOutputs]', base_target.sources.copy())
sources.extend(base_target.generated)