diff --git a/tasks/presym.rake b/tasks/presym.rake index 619957e99..7a9262fad 100644 --- a/tasks/presym.rake +++ b/tasks/presym.rake @@ -29,7 +29,7 @@ MRuby.each_target do |build| end end - file presym.list_path => ppps do + presym_task = file presym.list_path => ppps do presyms = presym.scan(ppps) current_presyms = presym.read_list if File.exist?(presym.list_path) if presyms != current_presyms @@ -41,6 +41,21 @@ MRuby.each_target do |build| end end + # Don't directly write dependency tasks in the "task" arguments. + # The rake system tracks dependencies recursively + # (see Rake::Task#all_prerequisite_tasks and #collect_prerequisites). + # Therefore, indirect dependencies from ".o" to ".pi" must be eliminated. + # ref. https://github.com/mruby/mruby/issues/6721 + # This task acts a proxy-like for the "presym.list_path" task. + presym_proxy = task "gensym:update:#{build.name}" do + presym_task.invoke + end + + # Override the "timestamp" method to reflect the presym file. + presym_proxy.define_singleton_method :timestamp do + presym_task.timestamp + end + # Ensure .o files depend on presym headers being generated. # This is critical when a build's .o files are compiled during another # build's presym scanning chain (before :gensym completes), e.g.: @@ -50,7 +65,7 @@ MRuby.each_target do |build| next unless File.extname(prereq) == build.exts.object next unless prereq.start_with?(build_dir) next if mrbc_build_dir && prereq.start_with?(mrbc_build_dir) - file prereq => presym.list_path + file prereq => presym_proxy end task gensym: presym.list_path