@@ -234,16 +234,19 @@ fn launch_v2_compiler(is_verbose bool, args []string, is_ownership bool) {
234234 tool_name := if is_ownership { 'v2_ownership' } else { 'v2' }
235235 mut v2_exe := os.getenv (delegated_v2_ exe_env)
236236 if v2_exe == '' {
237- v2_source := os.join_path (vroot, 'cmd' , 'v2' , 'v2.v' )
237+ v2_main_source := os.join_path (vroot, 'cmd' , 'v2' , 'v2.v' )
238+ v2_cmd_dir := os.join_path (vroot, 'cmd' , 'v2' )
239+ v2_vlib_dir := os.join_path (vroot, 'vlib' , 'v2' )
238240 v2_exe = cached_v2_executable_path (vroot, is_ownership)
239241 v2_exe_dir := os.dir (v2_ exe)
240242 os.mkdir_all (v2_ exe_dir) or {
241243 eprintln ('cannot create `${v2_exe_dir} `: ${err} ' )
242244 exit (1 )
243245 }
244- if util.should_recompile_tool (vexe, v2_ source, tool_name, v2_ exe) {
246+ if util.should_recompile_tool (vexe, v2_ cmd_dir, tool_name, v2_ exe)
247+ || util.should_recompile_tool (vexe, v2_ vlib_dir, tool_name, v2_ exe) {
245248 d_flag := if is_ownership { '-d ownership ' } else { '' }
246- compilation_command := '${os.quoted_path(vexe)} ${d_flag} -o ${os.quoted_path(v2_exe)} ${os.quoted_path(v2_source )} '
249+ compilation_command := '${os.quoted_path(vexe)} ${d_flag} -o ${os.quoted_path(v2_exe)} ${os.quoted_path(v2_main_source )} '
247250 if is_verbose {
248251 println ('Compiling ${tool_name} with: "${compilation_command} "' )
249252 }
@@ -252,7 +255,7 @@ fn launch_v2_compiler(is_verbose bool, args []string, is_ownership bool) {
252255 tool_compilation := os.execute (compilation_command)
253256 os.chdir (current_work_dir) or {}
254257 if tool_compilation.exit_code != 0 {
255- eprintln ('cannot compile `${v2_source } `: ${tool_compilation.exit_code} \n ${tool_compilation.output} ' )
258+ eprintln ('cannot compile `${v2_main_source } `: ${tool_compilation.exit_code} \n ${tool_compilation.output} ' )
256259 exit (1 )
257260 }
258261 }
0 commit comments