Method: Bake::Blocks::Makefile#calcPathTo

Defined in:
lib/blocks/makefile.rb

#calcPathTo(referencedConfigs) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/blocks/makefile.rb', line 74

def calcPathTo(referencedConfigs)
  @path_to = ""
  if @config.pathTo != ""
    pathHash = {}
    @config.pathTo.split(",").each do |p|
      nameOfP = p.strip
      dirOfP = nil
      if referencedConfigs.include?nameOfP
        dirOfP = referencedConfigs[nameOfP].first.get_project_dir
      else
        Bake.options.roots.each do |r|
          absIncDir = r.dir+"/"+nameOfP
          if File.exist?(absIncDir)
            dirOfP = absIncDir
            break
          end
        end
      end
      if dirOfP == nil
        Bake.formatter.printError("Project '#{nameOfP}' not found", @config)
        ExitHelper.exit(1)
      end
      pathHash[nameOfP] = File.rel_from_to_project(File.dirname(@projectDir),File.dirname(dirOfP))
    end
    path_to_array = []
    pathHash.each { |k,v| path_to_array << "PATH_TO_#{k}=#{v}" }
    @path_to = path_to_array.join(" ")
  end

end