diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-03-18 19:46:47 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2022-03-21 11:26:52 -0700 |
commit | 9b83fc5ece8932661ea0255e5362417fef117b15 (patch) | |
tree | 411b767330b560b74cd54b295b758d10d6db7eb0 /mesonbuild/backend/ninjabackend.py | |
parent | f9445300b3015308fd6a3e0305cf8e5b7f002211 (diff) | |
download | meson-9b83fc5ece8932661ea0255e5362417fef117b15.zip meson-9b83fc5ece8932661ea0255e5362417fef117b15.tar.gz meson-9b83fc5ece8932661ea0255e5362417fef117b15.tar.bz2 |
ninja: fix handling of rust structured_sources in rare case
In the even that all of the inputs are generated, and they're all
generated into the same folder, and there are no subfolders, we would
fail to correctly handle all of the files after the main file. Let's fix
that.t
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 691f844..614e864 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1709,17 +1709,24 @@ class NinjaBackend(backends.Backend): _ods, main_rust_file = self.__generate_compile_structure(target) orderdeps.extend(_ods) else: + # The only way to get here is to have only files in the "root" + # positional argument, which are all generated into the same + # directory g = target.structured_sources.first_file() if isinstance(g, File): main_rust_file = g.rel_to_builddir(self.build_to_src) elif isinstance(g, GeneratedList): - main_rust_file = os.path.join(self.get_target_private_dir(target), i) + main_rust_file = os.path.join(self.get_target_private_dir(target), g.get_outputs()[0]) else: - main_rust_file = os.path.join(g.get_subdir(), i) - orderdeps.extend([os.path.join(self.build_to_src, target.subdir, s) - for s in target.structured_sources.as_list()]) + main_rust_file = os.path.join(g.get_subdir(), g.get_outputs()[0]) + for f in target.structured_sources.as_list(): + if isinstance(f, File): + orderdeps.append(f.rel_to_builddir(self.build_to_src)) + else: + orderdeps.extend([os.path.join(self.build_to_src, f.subdir, s) + for s in f.get_outputs()]) for i in target.get_sources(): if not rustc.can_compile(i): |