From e312842a1866a551c0b73bdf21f52ad94d25152a Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Thu, 22 Aug 2019 21:40:01 +0900 Subject: Refine processing for gem lock file - Defer YAML library and lock file loading until needed. - Don't write empty parts into lock file. - Extract code to read/write lock file to `MRuby::Lockfile`. - `MRuby::Lockfile.disable` disables the use of lock file. --- Rakefile | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 6d8382f74..298ef8020 100644 --- a/Rakefile +++ b/Rakefile @@ -8,10 +8,10 @@ MRUBY_BUILD_HOST_IS_OPENBSD = RUBY_PLATFORM.include?('openbsd') $LOAD_PATH << File.join(MRUBY_ROOT, "lib") # load build systems -require 'yaml' require "mruby-core-ext" require "mruby/build" require "mruby/gem" +require "mruby/lockfile" # load configuration file MRUBY_CONFIG = (ENV['MRUBY_CONFIG'] && ENV['MRUBY_CONFIG'] != '') ? ENV['MRUBY_CONFIG'] : "#{MRUBY_ROOT}/build_config.rb" @@ -125,25 +125,7 @@ task :all => depfiles do MRuby.each_target do print_build_summary end - - require 'mruby/source' - - locks_result = { - 'mruby_version' => { - 'version' => MRuby::Source::MRUBY_VERSION, - 'release_no' => MRuby::Source::MRUBY_RELEASE_NO - }, - 'builds' => {} - } - if File.exist? "#{MRUBY_ROOT}/.git" - locks_result['mruby_version']['git_commit'] = `git --git-dir '#{MRUBY_ROOT}/.git' --work-tree '#{MRUBY_ROOT}' rev-parse --verify HEAD`.strip - end - - MRuby.each_target do - locks_result['builds'][name] = locks - end - - File.write MRUBY_CONFIG_LOCK_FILE, YAML.dump(locks_result) + MRuby::Lockfile.write end desc "run all mruby tests" -- cgit v1.2.3