Merge pull request #6281 from dearblue/binding
[mruby.git] / Rakefile
blob79ec84f679b8df61a3d33afe66506c17a7890ebf
1 # Build description.
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")
11 # load build systems
12 require "mruby/core_ext"
13 require "mruby/build"
15 # load configuration file
16 MRUBY_CONFIG = MRuby::Build.mruby_config_path
17 load MRUBY_CONFIG
19 # load basic rules
20 MRuby.each_target do |build|
21   build.define_rules
22 end
24 # load custom rules
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
38 task :default => :all
40 desc "build all targets, install (locally) in-repo"
41 task :all => :gensym do
42   Rake::Task[:build].invoke
43   puts
44   puts "Build summary:"
45   puts
46   MRuby.each_target do |build|
47     build.print_build_summary
48   end
49   MRuby::Lockfile.write
50 end
52 task :build => MRuby.targets.flat_map{|_, build| build.products}
54 desc "clean all built and in-repo installed artifacts"
55 task :clean do
56   MRuby.each_target do |build|
57     rm_rf build.build_dir
58     rm_f build.products
59   end
60   puts "Cleaned up target build directory"
61 end
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
67   end
68   rm_rf "#{MRUBY_ROOT}/bin"
69   rm_rf "#{MRUBY_ROOT}/build"
70   puts "Cleaned up mrbgems build directory"
71 end
73 desc "run all pre-commit hooks against all files"
74 task :check do
75   sh "pre-commit run --all-files"
76 end
78 desc "install the pre-commit hooks"
79 task :checkinstall do
80   sh "pre-commit install"
81 end
83 desc "check the pre-commit hooks for updates"
84 task :checkupdate do
85   sh "pre-commit autoupdate"
86 end
88 desc "run all pre-commit hooks against all files with docker-compose"
89 task :composecheck do
90   sh "docker-compose -p mruby run test pre-commit run --all-files"
91 end
93 desc "build and run all mruby tests with docker-compose"
94 task :composetest do
95   sh "docker-compose -p mruby run test"
96 end