wrap: If the directory exists in a sub-subproject, uses it inplace

A subproject could have a sub-subproject as a git submodule, or part of
the subproject's release tarball, and still have a wrap file for it
(e.g. needed for [provide] section). In that case we need to use the
source tree for the sub-subproject inplace instead of downloading a new
copy into the main project.

This is the case with GLib 2.74, it has a subproject "gvdb" as git
submodule, and part of release tarball, it ships gvdb.wrap file as well.
pull/10864/head
Xavier Claessens 2 years ago committed by Eli Schwartz
parent b9e382835e
commit ed129a5311
  1. 9
      mesonbuild/wrap/wrap.py
  2. 3
      test cases/common/254 subsubproject inplace/meson.build
  3. 3
      test cases/common/254 subsubproject inplace/subprojects/sub/meson.build
  4. 1
      test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build
  5. 2
      test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap

@ -346,9 +346,12 @@ class Resolver:
self.directory = self.wrap.directory
if self.wrap.has_wrap:
# We have a .wrap file, source code will be placed into main
# project's subproject_dir even if the wrap file comes from another
# subproject.
# We have a .wrap file, use directory relative to the location of
# the wrap file if it exists, otherwise source code will be placed
# into main project's subproject_dir even if the wrap file comes
# from another subproject.
self.dirname = os.path.join(os.path.dirname(self.wrap.filename), self.wrap.directory)
if not os.path.exists(self.dirname):
self.dirname = os.path.join(self.subdir_root, self.directory)
# Check if the wrap comes from the main project.
main_fname = os.path.join(self.subdir_root, self.wrap.basename)

@ -0,0 +1,3 @@
project('main')
subproject('sub')
Loading…
Cancel
Save