Commit 7b6150ab authored by Masaki Muranaka's avatar Masaki Muranaka

Add include_paths in dependency gems.

parent 2f804746
...@@ -34,6 +34,8 @@ module MRuby ...@@ -34,6 +34,8 @@ module MRuby
attr_accessor :requirements attr_accessor :requirements
attr_reader :dependencies attr_reader :dependencies
attr_accessor :export_include_paths
attr_block MRuby::Build::COMMANDS attr_block MRuby::Build::COMMANDS
def initialize(name, &block) def initialize(name, &block)
...@@ -71,6 +73,8 @@ module MRuby ...@@ -71,6 +73,8 @@ module MRuby
@requirements = [] @requirements = []
@dependencies = [] @dependencies = []
@export_include_paths = []
@export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include"
instance_eval(&@initializer) instance_eval(&@initializer)
...@@ -336,6 +340,25 @@ module MRuby ...@@ -336,6 +340,25 @@ module MRuby
rescue TSort::Cyclic => e rescue TSort::Cyclic => e
fail "Circular mrbgem dependency found: #{e.message}" fail "Circular mrbgem dependency found: #{e.message}"
end end
each do |g|
import_include_paths(g)
end
end
def import_include_paths(g)
gem_table = @ary.reduce({}) { |res,v| res[v.name] = v; res }
g.dependencies.each do |dep|
dep_g = gem_table[dep[:gem]]
# We can do recursive call safely
# as circular dependency has already detected in the caller.
import_include_paths(dep_g)
g.compilers.each do |compiler|
compiler.include_paths += dep_g.export_include_paths
g.export_include_paths += dep_g.export_include_paths
end
end
end end
end # List end # List
end # Gem end # Gem
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment