From eaf463ada3d28cfb62f59137e59246827bb287e7 Mon Sep 17 00:00:00 2001 From: take-cheeze Date: Fri, 22 Jun 2018 11:43:14 +0900 Subject: Run tests parallelly for each target. --- Rakefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 2f6fa056f..d2ad9044c 100644 --- a/Rakefile +++ b/Rakefile @@ -118,10 +118,21 @@ task :all => depfiles do end desc "run all mruby tests" -task :test => ["all"] do - MRuby.each_target do - run_test if test_enabled? +MRuby.each_target do + next unless test_enabled? + + t = :"test_#{self.name}" + task t => ["all"] do + run_test + end + task :test => t + + next unless bintest_enabled? + t = :"bintest_#{self.name}" + task t => ["all"] do + run_bintest end + task :test => t end desc "clean all built and in-repo installed artifacts" -- cgit v1.2.3 From b37b31208152fdee0cb99e00cffec0b9e57040c6 Mon Sep 17 00:00:00 2001 From: take-cheeze Date: Mon, 29 Oct 2018 13:56:20 +0900 Subject: Rename libmruby stuff to avoid confusion --- Rakefile | 4 ++-- lib/mruby/build.rb | 18 ++++++++++++++++-- lib/mruby/gem.rb | 2 +- mrbgems/mruby-bin-mrbc/mrbgem.rake | 2 +- mrbgems/mruby-bin-mruby-config/mrbgem.rake | 2 +- mrbgems/mruby-compiler/mrbgem.rake | 2 +- mrbgems/mruby-test/mrbgem.rake | 5 +---- mrblib/mrblib.rake | 2 +- src/mruby_core.rake | 4 ++-- tasks/libmruby.rake | 6 +++--- tasks/mrbgems.rake | 2 +- 11 files changed, 30 insertions(+), 19 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index d2ad9044c..20b6096f5 100644 --- a/Rakefile +++ b/Rakefile @@ -65,7 +65,7 @@ MRuby.each_target do |target| exec = exefile("#{build_dir}/bin/#{bin}") objs = Dir.glob("#{current_dir}/tools/#{bin}/*.{c,cpp,cxx,cc}").map { |f| objfile(f.pathmap("#{current_build_dir}/tools/#{bin}/%n")) } - file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t| + file exec => objs + target.libraries do |t| gem_flags = gems.map { |g| g.linker.flags } gem_flags_before_libraries = gems.map { |g| g.linker.flags_before_libraries } gem_flags_after_libraries = gems.map { |g| g.linker.flags_after_libraries } @@ -100,7 +100,7 @@ MRuby.each_target do |target| end depfiles += MRuby.targets.map { |n, t| - [t.libfile("#{t.build_dir}/lib/libmruby")] + t.libraries }.flatten depfiles += MRuby.targets.reject { |n, t| n == 'host' }.map { |n, t| diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 047ae13dc..7a0f7a759 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -45,9 +45,11 @@ module MRuby include Rake::DSL include LoadGems attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir - attr_reader :libmruby, :gems, :toolchains + attr_reader :libmruby_objs, :gems, :toolchains attr_writer :enable_bintest, :enable_test + alias libmruby libmruby_objs + COMPILERS = %w(cc cxx objc asm) COMMANDS = COMPILERS + %w(linker archiver yacc gperf git exts mrbc) attr_block MRuby::Build::COMMANDS @@ -81,7 +83,7 @@ module MRuby @mrbc = Command::Mrbc.new(self) @bins = [] - @gems, @libmruby = MRuby::Gem::List.new, [] + @gems, @libmruby_objs = MRuby::Gem::List.new, [] @build_mrbtest_lib_only = false @cxx_exception_enabled = false @cxx_exception_disabled = false @@ -327,6 +329,18 @@ EOS puts "================================================" puts end + + def libmruby_static + libfile("#{build_dir}/lib/libmruby") + end + + def libmruby_core_static + libfile("#{build_dir}/lib/libmruby_core") + end + + def libraries + [libmruby_static] + end end # Build class CrossBuild < Build diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb index 7e97c34f3..ba4d5d17a 100644 --- a/lib/mruby/gem.rb +++ b/lib/mruby/gem.rb @@ -87,7 +87,7 @@ module MRuby fail "#{name || dir} required to set name, license(s) and author(s)" end - build.libmruby << @objs + build.libmruby_objs << @objs instance_eval(&@build_config_initializer) if @build_config_initializer end diff --git a/mrbgems/mruby-bin-mrbc/mrbgem.rake b/mrbgems/mruby-bin-mrbc/mrbgem.rake index e710b5a49..48b67aedb 100644 --- a/mrbgems/mruby-bin-mrbc/mrbgem.rake +++ b/mrbgems/mruby-bin-mrbc/mrbgem.rake @@ -8,7 +8,7 @@ MRuby::Gem::Specification.new 'mruby-bin-mrbc' do |spec| exec = exefile("#{build.build_dir}/bin/mrbc") mrbc_objs = Dir.glob("#{spec.dir}/tools/mrbc/*.c").map { |f| objfile(f.pathmap("#{spec.build_dir}/tools/mrbc/%n")) }.flatten - file exec => mrbc_objs + [libfile("#{build.build_dir}/lib/libmruby_core")] do |t| + file exec => mrbc_objs + [build.libmruby_core_static] do |t| build.linker.run t.name, t.prerequisites end diff --git a/mrbgems/mruby-bin-mruby-config/mrbgem.rake b/mrbgems/mruby-bin-mruby-config/mrbgem.rake index 32ae2164b..cca7423ac 100644 --- a/mrbgems/mruby-bin-mruby-config/mrbgem.rake +++ b/mrbgems/mruby-bin-mruby-config/mrbgem.rake @@ -20,7 +20,7 @@ MRuby.each_target do @bins << mruby_config make_cfg = "#{build_dir}/lib/libmruby.flags.mak" - file mruby_config_path => [libfile("#{build_dir}/lib/libmruby"), make_cfg] do |t| + file mruby_config_path => [libmruby_static, make_cfg] do |t| FileUtils.copy "#{File.dirname(__FILE__)}/#{mruby_config}", t.name config = Hash[open(make_cfg).read.split("\n").map {|x| a = x.split(/\s*=\s*/, 2); [a[0], a[1].gsub('\\"', '"') ]}] IO.write(t.name, File.open(t.name) {|f| diff --git a/mrbgems/mruby-compiler/mrbgem.rake b/mrbgems/mruby-compiler/mrbgem.rake index e9e0cc2c7..fa191e69b 100644 --- a/mrbgems/mruby-compiler/mrbgem.rake +++ b/mrbgems/mruby-compiler/mrbgem.rake @@ -35,6 +35,6 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec| gperf.run t.name, t.prerequisites.first end - file libfile("#{build.build_dir}/lib/libmruby_core") => core_objs + file build.libmruby_core_static => core_objs build.libmruby << core_objs end diff --git a/mrbgems/mruby-test/mrbgem.rake b/mrbgems/mruby-test/mrbgem.rake index 589fc688a..c9d254bfe 100644 --- a/mrbgems/mruby-test/mrbgem.rake +++ b/mrbgems/mruby-test/mrbgem.rake @@ -16,9 +16,6 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| mlib = clib.ext(exts.object) exec = exefile("#{build.build_dir}/bin/mrbtest") - libmruby = libfile("#{build.build_dir}/lib/libmruby") - libmruby_core = libfile("#{build.build_dir}/lib/libmruby_core") - mrbtest_lib = libfile("#{build_dir}/mrbtest") mrbtest_objs = [] @@ -140,7 +137,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| end unless build.build_mrbtest_lib_only? - file exec => [driver_obj, mlib, mrbtest_lib, libmruby_core, libmruby] do |t| + file exec => [driver_obj, mlib, mrbtest_lib, build.libmruby_static] do |t| gem_flags = build.gems.map { |g| g.linker.flags } gem_flags_before_libraries = build.gems.map { |g| g.linker.flags_before_libraries } gem_flags_after_libraries = build.gems.map { |g| g.linker.flags_after_libraries } diff --git a/mrblib/mrblib.rake b/mrblib/mrblib.rake index fe4aae1f7..6895d4252 100644 --- a/mrblib/mrblib.rake +++ b/mrblib/mrblib.rake @@ -3,7 +3,7 @@ MRuby.each_target do relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) current_build_dir = "#{build_dir}/#{relative_from_root}" - self.libmruby << objfile("#{current_build_dir}/mrblib") + self.libmruby_objs << objfile("#{current_build_dir}/mrblib") file objfile("#{current_build_dir}/mrblib") => "#{current_build_dir}/mrblib.c" file "#{current_build_dir}/mrblib.c" => [mrbcfile, __FILE__] + Dir.glob("#{current_dir}/*.rb").sort do |t| diff --git a/src/mruby_core.rake b/src/mruby_core.rake index bb3d7b633..3024c8544 100644 --- a/src/mruby_core.rake +++ b/src/mruby_core.rake @@ -12,9 +12,9 @@ MRuby.each_target do if cxx_exception_enabled? objs += %w(vm error).map { |v| compile_as_cxx "#{current_dir}/#{v}.c", "#{current_build_dir}/#{v}.cxx" } end - self.libmruby << objs + self.libmruby_objs << objs - file libfile("#{build_dir}/lib/libmruby_core") => objs do |t| + file libmruby_core_static => objs do |t| archiver.run t.name, t.prerequisites end end diff --git a/tasks/libmruby.rake b/tasks/libmruby.rake index b6ef29986..ab5a15b4a 100644 --- a/tasks/libmruby.rake +++ b/tasks/libmruby.rake @@ -1,9 +1,9 @@ MRuby.each_target do - file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t| + file libmruby_static => libmruby_objs.flatten do |t| archiver.run t.name, t.prerequisites end - file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libfile("#{build_dir}/lib/libmruby")] do |t| + file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libmruby_static] do |t| FileUtils.mkdir_p File.dirname t.name open(t.name, 'w') do |f| f.puts "MRUBY_CFLAGS = #{cc.all_flags}" @@ -18,7 +18,7 @@ MRuby.each_target do gem_libraries = gems.map { |g| g.linker.libraries } f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries)}" - f.puts "MRUBY_LIBMRUBY_PATH = #{libfile("#{build_dir}/lib/libmruby")}" + f.puts "MRUBY_LIBMRUBY_PATH = #{libmruby_static}" end end task :all => "#{build_dir}/lib/libmruby.flags.mak" diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake index e2aeb1514..fb76856e5 100644 --- a/tasks/mrbgems.rake +++ b/tasks/mrbgems.rake @@ -5,7 +5,7 @@ MRuby.each_target do gems.check self # loader all gems - self.libmruby << objfile("#{build_dir}/mrbgems/gem_init") + 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__] do |t| FileUtils.mkdir_p "#{build_dir}/mrbgems" -- cgit v1.2.3 From 96bea076ec85a86ba715d5574eaf310e05f1a587 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 24 Dec 2018 12:12:10 +0900 Subject: Refine description for rake test tasks. Before: $ rake -T test rake test_test # run all mruby tests After: $ rake -T test rake test # run all mruby tests --- Rakefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 20b6096f5..47da28166 100644 --- a/Rakefile +++ b/Rakefile @@ -118,6 +118,7 @@ task :all => depfiles do end desc "run all mruby tests" +task :test MRuby.each_target do next unless test_enabled? -- cgit v1.2.3 From 107dc0c7789acfeeed8de8b9d1f78996e0838f99 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Fri, 18 Jan 2019 23:29:35 +0900 Subject: Avoid a side effect when run Rake without execution of tasks Avoid directory creation when run `rake -T` etc. --- Rakefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 47da28166..6c160a5ed 100644 --- a/Rakefile +++ b/Rakefile @@ -32,20 +32,25 @@ load "#{MRUBY_ROOT}/tasks/benchmark.rake" load "#{MRUBY_ROOT}/tasks/gitlab.rake" +def install_D(src, dst) + opts = { :verbose => $verbose } + FileUtils.rm_f dst, opts + FileUtils.mkdir_p File.dirname(dst), opts + FileUtils.cp src, dst, opts +end + ############################## # generic build targets, rules task :default => :all bin_path = ENV['INSTALL_DIR'] || "#{MRUBY_ROOT}/bin" -FileUtils.mkdir_p bin_path, { :verbose => $verbose } depfiles = MRuby.targets['host'].bins.map do |bin| install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}") source_path = MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/#{bin}") file install_path => source_path do |t| - FileUtils.rm_f t.name, { :verbose => $verbose } - FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose } + install_D t.prerequisites.first, t.name end install_path @@ -78,8 +83,7 @@ MRuby.each_target do |target| install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}") file install_path => exec do |t| - FileUtils.rm_f t.name, { :verbose => $verbose } - FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose } + install_D t.prerequisites.first, t.name end depfiles += [ install_path ] elsif target == MRuby.targets['host-debug'] @@ -87,8 +91,7 @@ MRuby.each_target do |target| install_path = MRuby.targets['host-debug'].exefile("#{bin_path}/#{bin}") file install_path => exec do |t| - FileUtils.rm_f t.name, { :verbose => $verbose } - FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose } + install_D t.prerequisites.first, t.name end depfiles += [ install_path ] end -- cgit v1.2.3 From 441c964716a0279f7f37cad06978d6261a1651db Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Fri, 8 Mar 2019 22:00:06 +0900 Subject: Allow `enable_bintest` without `enable_test` in build config --- Rakefile | 23 ++++++++++++----------- lib/mruby/gem.rb | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 6c160a5ed..533153290 100644 --- a/Rakefile +++ b/Rakefile @@ -123,20 +123,21 @@ end desc "run all mruby tests" task :test MRuby.each_target do - next unless test_enabled? - - t = :"test_#{self.name}" - task t => ["all"] do - run_test + if test_enabled? + t = :"test_#{self.name}" + task t => ["all"] do + run_test + end + task :test => t end - task :test => t - next unless bintest_enabled? - t = :"bintest_#{self.name}" - task t => ["all"] do - run_bintest + if bintest_enabled? + t = :"bintest_#{self.name}" + task t => ["all"] do + run_bintest + end + task :test => t end - task :test => t end desc "clean all built and in-repo installed artifacts" diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb index 33396803a..ce2e01ab1 100644 --- a/lib/mruby/gem.rb +++ b/lib/mruby/gem.rb @@ -112,7 +112,7 @@ module MRuby end def add_test_dependency(*args) - add_dependency(*args) if build.test_enabled? + add_dependency(*args) if build.test_enabled? || build.bintest_enabled? end def add_conflict(name, *req) -- cgit v1.2.3