summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2013-06-15 03:53:50 +0800
committerDaniel Bovensiepen <[email protected]>2013-06-15 03:53:50 +0800
commit373122a299ebec890cfaa95ee41fde221ac6a543 (patch)
tree346e79bb8a30a4e0b4102babf7dd9407beb36979 /tasks
parentad07d41bd1b42fe7d23e04361839f511c5f9cd7f (diff)
parent961cd408a86580c4d428f56153da00fd46738e35 (diff)
downloadmruby-373122a299ebec890cfaa95ee41fde221ac6a543.tar.gz
mruby-373122a299ebec890cfaa95ee41fde221ac6a543.zip
Merge upstream
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mrbgem_spec.rake7
-rw-r--r--tasks/mrbgems.rake3
-rw-r--r--tasks/mrbgems_test.rake2
-rw-r--r--tasks/mruby_build.rake7
-rw-r--r--tasks/mruby_build_commands.rake18
-rw-r--r--tasks/mruby_build_gem.rake20
-rw-r--r--tasks/toolchains/androideabi.rake15
7 files changed, 50 insertions, 22 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake
index 3363b4885..df55e749f 100644
--- a/tasks/mrbgem_spec.rake
+++ b/tasks/mrbgem_spec.rake
@@ -275,13 +275,20 @@ module MRuby
req_versions = dep[:requirements]
# check each GEM dependency against all available GEMs
+ found_dep_gem = false
each do |dep_g|
if name == dep_g.name
unless dep_g.version_ok?(req_versions)
fail "#{name} version should be #{req_versions.join(' and ')} but was '#{dep_g.version}'"
end
+
+ found_dep_gem = true
+ break
end
end
+
+ fail "The GEM '#{g.name}' depends on the GEM '#{name}' but it could not be found" unless found_dep_gem
+
end
end
end
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index 5f156c45a..d8f56f88e 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -74,9 +74,10 @@ please check the following additional licenses too:
GEMS_LEGAL
gems.map do |g|
+ authors = [g.authors].flatten.sort.join(", ")
f.puts
f.puts "GEM: #{g.name}"
- f.puts "Copyright (c) #{Time.now.year} #{g.authors}"
+ f.puts "Copyright (c) #{Time.now.year} #{authors}"
f.puts "License: #{g.licenses}"
end
end
diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake
index 717f0d76b..1050b84bb 100644
--- a/tasks/mrbgems_test.rake
+++ b/tasks/mrbgems_test.rake
@@ -38,7 +38,7 @@ MRuby.each_target do
f.puts %Q[ }]
f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern(mrb2, "GEMNAME"), mrb_str_new(mrb2, "#{g.name}", #{g.name.length}));]
- if not g.test_args.empty?
+ unless g.test_args.empty?
f.puts %Q[ test_args_hash = mrb_hash_new_capa(mrb, #{g.test_args.length}); ]
g.test_args.each do |arg_name, arg_value|
escaped_arg_name = arg_name.gsub('\\', '\\\\\\\\').gsub('"', '\"')
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index eeebd161b..ef7f06a81 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -43,7 +43,7 @@ module MRuby
end
include Rake::DSL
include LoadGems
- attr_accessor :name, :bins, :exts, :file_separator
+ attr_accessor :name, :bins, :exts, :file_separator, :build_dir
attr_reader :libmruby, :gems
COMPILERS = %w(cc cxx objc asm)
@@ -63,6 +63,7 @@ module MRuby
end
@file_separator = '/'
+ @build_dir = "#{MRUBY_ROOT}/build/#{@name}"
@cc = Command::Compiler.new(self, %w(.c))
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
@objc = Command::Compiler.new(self, %w(.m))
@@ -95,10 +96,6 @@ module MRuby
MRUBY_ROOT
end
- def build_dir
- "#{MRUBY_ROOT}/build/#{self.name}"
- end
-
def mrbcfile
MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc")
end
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 1d69fa54d..349b8717d 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -220,19 +220,28 @@ module MRuby
class Command::Git < Command
attr_accessor :flags
- attr_accessor :clone_options
+ attr_accessor :clone_options, :pull_options
def initialize(build)
super
@command = 'git'
@flags = []
@clone_options = "clone %{flags} %{url} %{dir}"
+ @pull_options = "pull"
end
def run_clone(dir, url, _flags = [])
_pp "GIT", url, dir.relative_path
_run clone_options, { :flags => [flags, _flags].flatten.join(' '), :url => url, :dir => filename(dir) }
end
+
+ def run_pull(dir, url)
+ root = Dir.pwd
+ Dir.chdir dir
+ _pp "GIT PULL", url, dir.relative_path
+ _run pull_options
+ Dir.chdir root
+ end
end
class Command::Mrbc < Command
@@ -250,9 +259,14 @@ module MRuby
infiles.each do |f|
_pp "MRBC", f.relative_path, nil, :indent => 2
end
- IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}} #{infiles.join(' ')}", 'r+') do |io|
+ IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}", 'r+') do |io|
out.puts io.read
end
+ # if mrbc execution fail, drop the file
+ unless $?.exitstatus
+ File.delete(out.path)
+ exit -1
+ end
end
end
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index 870ccfa57..24aea71ab 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -39,14 +39,20 @@ module MRuby
gemdir = "#{root}/mrbgems/#{params[:core]}"
elsif params[:git]
url = params[:git]
- gemdir = "build/mrbgems/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
- return gemdir if File.exists?(gemdir)
+ gemdir = "#{build_dir}/mrbgems/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
- options = [params[:options]] || []
- options << "--branch \"#{params[:branch]}\"" if params[:branch]
-
- FileUtils.mkdir_p "build/mrbgems"
- git.run_clone gemdir, url, options
+ if File.exists?(gemdir)
+ if $pull_gems
+ git.run_pull gemdir, url
+ else
+ gemdir
+ end
+ else
+ options = [params[:options]] || []
+ options << "--branch \"#{params[:branch]}\"" if params[:branch]
+ FileUtils.mkdir_p "#{build_dir}/mrbgems"
+ git.run_clone gemdir, url, options
+ end
else
fail "unknown gem option #{params}"
end
diff --git a/tasks/toolchains/androideabi.rake b/tasks/toolchains/androideabi.rake
index a69fd1a9d..a20027c0d 100644
--- a/tasks/toolchains/androideabi.rake
+++ b/tasks/toolchains/androideabi.rake
@@ -41,20 +41,23 @@ MRuby::Toolchain.new(:androideabi) do |conf|
end
if ANDROID_STANDALONE_TOOLCHAIN == nil then
- if RUBY_PLATFORM.include?('darwin') then
+ case RUBY_PLATFORM
+ when /cygwin|mswin|mingw|bccwin|wince|emx/i
+ HOST_PLATFORM = 'windows'
+ when /darwin/i
HOST_PLATFORM = 'darwin-x86'
- elsif RUBY_PLATFORM.include?('linux') then
+ when /x86_64-linux/i
+ HOST_PLATFORM = 'linux-x86_64'
+ when /linux/i
HOST_PLATFORM = 'linux-x86'
- elsif RUBY_PLATFORM.include?('win') then
- HOST_PLATFORM = 'windows'
else
- # Unknown host platform.
+ # Unknown host platform
end
ANDROID_TARGET_PLATFORM = ENV['ANDROID_TARGET_PLATFORM'] || DEFAULT_ANDROID_TARGET_PLATFORM
path_to_toolchain = ANDROID_NDK_HOME + '/toolchains/'
- path_to_sysroot = ANDROID_NDK_HOME + '/platforms/' + ANDROID_TARGET_PLATFORM
+ path_to_sysroot = ANDROID_NDK_HOME + '/platforms/' + ANDROID_TARGET_PLATFORM
if ANDROID_TOOLCHAIN.downcase == 'gcc' then
case ANDROID_TARGET_ARCH.downcase
when 'arch-arm', 'arm' then