2 # basic build file for mruby
3 MRUBY_ROOT = File.dirname(File.expand_path(__FILE__))
4 MRUBY_BUILD_HOST_IS_CYGWIN = RUBY_PLATFORM.include?('cygwin')
5 MRUBY_BUILD_HOST_IS_OPENBSD = RUBY_PLATFORM.include?('openbsd')
7 Rake.verbose(false) if Rake.verbose == Rake::DSL::DEFAULT
9 $LOAD_PATH << File.join(MRUBY_ROOT, "lib")
12 require "mruby/core_ext"
15 # load configuration file
16 MRUBY_CONFIG = MRuby::Build.mruby_config_path
20 MRuby.each_target do |build|
25 load "#{MRUBY_ROOT}/tasks/core.rake"
26 load "#{MRUBY_ROOT}/tasks/mrblib.rake"
27 load "#{MRUBY_ROOT}/tasks/mrbgems.rake"
28 load "#{MRUBY_ROOT}/tasks/libmruby.rake"
29 load "#{MRUBY_ROOT}/tasks/bin.rake"
30 load "#{MRUBY_ROOT}/tasks/presym.rake"
31 load "#{MRUBY_ROOT}/tasks/test.rake"
32 load "#{MRUBY_ROOT}/tasks/benchmark.rake"
33 load "#{MRUBY_ROOT}/tasks/doc.rake"
34 load "#{MRUBY_ROOT}/tasks/install.rake"
36 ##############################
37 # generic build targets, rules
40 desc "build all targets, install (locally) in-repo"
41 task :all => :gensym do
42 Rake::Task[:build].invoke
46 MRuby.each_target do |build|
47 build.print_build_summary
52 task :build => MRuby.targets.flat_map{|_, build| build.products}
54 desc "clean all built and in-repo installed artifacts"
56 MRuby.each_target do |build|
60 puts "Cleaned up target build directory"
63 desc "clean everything!"
64 task :deep_clean => %w[clean doc:clean] do
65 MRuby.each_target do |build|
66 rm_rf build.gem_clone_dir
68 rm_rf "#{MRUBY_ROOT}/bin"
69 rm_rf "#{MRUBY_ROOT}/build"
70 puts "Cleaned up mrbgems build directory"
73 desc "run all pre-commit hooks against all files"
75 sh "pre-commit run --all-files"
78 desc "install the pre-commit hooks"
80 sh "pre-commit install"
83 desc "check the pre-commit hooks for updates"
85 sh "pre-commit autoupdate"
88 desc "run all pre-commit hooks against all files with docker-compose"
90 sh "docker-compose -p mruby run test pre-commit run --all-files"
93 desc "build and run all mruby tests with docker-compose"
95 sh "docker-compose -p mruby run test"