mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
67a28b56ab
`.pi` files are created for `.o` files that `build.products` depends on, but an error will occur if the build rule is unknown, so add a check. I don't think this situation would normally arise. However, in `mattn/mruby-onig-regexp`, when using bundled onigmo, onigmo's `.o` files are added to dependency of `libmruby.a` in the second and subsequent builds, and mruby does not know the build rule, so the following error had occured. ```console rake aborted! Don't know how to build task '/mruby/build/host/mrbgems/mruby-onig-regexp/onigmo-6.2.0/libonig_objs/ascii.pi' (See the list of available tasks with `rake --tasks`) ```
49 lines
1.6 KiB
Ruby
49 lines
1.6 KiB
Ruby
all_prerequisites = ->(task_name, prereqs) do
|
|
Rake::Task[task_name].prerequisites.each do |prereq_name|
|
|
next if prereqs[prereq_name]
|
|
prereqs[prereq_name] = true
|
|
all_prerequisites.(Rake::Task[prereq_name].name, prereqs)
|
|
end
|
|
end
|
|
|
|
MRuby.each_target do |build|
|
|
gensym_task = task(:gensym)
|
|
next unless build.presym_enabled?
|
|
|
|
presym = build.presym
|
|
|
|
include_dir = "#{build.build_dir}/include"
|
|
build.compilers.each{|c| c.include_paths << include_dir}
|
|
build.gems.each{|gem| gem.compilers.each{|c| c.include_paths << include_dir}}
|
|
|
|
prereqs = {}
|
|
ppps = []
|
|
build_dir = "#{build.build_dir}/"
|
|
mrbc_build_dir = "#{build.mrbc_build.build_dir}/" if build.mrbc_build
|
|
build.products.each{|product| all_prerequisites.(product, prereqs)}
|
|
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)
|
|
ppp = prereq.ext(build.exts.presym_preprocessed)
|
|
if Rake.application.lookup(ppp) ||
|
|
Rake.application.enhance_with_matching_rule(ppp)
|
|
ppps << ppp
|
|
end
|
|
end
|
|
|
|
file presym.list_path => ppps do
|
|
presyms = presym.scan(ppps)
|
|
current_presyms = presym.read_list if File.exist?(presym.list_path)
|
|
update = presyms != current_presyms
|
|
presym.write_list(presyms) if update
|
|
mkdir_p presym.header_dir
|
|
%w[id table].each do |type|
|
|
next if !update && File.exist?(presym.send("#{type}_header_path"))
|
|
presym.send("write_#{type}_header", presyms)
|
|
end
|
|
end
|
|
|
|
gensym_task.enhance([presym.list_path])
|
|
end
|