meson icon indicating copy to clipboard operation
meson copied to clipboard

Store include and compile arguments separately in non-internal Dependencies

Open dcbaker opened this issue 3 years ago • 8 comments

Currently, InternalDependency stores include directories separately from other compile specific flags, but all other dependency types combine them. This is problematic for any code wanting to get only the include paths, specifically dependency.partial_dependency(), which when used with dependency.partial_dependency(includes : true) only works with a dependency declared with declare_dependency.

This series attempts to change the other dependencies to work the same way. I say attempts because there's a lot of code that doesn't make any effort to separate the flags conceptually. This should work for pkg-config, which is the majority of the dependency usage. I think this works for cmake as well, which makes up the second largest chunk of dependencies. System and Builtin Dependency should work as well, and I think that ConfigTool dependencies work in general, though some of them may not work. Boost is the biggest black hole to me, as none of the tests work on nixos, and I haven't been properly motivated to sort them out.

I fully expect to find a lot of bugs in this, even though I've submitted it as an MR. It's complicated to code touching a large swath of Meson and the test coverage of dependencies usually isn't great.

dcbaker avatar Mar 14 '22 20:03 dcbaker

Codecov Report

Merging #10122 (e6f9f3f) into master (9d64143) will decrease coverage by 8.95%. The diff coverage is 67.09%.

:exclamation: Current head e6f9f3f differs from pull request most recent head 703603f. Consider uploading reports for the commit 703603f to get more accurate results

@@            Coverage Diff             @@
##           master   #10122      +/-   ##
==========================================
- Coverage   70.00%   61.05%   -8.95%     
==========================================
  Files         212      204       -8     
  Lines       46295    43475    -2820     
  Branches    10971     9668    -1303     
==========================================
- Hits        32409    26545    -5864     
- Misses      11394    14810    +3416     
+ Partials     2492     2120     -372     
Impacted Files Coverage Δ
mesonbuild/dependencies/ui.py 34.89% <0.00%> (-27.85%) :arrow_down:
mesonbuild/envconfig.py 74.38% <ø> (-2.43%) :arrow_down:
mesonbuild/dependencies/hdf5.py 18.75% <15.38%> (-67.62%) :arrow_down:
mesonbuild/dependencies/scalapack.py 20.25% <16.66%> (-18.71%) :arrow_down:
mesonbuild/dependencies/mpi.py 18.05% <25.00%> (-45.84%) :arrow_down:
mesonbuild/dependencies/dev.py 38.23% <28.57%> (-24.27%) :arrow_down:
mesonbuild/dependencies/misc.py 30.94% <33.33%> (-28.32%) :arrow_down:
mesonbuild/interpreter/interpreterobjects.py 87.85% <33.33%> (-2.78%) :arrow_down:
mesonbuild/dependencies/boost.py 43.31% <66.66%> (-39.99%) :arrow_down:
mesonbuild/dependencies/pkgconfig.py 63.03% <66.66%> (-10.22%) :arrow_down:
... and 13 more

... and 194 files with indirect coverage changes

codecov[bot] avatar Mar 14 '22 20:03 codecov[bot]

Rebased and passing all tests locally (Only on Linux, and on nix some of the tests fail regardless, so there still might be some issues here)

dcbaker avatar May 18 '23 03:05 dcbaker

So, umm. these msys failures are really intresting. We're getting something like -I/D/some/path\, and shlex is choking on that \, which it sees as an escape with no character.... So, is this a bug in pkgconf, msys, or should Meson be looking for this and fixing it?

I am really curious as to why they only show up with the split cflags and include flags though.

dcbaker avatar Jun 03 '23 03:06 dcbaker

known pkgconf issue: https://gitea.treehouse.systems/ariadne/pkgconf/issues/238

dcbaker avatar Jun 05 '23 16:06 dcbaker

I don't use msys2 otherwise I would lend a hand.

tristan957 avatar Jun 05 '23 17:06 tristan957

It really helps to test the right branch in mingw... Sigh

I can reproduce the error now

dcbaker avatar Jun 05 '23 18:06 dcbaker

The bug itself seems rather trivial: https://gitea.treehouse.systems/ariadne/pkgconf/pulls/249

Working around it in Meson seems somewhat harder... Sigh

dcbaker avatar Jun 05 '23 22:06 dcbaker

Ping me when you get the tests passing. I'll give another review.

tristan957 avatar Apr 11 '24 05:04 tristan957