Module: Bake

Defined in:
lib/tocxx.rb,
lib/bake/cache.rb,
lib/bake/subst.rb,
lib/vs/options.rb,
lib/blocks/docu.rb,
lib/blocks/lint.rb,
lib/blocks/block.rb,
lib/common/utils.rb,
lib/bakery/toBake.rb,
lib/blocks/compile.rb,
lib/blocks/convert.rb,
lib/blocks/library.rb,
lib/common/cleanup.rb,
lib/common/process.rb,
lib/common/version.rb,
lib/bake/libElement.rb,
lib/blocks/makefile.rb,
lib/multithread/job.rb,
lib/bake/mergeConfig.rb,
lib/blocks/blockBase.rb,
lib/bake/model/loader.rb,
lib/bake/toolchain/ti.rb,
lib/blocks/executable.rb,
lib/bake/config/loader.rb,
lib/bake/options/usage.rb,
lib/bake/toolchain/gcc.rb,
lib/blocks/commandLine.rb,
lib/common/exit_helper.rb,
lib/bake/model/language.rb,
lib/bake/options/create.rb,
lib/bake/toolchain/diab.rb,
lib/bake/toolchain/keil.rb,
lib/bake/toolchain/lint.rb,
lib/bake/toolchain/msvc.rb,
lib/bakery/buildPattern.rb,
lib/bakery/model/loader.rb,
lib/blocks/showIncludes.rb,
lib/bake/model/metamodel.rb,
lib/bake/options/options.rb,
lib/bake/options/showDoc.rb,
lib/bake/toolchain/clang.rb,
lib/common/ide_interface.rb,
lib/bakery/model/language.rb,
lib/common/abortException.rb,
lib/common/options/option.rb,
lib/common/options/parser.rb,
lib/bake/toolchain/gcc_env.rb,
lib/bakery/model/metamodel.rb,
lib/bakery/options/options.rb,
lib/bake/toolchain/provider.rb,
lib/bake/model/metamodel_ext.rb,
lib/bake/options/showLicense.rb,
lib/bake/toolchain/greenhills.rb,
lib/blocks/has_execute_command.rb,
lib/bake/options/showToolchains.rb,
lib/bake/options/showConfigNames.rb,
lib/bake/toolchain/clang_analyze.rb,
lib/bake/toolchain/colorizing_formatter.rb,
lib/bake/toolchain/errorparser/error_parser.rb,
lib/bake/toolchain/errorparser/process_output.rb,
lib/bake/toolchain/errorparser/lint_error_parser.rb,
lib/bake/toolchain/errorparser/ti_linker_error_parser.rb,
lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb,
lib/bake/toolchain/errorparser/diab_linker_error_parser.rb,
lib/bake/toolchain/errorparser/keil_linker_error_parser.rb,
lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb,
lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb,
lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb,
lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb,
lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb,
lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb,
lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb,
lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb

Defined Under Namespace

Modules: BakeryModel, Blocks, Metamodel, Multithread, Toolchain, Utils Classes: AbortException, BakeryLoader, BakeryOptions, BuildPattern, Cache, CacheAccess, ColorizingFormatter, Config, ConfigNames, Create, DiabCompilerErrorParser, DiabLinkerErrorParser, Doc, ErrorDesc, ErrorParser, ExitHelper, GCCCompilerErrorParser, GCCLinkerErrorParser, GreenHillsCompilerErrorParser, GreenHillsLinkerErrorParser, IDEInterface, Idp, KeilCompilerErrorParser, KeilLinkerErrorParser, LibElement, LibElements, License, LintErrorParser, Loader, MSVCCompilerErrorParser, MSVCLinkerErrorParser, MergeConfig, Option, Options, Parser, ProcessHelper, Subst, SystemCommandFailed, TICompilerErrorParser, TILinkerErrorParser, ToCxx, ToolchainInfo, Usage, Version, VsOptions

Constant Summary collapse

BUILD_PASSED =
0
BUILD_FAILED =
1
BUILD_ABORTED =
2
Language =
RText::Language.new(Metamodel.ecore,
  :feature_provider => proc {|c|
    RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
      f.eAnnotations.any? {|a|
        a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
      }
    }
  },
  :unlabled_arguments => proc {|c|
    if c.name == "Compiler" or c.name == "CompilerAdaptions" 
      ["ctype"]
    elsif c.name == "Define"
      ["str"]
    elsif c.name == "Flags" or c.name == "LibPostfixFlags" or c.name == "LibPrefixFlags"
      ["overwrite"]
    elsif c.name == "UserLibrary"
      ["lib"]
    elsif c.name == "DefaultToolchain"
      ["basedOn"]
    elsif c.name == "Description"
      ["text"]
    else
      ["name"]
    end
  },
  :identifier_provider => Idp.new,
  :line_number_attribute => "line_number",
  :fragment_ref_attribute => "fragment_ref"
)
BakeryLanguage =
RText::Language.new(BakeryModel.ecore,
  :feature_provider => proc {|c|
    RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
      f.eAnnotations.any? {|a|
        a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
      }
    }
  },
  :unlabled_arguments => proc {|c|
    ["name"]
  },
  :line_number_attribute => "line_number",
  :file_name_attribute => "file_name"
)

Class Method Summary collapse

Class Method Details

.cleanupObject



3
4
5
6
7
8
# File 'lib/common/cleanup.rb', line 3

def self.cleanup()
  Blocks::ALL_BLOCKS.clear
  Blocks::ALL_COMPILE_BLOCKS.clear
  Blocks::CC2J.clear
  Bake::IDEInterface.instance.set_abort(false)
end

.formatterObject



120
121
122
# File 'lib/bake/toolchain/colorizing_formatter.rb', line 120

def self.formatter
  @@formatter ||= ColorizingFormatter.new
end

.getBuildPattern(cols, name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# 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 |r|
    col.project.each do |p|
      projs = Dir.glob(r+"/"+p.name+"/Project.meta")
      if projs.length == 0
        toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout

      end
      projs.each do |f|
        toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", 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.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], nil)
          bp.coll_p.found
        end
      end
    end
  end

  toBuildPattern.each do |bp|
    if not bp.coll_p.isFound
      Bake.formatter.printInfo("No match for project #{bp.coll_p.name} with config #{bp.coll_p.config}", @options.collection_dir+"/Collection.meta", bp.coll_p.line_number) 
    end
  end

  col.exclude.each do |p|
    p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
    p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
  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
    exclude
  end

  toBuild.uniq!

  return toBuild
end

.optionsObject



13
14
15
# File 'lib/bake/options/options.rb', line 13

def self.options
  @@options
end

.options=(options) ⇒ Object



16
17
18
# File 'lib/bake/options/options.rb', line 16

def self.options=(options)
  @@options = options
end