module Bake

Constants

BUILD_ABORTED
BUILD_FAILED
BUILD_PASSED
BakeryLanguage
Language

Public Class Methods

cleanup() click to toggle source
# File lib/common/cleanup.rb, line 7
def self.cleanup()
  Blocks::ALL_BLOCKS.clear
  Blocks::ALL_COMPILE_BLOCKS.clear
  Blocks::CC2J.clear
  Bake::IDEInterface.instance.set_abort(false)
  Blocks::Block.reset_block_counter
  Blocks::Block.reset_delayed_result
  Configs::Checks.cleanupWarnings
  ToCxx::reset_include_deps
end
findDirOfFileToRoot(dir, filename) click to toggle source
# File lib/common/options/finder.rb, line 3
def self.findDirOfFileToRoot(dir, filename)
  if !File.exist?(dir)
    Bake.formatter.printError("Error: #{dir} does not exist")
    ExitHelper.exit(1)
  end
  loop do
    completeName = dir + "/" + filename
    return dir if File.exist?(completeName)
    newDir = File.dirname(dir)
    return nil if newDir == dir
    dir = newDir
  end
end
formatter() click to toggle source
# File lib/bake/toolchain/colorizing_formatter.rb, line 120
def self.formatter
  @@formatter ||= ColorizingFormatter.new
end
getBuildPattern(cols, name) click to toggle source
# File lib/bakery/toBake.rb, line 5
def self.getBuildPattern(cols, name)

  colMeta = @options.collection_dir+"/Collection.meta"

  if (cols.length == 0)
    Bake.formatter.printError("Collection #{name} not found", colMeta)
    ExitHelper.exit(1)
  elsif (cols.length > 1)
    Bake.formatter.printError("Collection #{name} found more than once", colMeta)
    ExitHelper.exit(1)
  end

  col = cols[0]

  col.project.each do |p|
    if p.name == ""
      Bake.formatter.printError("Project name empty", p)
      ExitHelper.exit(1)
    end
    if p.config == ""
      Bake.formatter.printError("Config name empty", p)
      ExitHelper.exit(1)
    end
  end

  toBuildPattern = []
  @options.roots.each do |root|
    col.project.each do |p|
      projs = Root.search_to_depth(root.dir,p.name + "/Project.meta", root.depth).map { |p| Pathname.new(p).cleanpath.to_s }
      if File.basename(root.dir) == p.name && File.exist?(root.dir + "/Project.meta")
        projs << root.dir + "/Project.meta"
      end
      if projs.length == 0
        Bake.formatter.printWarning("pattern does not match any project: #{p.name}", p)
      end
      projs.each do |f|
        toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p.args, p.args_end, p)
      end
    end
  end

  toBuild = []
  toBuildPattern.each do |bp|
    next unless bp.proj
    contents = File.open(bp.proj, "r") {|io| io.read }
    contents.split("\n").each do |c|
      res = c.gsub(/#.*/,"").match("\\s*(Library|Executable|Custom){1}Config\\s*\"?([\\w:-]*)\"?")
      if res
        if res[2].match(bp.conf) != nil
          toBuild << BuildPattern.new(bp.proj, res[2], bp.args, bp.args_end, nil)
          bp.coll_p.found
        end
      end
    end
  end

  toBuildPattern.select {|bp| !bp.coll_p.isFound}.map {|bp| bp.coll_p}.uniq.each do |p|
    Bake.formatter.printWarning("pattern does not match any config: #{p.config}", p)
  end

  col.exclude.each do |p|
    p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
    p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
  end

  col.exclude_dir.each do |e|
    e.name = File.expand_path(e.name, @options.collection_dir)
  end

  toBuild.delete_if do |bp|
    exclude = false
    col.exclude.each do |p|
      exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil)
    end
    col.exclude_dir.each do |e|
      exclude = true if bp.proj.start_with?(e.name)
    end
    exclude
  end

  toBuild.uniq!

  return toBuild
end
options() click to toggle source
# File lib/bake/options/options.rb, line 396
def self.options
  @@options ||= Options.new([])
end
options=(options) click to toggle source
# File lib/bake/options/options.rb, line 400
def self.options=(options)
  @@options = options
end