diff options
| author | KOBAYASHI Shuji <[email protected]> | 2020-07-14 19:55:23 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2020-07-14 19:55:23 +0900 |
| commit | 49896a4d28f1fa054c95ccb7ec97c610fb75b3d2 (patch) | |
| tree | bbd9d1519f64c03bbe3cc235abf253ba37f1c12c | |
| parent | e3bb95bb6de95b7661fa28ffccd81dc08cd075a1 (diff) | |
| download | mruby-49896a4d28f1fa054c95ccb7ec97c610fb75b3d2.tar.gz mruby-49896a4d28f1fa054c95ccb7ec97c610fb75b3d2.zip | |
Fix `${build_dir}/mrbgems/gem_init.c` generation condition; ref #5010
The `${build_dir}/mrbgems/gem_init.c` generation condition has been changed
at #5010, but it is somewhat insufficient, for example, there was a problem
with `rake && rake test`, which was also regenerated in `rake test`.
| -rw-r--r-- | mrbgems/mruby-test/mrbgem.rake | 14 | ||||
| -rw-r--r-- | tasks/mrbgems.rake | 12 |
2 files changed, 12 insertions, 14 deletions
diff --git a/mrbgems/mruby-test/mrbgem.rake b/mrbgems/mruby-test/mrbgem.rake index 97189a67b..ced252ae6 100644 --- a/mrbgems/mruby-test/mrbgem.rake +++ b/mrbgems/mruby-test/mrbgem.rake @@ -146,20 +146,8 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| end end - # store the last gem selection and make the re-build - # of the test gem depending on a change to the gem - # selection - active_gems_path = "#{build_dir}/active_gems_path.lst" - active_gem_list = File.read active_gems_path if File.exist? active_gems_path - current_gem_list = build.gems.map(&:name).join("\n") - task active_gems_path do |_t| - mkdir_p File.dirname(active_gems_path) - File.write active_gems_path, current_gem_list - end - file clib => active_gems_path if active_gem_list != current_gem_list - file mlib => clib - file clib => [build.mrbcfile, __FILE__] do |_t| + file clib => ["#{build.build_dir}/mrbgems/active_gems.txt", build.mrbcfile, __FILE__] do |_t| _pp "GEN", "*.rb", "#{clib.relative_path}" mkdir_p File.dirname(clib) open(clib, 'w') do |f| diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake index c814a16db..0a3ae652d 100644 --- a/tasks/mrbgems.rake +++ b/tasks/mrbgems.rake @@ -5,9 +5,10 @@ MRuby.each_target do gems.check self # loader all gems + active_gems_txt = "#{build_dir}/mrbgems/active_gems.txt" self.libmruby_objs << objfile("#{build_dir}/mrbgems/gem_init") file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"] - file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__, *Dir.glob("#{build_dir}/mrbgems/mruby-*/*.c")] do |t| + file "#{build_dir}/mrbgems/gem_init.c" => [active_gems_txt, MRUBY_CONFIG, __FILE__] do |t| mkdir_p "#{build_dir}/mrbgems" open(t.name, 'w') do |f| gem_func_gems = gems.select { |g| g.generate_functions } @@ -49,6 +50,15 @@ MRuby.each_target do f.puts %Q[}] end end + file active_gems_txt => :generate_active_gems_txt + task :generate_active_gems_txt do |t| + def t.timestamp; Time.at(0) end + active_gems = gems.sort_by(&:name).inject(""){|s, g| s << "#{g.name}\n"} + if !File.exist?(active_gems_txt) || File.read(active_gems_txt) != active_gems + mkdir_p File.dirname(active_gems_txt) + File.write(active_gems_txt, active_gems) + end + end end # legal documents |
