presym.rake: fix unnecessary full recompilation on single file changes

Restrict .o -> presym.list_path dependency to internal builds only
(mrbc sub-build). Regular host/cross builds don't need this because
:all => :gensym ordering guarantees presym headers exist before .o
compilation, and compiler .d files track header changes.

The broad dependency caused full recompilation because Rake's
all_prerequisite_tasks checks transitive prerequisites: every .o
transitively depended on every .pi file through presym.list_path.

Fixes #6721.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-25 09:09:56 +09:00
parent b9007a8f0a
commit 8df9a22a85
+11 -8
View File
@@ -43,14 +43,17 @@ MRuby.each_target do |build|
end
end
# Ensure object files depend on presym headers being generated.
# This is necessary for sub-builds (e.g., mrbc) whose compilation
# may be triggered during another build's presym scanning.
prereqs.each_key do |prereq|
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
# Internal sub-builds (e.g., mrbc) may be compiled within another
# build's presym scanning chain, before :gensym completes.
# They need explicit .o -> presym.list_path dependencies.
# Regular builds don't need this since :all => :gensym => :build
# already guarantees ordering, and .d files track header changes.
if build.internal?
prereqs.each_key do |prereq|
next unless File.extname(prereq) == build.exts.object
next unless prereq.start_with?(build_dir)
file prereq => presym.list_path
end
end
gensym_task.enhance([presym.list_path])