@ -2383,6 +2383,7 @@ class Interpreter(InterpreterBase):
default_project_options : T . Optional [ T . Dict [ str , str ] ] = None ,
mock : bool = False ,
ast : T . Optional [ mparser . CodeBlockNode ] = None ,
is_translated : bool = False ,
) - > None :
super ( ) . __init__ ( build . environment . get_source_dir ( ) , subdir , subproject )
self . an_unpicklable_object = mesonlib . an_unpicklable_object
@ -2421,8 +2422,16 @@ class Interpreter(InterpreterBase):
self . default_project_options = { }
self . project_default_options = { }
self . build_func_dict ( )
# build_def_files needs to be defined before parse_project is called
self . build_def_files = [ os . path . join ( self . subdir , environment . build_filename ) ]
#
# For non-meson subprojects, we'll be using the ast. Even if it does
# exist we don't want to add a dependency on it, it's autogenerated
# from the actual build files, and is just for reference.
self . build_def_files = [ ]
build_filename = os . path . join ( self . subdir , environment . build_filename )
if not is_translated :
self . build_def_files . append ( build_filename )
if not mock :
self . parse_project ( )
self . _redetect_machines ( )
@ -2941,11 +2950,14 @@ external dependencies (including libraries) must go to "dependencies".''')
return self . disabled_subproject ( subp_name , exception = e )
raise e
def _do_subproject_meson ( self , subp_name , subdir , default_options , kwargs , ast = None , build_def_files = None ) :
def _do_subproject_meson ( self , subp_name : str , subdir : str , default_options , kwargs ,
ast : T . Optional [ mparser . CodeBlockNode ] = None ,
build_def_files : T . Optional [ T . List [ str ] ] = None ,
is_translated : bool = False ) - > SubprojectHolder :
with mlog . nested ( ) :
new_build = self . build . copy ( )
subi = Interpreter ( new_build , self . backend , subp_name , subdir , self . subproject_dir ,
self . modules , default_options , ast = ast )
self . modules , default_options , ast = ast , is_translated = is_translated )
subi . subprojects = self . subprojects
subi . subproject_stack = self . subproject_stack + [ subp_name ]
@ -2971,8 +2983,8 @@ external dependencies (including libraries) must go to "dependencies".''')
# Duplicates are possible when subproject uses files from project root
if build_def_files :
self . build_def_files = list ( set ( self . build_def_files + build_def_files ) )
else :
self . build_def_files = list ( set ( self . build_def_files + subi . build_def_files ) )
# We always need the subi.build_def_files, to propgate sub-sub-projects
self . build_def_files = list ( set ( self . build_def_files + subi . build_def_files ) )
self . build . merge ( subi . build )
self . build . subprojects [ subp_name ] = subi . project_version
self . summary . update ( subi . summary )
@ -3016,7 +3028,7 @@ external dependencies (including libraries) must go to "dependencies".''')
mlog . cmd_ci_include ( meson_filename )
mlog . log ( )
result = self . _do_subproject_meson ( subp_name , subdir , default_options , kwargs , ast , cm_int . bs_files )
result = self . _do_subproject_meson ( subp_name , subdir , default_options , kwargs , ast , cm_int . bs_files , is_translated = True )
result . cm_interpreter = cm_int
mlog . log ( )