diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-05-18 01:12:13 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-06-13 17:19:34 -0400 |
commit | f3ba24f2892fa4ccf1c6c198190f43d4da44a761 (patch) | |
tree | bbc6ada8ffdb27248b0c50c84f99dbf3e40ab31c /mesonbuild/backend/backends.py | |
parent | 036181ef6a3e9890a2e50a3b4d84851b15c52e94 (diff) | |
download | meson-f3ba24f2892fa4ccf1c6c198190f43d4da44a761.zip meson-f3ba24f2892fa4ccf1c6c198190f43d4da44a761.tar.gz meson-f3ba24f2892fa4ccf1c6c198190f43d4da44a761.tar.bz2 |
ninja backend: generate additional meta-rules for test/benchmarks targets
'meson-test-prereq' now depends on any targets that were formerly added
directly to 'all'. Behavior is not changed -- the all target still
depends on this other meta-rule, and thus indirectly depends on all
targets it used to depend on.
It is now possible to build just the targets needed for the testsuite
and then e.g. run `meson test --no-rebuild`.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 53fd6da..8524bf9 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations from collections import OrderedDict from dataclasses import dataclass, InitVar @@ -1244,10 +1245,12 @@ class Backend: for name, b in self.build.get_targets().items(): if b.build_by_default: result[name] = b - # Get all targets used as test executables and arguments. These must - # also be built by default. XXX: Sometime in the future these should be - # built only before running tests. - for t in self.build.get_tests(): + return result + + def get_testlike_targets(self, benchmark: bool = False) -> T.OrderedDict[str, T.Union[build.BuildTarget, build.CustomTarget]]: + result: T.OrderedDict[str, T.Union[build.BuildTarget, build.CustomTarget]] = OrderedDict() + targets = self.build.get_benchmarks() if benchmark else self.build.get_tests() + for t in targets: exe = t.exe if isinstance(exe, (build.CustomTarget, build.BuildTarget)): result[exe.get_id()] = exe |