@@ -1585,7 +1585,7 @@ def get_custom_target_dir_include_args(
15851585
15861586 def eval_custom_target_command (
15871587 self , target : build .CustomTarget , absolute_outputs : bool = False ) -> \
1588- T .Tuple [T .List [str ], T .List [str ], T .List [str ]]:
1588+ T .Tuple [T .List [str ], T .List [str ], T .List [str | programs . ExternalProgram ]]:
15891589 # We want the outputs to be absolute only when using the VS backend
15901590 # XXX: Maybe allow the vs backend to use relative paths too?
15911591 source_root = self .build_to_src
@@ -1598,7 +1598,7 @@ def eval_custom_target_command(
15981598 outputs = [os .path .join (outdir , i ) for i in target .get_outputs ()]
15991599 inputs = self .get_custom_target_sources (target )
16001600 # Evaluate the command list
1601- cmd : T .List [str ] = []
1601+ cmd : T .List [str | programs . ExternalProgram ] = []
16021602 for i in target .command :
16031603 if isinstance (i , build .BuildTarget ):
16041604 cmd += self .build_target_to_cmd_array (i )
@@ -1634,6 +1634,9 @@ def eval_custom_target_command(
16341634 if not target .absolute_paths :
16351635 pdir = self .get_target_private_dir (target )
16361636 i = i .replace ('@PRIVATE_DIR@' , pdir )
1637+ elif isinstance (i , programs .ExternalProgram ):
1638+ # Let it pass and be extended elsewhere
1639+ pass
16371640 else :
16381641 raise RuntimeError (f'Argument { i } is of unknown type { type (i )} ' )
16391642 cmd .append (i )
@@ -1658,7 +1661,7 @@ def eval_custom_target_command(
16581661 # fixed.
16591662 #
16601663 # https://github.com/mesonbuild/meson/pull/737
1661- cmd = [i .replace ('\\ ' , '/' ) for i in cmd ]
1664+ cmd = [i .replace ('\\ ' , '/' ) if isinstance ( i , str ) else i for i in cmd ]
16621665 return inputs , outputs , cmd
16631666
16641667 def get_introspect_command (self ) -> str :
@@ -2019,6 +2022,8 @@ def get_introspection_data(self, target_id: str, target: build.Target) -> T.List
20192022 compiler += [j ]
20202023 elif isinstance (j , (build .BuildTarget , build .CustomTarget )):
20212024 compiler += j .get_outputs ()
2025+ elif isinstance (j , programs .ExternalProgram ):
2026+ compiler += j .get_command ()
20222027 else :
20232028 raise RuntimeError (f'Type "{ type (j ).__name__ } " is not supported in get_introspection_data. This is a bug' )
20242029
0 commit comments