bake-toolkit 2.2.2 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/doc/dyk/clang.html +50 -0
  3. data/doc/further/change.html +13 -0
  4. data/doc/index.html +3 -1
  5. data/doc/vs/debug.html +50 -0
  6. data/doc/vs/echse/echse.png +0 -0
  7. data/lib/bake/config/loader.rb +3 -0
  8. data/lib/bake/options/options.rb +2 -1
  9. data/lib/bake/toolchain/clang.rb +3 -3
  10. data/lib/bake/toolchain/clang_analyze.rb +31 -0
  11. data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +1 -1
  12. data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +2 -2
  13. data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +1 -1
  14. data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +2 -2
  15. data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +1 -1
  16. data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +2 -2
  17. data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +1 -1
  18. data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +2 -2
  19. data/lib/bake/toolchain/errorparser/lint_error_parser.rb +1 -1
  20. data/lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb +63 -0
  21. data/lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb +42 -0
  22. data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +1 -1
  23. data/lib/bake/toolchain/msvc.rb +57 -0
  24. data/lib/bake/toolchain/provider.rb +13 -3
  25. data/lib/blocks/blockBase.rb +11 -8
  26. data/lib/blocks/compile.rb +30 -17
  27. data/lib/blocks/executable.rb +8 -1
  28. data/lib/blocks/library.rb +7 -1
  29. data/lib/common/process.rb +0 -1
  30. data/lib/common/version.rb +1 -1
  31. data/lib/tocxx.rb +5 -3
  32. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3204adfeb6e87ba1ad87e217e3a873c81e9b21db
4
- data.tar.gz: 69d5e65f7a40485d903eb5440ea7890842bef298
3
+ metadata.gz: 0b64fc98f1d57e95813caf1aa0b720befa42b89a
4
+ data.tar.gz: 019eaba3c441e8c9e4a3fce2ba48f30fab2e8c94
5
5
  SHA512:
6
- metadata.gz: 4dcccbf9cd13df565e27c6044cf10558945b79b6631e93d9ae37471a114daab40e3349d0d31ba478d1bf6017d394e15c9b7dd5038a14fca5ed9aedf22e63cfb3
7
- data.tar.gz: c9b1a7423f45820a1ffc68be7b12cd16038a4faedae204f57127252de1af0c8754c16f93ef52649d439117eac0251ec32413ed19cc273bb563ca60365d534166
6
+ metadata.gz: d879d2b96339f55d99275a8bdba981c77cf647b6fa9146990e47a4dfcddc897c8ec1a2c5902e20e2ce25e9cc92b47bcd7f9fdeeed8a420d6d2d2d5725a6918a6
7
+ data.tar.gz: 098620c65ab6537b77fa7b8580a9b65a1aa7d6eea893c7fe3aeac7c65e7089ff86a48a0a91e4f41e2437d1edd8c95b6e755a51dbf19267d9aa456591048772a1
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html>
3
+ <head>
4
+ <title>Documentation of the bake-tookit</title>
5
+ <style type="text/css">
6
+ #rundrum {
7
+ border-width:1px;
8
+ border-style:dashed;
9
+ border-color:blue;
10
+ padding:0.2cm;
11
+ text-align:justify; }
12
+ }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>Clang Analyze</h1>
17
+
18
+ bake can be easily used to analyze source files with Clang. It works simliar to regular compiling, but instead of
19
+ invoking the compiler, the Clang Analyzer will be called.
20
+
21
+ Imagine you have a workspace with the following "main" project:
22
+ <pre id="rundrum"><code>Project {
23
+ ...
24
+ ExecutableConfig Debug {
25
+ ...
26
+ DefaultToolchain GCC
27
+ }
28
+ }</code></pre>
29
+ Either edit this Project.meta or create a new "analyze" project:
30
+ <pre id="rundrum"><code>Project {
31
+ CustomConfig Analyze {
32
+ Dependency main, config: Debug
33
+ DefaultToolchain CLANG_ANALYZE {
34
+ Compiler CPP {
35
+ Flags "-analyzer-checker=deadcode,security,alpha,unix,cplusplus"
36
+ }
37
+ Compiler C {
38
+ Flags "-analyzer-checker=deadcode,security,alpha,unix"
39
+ }
40
+ }
41
+ }
42
+ }</code></pre>
43
+
44
+ As you can see the DefaultToolchain GCC is replaced with CLANG_ANALYZE. Call bake like this:
45
+ <pre id="rundrum"><code>bake Analyze -f .</code></pre>
46
+
47
+ "-f" means that only the compilation step will take place. The "." means files with a "." in the name will be compiled (= all files). If you want to analyze only C++ files, you can write "-f .cpp"
48
+ </body>
49
+
50
+ </html>
@@ -7,6 +7,19 @@
7
7
  <body>
8
8
  <h1>Changelog</h1>
9
9
 
10
+ March 12, 2015 - bake-toolkit 2.3.4<br>
11
+ <ul>
12
+ <li><b>Changed: Clang command is now "clang" per default instead of llvm-gcc</b>
13
+ <li><b>Added: CLANG_ANALYZE toolchain</b>
14
+ <li><b>Added: MSVC toolchain</b>
15
+ <li><b>Bugfix: some minor fixes</b>
16
+ </ul>
17
+
18
+ February 27, 2015 - Eclipse plugin 1.3.0<br>
19
+ <ul>
20
+ <li><b>Added: bake projects with equal names can be imported now</b>
21
+ </ul>
22
+
10
23
  February 19, 2015 - bake-toolkit 2.2.2<br>
11
24
  <ul>
12
25
  <li><b>Changed: output dirs are now prefixed with "build_" per default</b>
@@ -45,6 +45,7 @@ bake is used to build software <font color="#009900"><b>fast</b></font> and <fon
45
45
  <li><a href="vs/install.html">How to install bake Visual Studio integration</a>
46
46
  <li><a href="vs/use.html">How to use bake in Visual Studio</a>
47
47
  <li><a href="vs/create.html">How to create a solution / projects in Visual Studio</a>
48
+ <li><a href="vs/debug.html">How to debug in Visual Studio</a>
48
49
  </ul>
49
50
 
50
51
  <h3>Syntax</h3>
@@ -57,6 +58,7 @@ bake is used to build software <font color="#009900"><b>fast</b></font> and <fon
57
58
  <h3>Did you know?</h3>
58
59
  <ul>
59
60
  <li><a href="dyk/lint.html">Lint</a>
61
+ <li><a href="dyk/clang.html">Clang Analyze</a>
60
62
  <li><a href="dyk/tipps.html">Tipps and Tricks</a>
61
63
  </ul>
62
64
 
@@ -72,7 +74,7 @@ bake is used to build software <font color="#009900"><b>fast</b></font> and <fon
72
74
 
73
75
  <p>
74
76
  <hr>
75
- <table width="100%" border="0"><tr><td align="left">Described bake-toolkit version: 2.2.2</td><td align="right">February 19, 2015</td></tr></table>
77
+ <table width="100%" border="0"><tr><td align="left">Described bake-toolkit version: 2.3.4</td><td align="right">March 12, 2015</td></tr></table>
76
78
 
77
79
  </body>
78
80
 
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html>
3
+ <head>
4
+ <title>Documentation of the bake-tookit</title>
5
+ <style type="text/css">
6
+ #rundrum {
7
+ border-width:1px;
8
+ border-style:dashed;
9
+ border-color:blue;
10
+ padding:0.2cm;
11
+ text-align:justify; }
12
+ }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>How to debug in Visual Studio</h1>
17
+
18
+ Natively you can only debug the output from the Microsoft VC compiler with Visual Studio. There are some plugins available for e.g.
19
+ debugging gcc output. Another option is to use the MSVC toolchain from bake, which is described on this help page.
20
+ <p>
21
+ Add debug flags to the MSVC toolchain:
22
+
23
+ <pre id="rundrum"><code>DefaultToolchain MSVC {
24
+ Compiler CPP {
25
+ Flags "-Zi"
26
+ }
27
+ Linker {
28
+ Flags "-Debug"
29
+ }
30
+ }</code></pre>
31
+
32
+ Start Visual Studio with e.g. a batch file shown below and choose the appropriate solution. If you don't have a solution yet, check out <a href="vs/create.html">How to create a solution / projects in Visual Studio</a>.
33
+
34
+ <pre id="rundrum"><code>set PATH=%PATH%;C:\tools\Microsoft Visual Studio 11.0\VC\bin
35
+ call "C:\tools\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
36
+ "C:\tools\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe"</code></pre>
37
+
38
+ <p>
39
+ This adds the compiler, linker, etc. to the path. <i>vcvarsall.bat</i> setups the environment and the last line
40
+ starts Visual Studio. As a test, just execute the first two lines and check if "cl.exe" can be executed without any errors.
41
+
42
+ In Visual Studio, you have to define the executable you like to debug. Add the executable in the project properties:
43
+ <p>
44
+ <img src="echse/echse.png"/>
45
+ <p>
46
+ You can also define command line arguments here.<p>
47
+ Start debugging as usual...
48
+ </body>
49
+
50
+ </html>
Binary file
@@ -294,6 +294,9 @@ module Bake
294
294
  @defaultToolchain = cache.defaultToolchain
295
295
  @@defaultToolchainTime = cache.defaultToolchainTime
296
296
  end
297
+
298
+ # todo: cleanup this hack
299
+ Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
297
300
 
298
301
  end
299
302
 
@@ -17,7 +17,7 @@ module Bake
17
17
  end
18
18
 
19
19
  class Options < Parser
20
- attr_accessor :build_config, :nocache
20
+ attr_accessor :build_config, :nocache, :analyze
21
21
  attr_reader :main_dir, :project, :filename, :main_project_name, :cc2j_filename # String
22
22
  attr_reader :roots, :include_filter, :exclude_filter # String List
23
23
  attr_reader :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :linkOnly, :no_autodir, :clobber, :lint, :docu, :debug, :prepro # Boolean
@@ -30,6 +30,7 @@ module Bake
30
30
  def initialize(argv)
31
31
  super(argv)
32
32
 
33
+ @analyze = false
33
34
  @showConfigs = false
34
35
  @consoleOutput_fullnames = false
35
36
  @consoleOutput_visualStudio = false
@@ -11,7 +11,7 @@ module Bake
11
11
  CLANG_CHAIN = Provider.add("CLANG")
12
12
 
13
13
  CLANG_CHAIN[:COMPILER][:CPP].update({
14
- :COMMAND => "llvm-g++",
14
+ :COMMAND => "clang++",
15
15
  :DEFINE_FLAG => "-D",
16
16
  :OBJECT_FILE_FLAG => "-o",
17
17
  :OBJ_FLAG_SPACE => true,
@@ -23,7 +23,7 @@ module Bake
23
23
 
24
24
  CLANG_CHAIN[:COMPILER][:C] = Utils.deep_copy(CLANG_CHAIN[:COMPILER][:CPP])
25
25
  CLANG_CHAIN[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
26
- CLANG_CHAIN[:COMPILER][:C][:COMMAND] = "llvm-gcc"
26
+ CLANG_CHAIN[:COMPILER][:C][:COMMAND] = "clang"
27
27
 
28
28
  CLANG_CHAIN[:COMPILER][:ASM] = Utils.deep_copy(CLANG_CHAIN[:COMPILER][:C])
29
29
  CLANG_CHAIN[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
@@ -32,7 +32,7 @@ module Bake
32
32
  CLANG_CHAIN[:ARCHIVER][:ARCHIVE_FLAGS] = "r"
33
33
  CLANG_CHAIN[:ARCHIVER][:ERROR_PARSER] = gccCompilerErrorParser
34
34
 
35
- CLANG_CHAIN[:LINKER][:COMMAND] = "llvm-g++"
35
+ CLANG_CHAIN[:LINKER][:COMMAND] = "clang++"
36
36
  CLANG_CHAIN[:LINKER][:SCRIPT] = "-T"
37
37
  CLANG_CHAIN[:LINKER][:USER_LIB_FLAG] = "-l:"
38
38
  CLANG_CHAIN[:LINKER][:EXE_FLAG] = "-o"
@@ -0,0 +1,31 @@
1
+ require 'common/utils'
2
+ require 'bake/toolchain/provider'
3
+
4
+ module Bake
5
+ module Toolchain
6
+ CLANG_ANALYZE_CHAIN = Provider.add("CLANG_ANALYZE")
7
+
8
+ CLANG_ANALYZE_CHAIN[:COMPILER][:CPP].update({
9
+ :COMMAND => "clang++",
10
+ :DEFINE_FLAG => "-D",
11
+ :OBJECT_FILE_FLAG => "-o",
12
+ :OBJ_FLAG_SPACE => true,
13
+ :OBJECT_FILE_ENDING => ".plist",
14
+ :INCLUDE_PATH_FLAG => "-I",
15
+ :COMPILE_FLAGS => "-cc1 -analyze -analyzer-output=plist ",
16
+ :DEP_FLAGS => "",
17
+ :DEP_FLAGS_FILENAME => false,
18
+ :ERROR_PARSER => nil
19
+ })
20
+
21
+ CLANG_ANALYZE_CHAIN[:COMPILER][:C] = Utils.deep_copy(CLANG_ANALYZE_CHAIN[:COMPILER][:CPP])
22
+ CLANG_ANALYZE_CHAIN[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
23
+ CLANG_ANALYZE_CHAIN[:COMPILER][:C][:COMMAND] = "clang"
24
+
25
+ CLANG_ANALYZE_CHAIN[:COMPILER][:ASM] = Utils.deep_copy(CLANG_ANALYZE_CHAIN[:COMPILER][:C])
26
+ CLANG_ANALYZE_CHAIN[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
27
+
28
+ CLANG_ANALYZE_CHAIN[:ARCHIVER][:COMMAND] = ""
29
+ CLANG_ANALYZE_CHAIN[:LINKER][:COMMAND] = ""
30
+ end
31
+ end
@@ -12,7 +12,7 @@ module Bake
12
12
  res = []
13
13
  error_severity = 255
14
14
  consoleOutputFullnames = ""
15
- consoleOutput.each_line do |l|
15
+ consoleOutput[0].each_line do |l|
16
16
  d = ErrorDesc.new
17
17
  lstripped = l.rstrip
18
18
  scan_res = lstripped.scan(@error_expression_start)
@@ -11,7 +11,7 @@ module Bake
11
11
  def scan_lines(consoleOutput, proj_dir)
12
12
  res = []
13
13
  error_severity = 255
14
- consoleOutput.each_line do |l|
14
+ consoleOutput[0].each_line do |l|
15
15
  l.rstrip!
16
16
  d = ErrorDesc.new
17
17
  scan_res = l.scan(@error_expression)
@@ -34,7 +34,7 @@ module Bake
34
34
  end
35
35
  res << d
36
36
  end
37
- [res, consoleOutput]
37
+ [res, consoleOutput[0]]
38
38
  end
39
39
 
40
40
  end
@@ -10,7 +10,7 @@ module Bake
10
10
  def scan_lines(consoleOutput, proj_dir)
11
11
  res = []
12
12
  consoleOutputFullnames = ""
13
- consoleOutput.each_line do |l|
13
+ consoleOutput[0].each_line do |l|
14
14
  d = ErrorDesc.new
15
15
  scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
16
16
  if scan_res.length > 0
@@ -12,7 +12,7 @@ module Bake
12
12
 
13
13
  def scan_lines(consoleOutput, proj_dir)
14
14
  res = []
15
- consoleOutput.each_line do |l|
15
+ consoleOutput[0].each_line do |l|
16
16
  l.rstrip!
17
17
  d = ErrorDesc.new
18
18
  d.file_name = proj_dir
@@ -27,7 +27,7 @@ module Bake
27
27
  end
28
28
  res << d
29
29
  end
30
- [res, consoleOutput]
30
+ [res, consoleOutput[0]]
31
31
  end
32
32
 
33
33
 
@@ -12,7 +12,7 @@ module Bake
12
12
  def scan_lines(consoleOutput, proj_dir)
13
13
  res = []
14
14
  consoleOutputFullnames = ""
15
- consoleOutput.each_line do |l|
15
+ consoleOutput[0].each_line do |l|
16
16
  d = ErrorDesc.new
17
17
  scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
18
18
  if scan_res.length > 0
@@ -21,7 +21,7 @@ module Bake
21
21
  def scan_lines(consoleOutput, proj_dir)
22
22
  res = []
23
23
  error_severity = 255
24
- consoleOutput.each_line do |l|
24
+ consoleOutput[0].each_line do |l|
25
25
  l.rstrip!
26
26
  d = ErrorDesc.new
27
27
  scan_res = l.scan(@error_expression)
@@ -37,7 +37,7 @@ module Bake
37
37
  end
38
38
  res << d
39
39
  end
40
- [res, consoleOutput]
40
+ [res, consoleOutput[0]]
41
41
  end
42
42
 
43
43
  end
@@ -12,7 +12,7 @@ module Bake
12
12
  res = []
13
13
  error_severity = 255
14
14
  consoleOutputFullnames = ""
15
- consoleOutput.each_line do |l|
15
+ consoleOutput[0].each_line do |l|
16
16
  d = ErrorDesc.new
17
17
  lstripped = l.rstrip
18
18
  scan_res = lstripped.scan(@error_expression_start)
@@ -9,7 +9,7 @@ module Bake
9
9
 
10
10
  def scan_lines(consoleOutput, proj_dir)
11
11
  res = []
12
- consoleOutput.each_line do |l|
12
+ consoleOutput[0].each_line do |l|
13
13
  l.rstrip!
14
14
  d = ErrorDesc.new
15
15
  scan_res = l.scan(@error_expression)
@@ -22,7 +22,7 @@ module Bake
22
22
  end
23
23
  res << d
24
24
  end
25
- [res, consoleOutput]
25
+ [res, consoleOutput[0]]
26
26
  end
27
27
 
28
28
 
@@ -10,7 +10,7 @@ module Bake
10
10
  def scan_lines(consoleOutput, proj_dir)
11
11
  res = []
12
12
  consoleOutputFullnames = ""
13
- consoleOutput.each_line do |l|
13
+ consoleOutput[0].each_line do |l|
14
14
  d = ErrorDesc.new
15
15
  scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
16
16
  if scan_res.length > 0
@@ -0,0 +1,63 @@
1
+ require 'bake/toolchain/errorparser/error_parser'
2
+
3
+ module Bake
4
+ class MSVCCompilerErrorParser < ErrorParser
5
+
6
+ def initialize()
7
+ @error_expression = /(.+)\(([0-9]+)\) : ([A-Za-z\._]+) (.+)/
8
+ @incEng = "Note: including file: "
9
+ @incGer = "Hinweis: Einlesen der Datei: "
10
+ end
11
+
12
+ def scan_lines(consoleOutput, proj_dir)
13
+ includeList = []
14
+ res = []
15
+ consoleOutputFiltered = ""
16
+ consoleOutputFullnames = ""
17
+ filterLine = 0
18
+ consoleOutput[0].each_line do |l|
19
+ filterLine = filterLine + 1
20
+ next if (filterLine == 1 and l.include?"Assembling: ")
21
+ if (filterLine <= 2 and l.include?"Microsoft (R)")
22
+ filterLine = 1
23
+ next
24
+ end
25
+ next if (filterLine == 2 and l.include?"Copyright (C)")
26
+ next if (filterLine == 3 and l.strip.empty?)
27
+ next if (filterLine == 4 and not l.include?" : " and l.include?".") # the source file
28
+ filterLine = 100
29
+
30
+ if l.include?@incEng
31
+ includeList << l[@incEng.length..-1]
32
+ next
33
+ end
34
+ if l.include?@incGer
35
+ includeList << l[@incGer.length..-1].strip
36
+ next
37
+ end
38
+
39
+ d = ErrorDesc.new
40
+ scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
41
+ lFull = l
42
+ if scan_res.length > 0
43
+ d.file_name = File.expand_path(scan_res[0][0])
44
+ d.line_number = scan_res[0][1].to_i
45
+ d.message = scan_res[0][3]
46
+ if (scan_res[0][2].include?".")
47
+ d.severity = SEVERITY_ERROR
48
+ d.message = scan_res[0][2] + ": " + d.message
49
+ else
50
+ d.severity = get_severity(scan_res[0][2])
51
+ end
52
+ lFull = l.gsub(scan_res[0][0],d.file_name)
53
+ end
54
+ res << d
55
+ consoleOutputFiltered << l
56
+ consoleOutputFullnames << lFull
57
+ end
58
+ consoleOutput[0] = consoleOutputFiltered
59
+ [res, consoleOutputFullnames, includeList.uniq]
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,42 @@
1
+ require 'bake/toolchain/errorparser/error_parser'
2
+
3
+ module Bake
4
+ class MSVCLinkerErrorParser < ErrorParser
5
+
6
+ def initialize()
7
+ # todo: is every line an error?
8
+ end
9
+
10
+ def scan_lines(consoleOutput, proj_dir)
11
+ res = []
12
+ consoleOutputFiltered = ""
13
+ filterLine = 0
14
+
15
+ consoleOutput[0].each_line do |l|
16
+ filterLine = filterLine + 1
17
+ next if (filterLine == 1 and l.include?"Microsoft (R)")
18
+ next if (filterLine == 2 and l.include?"Copyright (C)")
19
+ next if (filterLine == 3 and l.strip.empty?)
20
+
21
+ l.rstrip!
22
+ d = ErrorDesc.new
23
+ d.file_name = proj_dir
24
+ d.line_number = 0
25
+ d.message = l
26
+ if l.length == 0
27
+ d.severity = SEVERITY_OK
28
+ elsif l.include?" Warning:"
29
+ d.severity = SEVERITY_WARNING
30
+ else
31
+ d.severity = SEVERITY_ERROR
32
+ end
33
+ consoleOutputFiltered << l
34
+ res << d
35
+ end
36
+ consoleOutput[0] = consoleOutputFiltered
37
+ [res, consoleOutput[0]]
38
+ end
39
+
40
+
41
+ end
42
+ end
@@ -10,7 +10,7 @@ module Bake
10
10
  def scan_lines(consoleOutput, proj_dir)
11
11
  res = []
12
12
  consoleOutputFullnames = ""
13
- consoleOutput.each_line do |l|
13
+ consoleOutput[0].each_line do |l|
14
14
  d = ErrorDesc.new
15
15
  scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
16
16
  if scan_res.length > 0
@@ -0,0 +1,57 @@
1
+ require 'common/utils'
2
+ require 'bake/toolchain/provider'
3
+ require 'bake/toolchain/errorparser/error_parser'
4
+ require 'bake/toolchain/errorparser/msvc_compiler_error_parser'
5
+ require 'bake/toolchain/errorparser/msvc_linker_error_parser'
6
+
7
+ module Bake
8
+ module Toolchain
9
+
10
+ MSVCChain = Provider.add("MSVC")
11
+
12
+ MSVCChain[:COMPILER][:CPP].update({
13
+ :COMMAND => "cl",
14
+ :DEFINE_FLAG => "-D",
15
+ :OBJECT_FILE_FLAG => "-Fo",
16
+ :OBJ_FLAG_SPACE => false,
17
+ :INCLUDE_PATH_FLAG => "-I",
18
+ :COMPILE_FLAGS => "-c -EHsc",
19
+ :DEP_FLAGS_FILENAME => false,
20
+ :DEP_FLAGS => "-showIncludes",
21
+ :DEP_FLAGS_SPACE => true,
22
+ :PREPRO_FLAGS => "-P",
23
+ :PREPRO_FILE_FLAG => "-Fi"
24
+ })
25
+
26
+ MSVCChain[:COMPILER][:C] = Utils.deep_copy(MSVCChain[:COMPILER][:CPP])
27
+ MSVCChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
28
+
29
+ MSVCChain[:COMPILER][:ASM] = Utils.deep_copy(MSVCChain[:COMPILER][:C])
30
+ MSVCChain[:COMPILER][:ASM][:COMMAND] = "ml"
31
+ MSVCChain[:COMPILER][:ASM][:COMPILE_FLAGS] = "-c"
32
+ MSVCChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
33
+
34
+ MSVCChain[:ARCHIVER][:COMMAND] = "lib"
35
+ MSVCChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-out:"
36
+ MSVCChain[:ARCHIVER][:ARCHIVE_FLAGS_SPACE] = false
37
+
38
+ MSVCChain[:LINKER][:COMMAND] = "link"
39
+ MSVCChain[:LINKER][:USER_LIB_FLAG] = ""
40
+ MSVCChain[:LINKER][:EXE_FLAG] = "-out:"
41
+ MSVCChain[:LINKER][:EXE_FLAG_SPACE] = false
42
+ MSVCChain[:LINKER][:LIB_FLAG] = ""
43
+ MSVCChain[:LINKER][:LIB_PATH_FLAG] = "-libpath:"
44
+ MSVCChain[:LINKER][:MAP_FILE_FLAG] = "-map:"
45
+ MSVCChain[:LINKER][:MAP_FILE_PIPE] = false
46
+ MSVCChain[:LINKER][:SCRIPT] = "Linkerscript option not supported for MSVC"
47
+
48
+ msvcCompilerErrorParser = MSVCCompilerErrorParser.new
49
+ MSVCChain[:COMPILER][:C][:ERROR_PARSER] = msvcCompilerErrorParser
50
+ MSVCChain[:COMPILER][:CPP][:ERROR_PARSER] = msvcCompilerErrorParser
51
+ MSVCChain[:COMPILER][:ASM][:ERROR_PARSER] = msvcCompilerErrorParser
52
+ MSVCChain[:ARCHIVER][:ERROR_PARSER] = msvcCompilerErrorParser
53
+ MSVCChain[:LINKER][:ERROR_PARSER] = MSVCLinkerErrorParser.new
54
+
55
+ end
56
+ end
57
+
@@ -10,6 +10,7 @@ module Bake
10
10
  :COMMAND => "",
11
11
  :DEFINE_FLAG => "",
12
12
  :OBJECT_FILE_FLAG => "",
13
+ :OBJECT_FILE_ENDING => ".o",
13
14
  :OBJ_FLAG_SPACE => false,
14
15
  :INCLUDE_PATH_FLAG => "",
15
16
  :COMPILE_FLAGS => "",
@@ -20,12 +21,14 @@ module Bake
20
21
  :DEP_FLAGS_SPACE => false,
21
22
  :DEP_FLAGS_FILENAME => true,
22
23
  :ERROR_PARSER => nil,
23
- :PREPRO_FLAGS => ""
24
+ :PREPRO_FLAGS => "",
25
+ :PREPRO_FILE_FLAG => nil
24
26
  },
25
27
  :C => {
26
28
  :COMMAND => "",
27
29
  :DEFINE_FLAG => "",
28
30
  :OBJECT_FILE_FLAG => "",
31
+ :OBJECT_FILE_ENDING => ".o",
29
32
  :OBJ_FLAG_SPACE => false,
30
33
  :INCLUDE_PATH_FLAG => "",
31
34
  :COMPILE_FLAGS => "",
@@ -36,12 +39,14 @@ module Bake
36
39
  :DEP_FLAGS_SPACE => false,
37
40
  :DEP_FLAGS_FILENAME => true,
38
41
  :ERROR_PARSER => nil,
39
- :PREPRO_FLAGS => ""
42
+ :PREPRO_FLAGS => "",
43
+ :PREPRO_FILE_FLAG => nil
40
44
  },
41
45
  :ASM => {
42
46
  :COMMAND => "",
43
47
  :DEFINE_FLAG => "",
44
48
  :OBJECT_FILE_FLAG => "",
49
+ :OBJECT_FILE_ENDING => ".o",
45
50
  :OBJ_FLAG_SPACE => false,
46
51
  :INCLUDE_PATH_FLAG => "",
47
52
  :COMPILE_FLAGS => "",
@@ -52,7 +57,8 @@ module Bake
52
57
  :DEP_FLAGS_SPACE => false,
53
58
  :DEP_FLAGS_FILENAME => true,
54
59
  :ERROR_PARSER => nil,
55
- :PREPRO_FLAGS => ""
60
+ :PREPRO_FLAGS => "",
61
+ :PREPRO_FILE_FLAG => nil
56
62
  }
57
63
  },
58
64
 
@@ -60,6 +66,7 @@ module Bake
60
66
  {
61
67
  :COMMAND => "",
62
68
  :ARCHIVE_FLAGS => "",
69
+ :ARCHIVE_FLAGS_SPACE => true,
63
70
  :FLAGS => "",
64
71
  :ERROR_PARSER => nil
65
72
  },
@@ -71,6 +78,7 @@ module Bake
71
78
  :SCRIPT => "",
72
79
  :USER_LIB_FLAG => "",
73
80
  :EXE_FLAG => "",
81
+ :EXE_FLAG_SPACE => true,
74
82
  :LIB_FLAG => "",
75
83
  :LIB_PATH_FLAG => "",
76
84
  :LIB_PREFIX_FLAGS => "", # "-Wl,--whole-archive",
@@ -131,6 +139,8 @@ require 'bake/toolchain/diab'
131
139
  require 'bake/toolchain/gcc'
132
140
  require 'bake/toolchain/lint'
133
141
  require 'bake/toolchain/clang'
142
+ require 'bake/toolchain/clang_analyze'
134
143
  require 'bake/toolchain/ti'
135
144
  require 'bake/toolchain/greenhills'
136
145
  require 'bake/toolchain/keil'
146
+ require 'bake/toolchain/msvc'
@@ -59,7 +59,6 @@ module Bake
59
59
  end
60
60
 
61
61
  def printCmd(cmd, alternate, reason, forceVerbose)
62
-
63
62
  if (cmd == @lastCommand)
64
63
  if (Bake.options.verbose >= 2 or (@printedCmdAlternate and not forceVerbose))
65
64
  return
@@ -95,13 +94,16 @@ module Bake
95
94
 
96
95
  def process_console_output(console_output, error_parser)
97
96
  ret = false
98
- if not console_output.empty?
97
+ incList = nil
98
+ #if not console_output.empty?
99
99
  if error_parser
100
100
  begin
101
- error_descs, console_output_full = error_parser.scan_lines(console_output, @projectDir)
102
-
101
+ x = [console_output]
102
+ error_descs, console_output_full, incList = error_parser.scan_lines(x, @projectDir)
103
+
104
+ console_output = x[0]
103
105
  console_output = console_output_full if Bake.options.consoleOutput_fullnames
104
-
106
+
105
107
  if Bake.options.consoleOutput_visualStudio
106
108
  console_output_VS = ""
107
109
  descCounter = 0
@@ -132,14 +134,14 @@ module Bake
132
134
  else
133
135
  puts console_output # fallback
134
136
  end
135
- end
136
- ret
137
+ #end
138
+ [ret, incList]
137
139
  end
138
140
 
139
141
  def process_result(cmd, console_output, error_parser, alternate, reason, success)
140
142
  hasError = (success == false)
141
143
  printCmd(cmd, alternate, reason, (hasError and not Bake.options.lint))
142
- errorPrinted = process_console_output(console_output, error_parser)
144
+ errorPrinted, incList = process_console_output(console_output, error_parser)
143
145
 
144
146
  if hasError and not errorPrinted
145
147
  Bake.formatter.printError("System command failed", @projectDir)
@@ -147,6 +149,7 @@ module Bake
147
149
  if hasError or errorPrinted
148
150
  raise SystemCommandFailed.new
149
151
  end
152
+ incList
150
153
  end
151
154
 
152
155
  end
@@ -24,7 +24,9 @@ module Bake
24
24
  end
25
25
 
26
26
  def get_object_file(source)
27
- adaptedSource = source.chomp(File.extname(source)).gsub(/\.\./, "##") + (Bake.options.prepro ? ".i" : ".o")
27
+
28
+ # until now all OBJECT_FILE_ENDING are equal in all three types
29
+ adaptedSource = source.chomp(File.extname(source)).gsub(/\.\./, "##") + (Bake.options.prepro ? ".i" : @tcs[:COMPILER][:CPP][:OBJECT_FILE_ENDING])
28
30
  return adaptedSource if File.is_absolute?source
29
31
  File.join([@output_dir, adaptedSource])
30
32
  end
@@ -32,7 +34,12 @@ module Bake
32
34
  def needed?(source, object, type, dep_filename_conv)
33
35
  return false if Bake.options.linkOnly
34
36
 
35
- return "because prepro was specified" if Bake.options.prepro
37
+ return "because analyzer toolchain is configured" if Bake.options.analyze
38
+
39
+ if Bake.options.prepro
40
+ return "because prepro was specified and source is no assembler file" if type != :ASM
41
+ return false
42
+ end
36
43
 
37
44
  return "because object does not exist" if not File.exist?(object)
38
45
  oTime = File.mtime(object)
@@ -41,7 +48,7 @@ module Bake
41
48
  return "Compiling #{source} because DefaultToolchain has been changed" if oTime < Bake::Config.defaultToolchainTime
42
49
 
43
50
  return "because source is newer than object" if oTime < File.mtime(source)
44
-
51
+
45
52
  if type != :ASM
46
53
  return "because dependency file does not exist" if not File.exist?(dep_filename_conv)
47
54
 
@@ -149,14 +156,17 @@ module Bake
149
156
  cmd += includes
150
157
  cmd += defines
151
158
 
159
+ offlag = compiler[:OBJECT_FILE_FLAG]
160
+ offlag = compiler[:PREPRO_FILE_FLAG] if compiler[:PREPRO_FILE_FLAG] and Bake.options.prepro
161
+
152
162
  if compiler[:OBJ_FLAG_SPACE]
153
- cmd << compiler[:OBJECT_FILE_FLAG]
163
+ cmd << offlag
154
164
  cmd << object
155
165
  else
156
166
  if object.include?" "
157
- cmd << compiler[:OBJECT_FILE_FLAG] + "\"" + object + "\""
167
+ cmd << offlag + "\"" + object + "\""
158
168
  else
159
- cmd << compiler[:OBJECT_FILE_FLAG] + object
169
+ cmd << offlag + object
160
170
  end
161
171
  end
162
172
  cmd << source
@@ -164,12 +174,14 @@ module Bake
164
174
  if Bake.options.cc2j_filename
165
175
  Blocks::CC2J << { :directory => @projectDir, :command => cmd, :file => source }
166
176
  end
167
-
168
177
  success, consoleOutput = ProcessHelper.run(cmd, false, false)
169
- outputType = Bake.options.prepro ? "Preprocessing" : "Compiling"
170
- process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "#{outputType} #{source}", reason, success)
178
+ outputType = Bake.options.analyze ? "Analyzing" : (Bake.options.prepro ? "Preprocessing" : "Compiling")
179
+ incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "#{outputType} #{source}", reason, success)
171
180
 
172
- Compile.convert_depfile(dep_filename, dep_filename_conv, @projectDir, @tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if type != :ASM
181
+ if type != :ASM and not Bake.options.analyze and not Bake.options.prepro
182
+ incList = Compile.read_depfile(dep_filename, @projectDir, @tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
183
+ Compile.write_depfile(incList, dep_filename_conv)
184
+ end
173
185
  check_config_file
174
186
  end
175
187
 
@@ -195,8 +207,7 @@ module Bake
195
207
  end
196
208
 
197
209
  # todo: move to toolchain util file
198
- def self.convert_depfile(dep_filename, dep_filename_conv, projDir, singleLine)
199
- deps = read_depfile(dep_filename, projDir, singleLine)
210
+ def self.write_depfile(deps, dep_filename_conv)
200
211
  if deps
201
212
  begin
202
213
  File.open(dep_filename_conv, 'wb') do |f|
@@ -275,7 +286,7 @@ module Bake
275
286
  end
276
287
 
277
288
  def clean
278
- if Bake.options.filename
289
+ if Bake.options.filename or Bake.options.analyze
279
290
  Dir.chdir(@projectDir) do
280
291
  calcSources(true)
281
292
  @source_files.each do |source|
@@ -283,14 +294,16 @@ module Bake
283
294
  type = get_source_type(source)
284
295
  next if type.nil?
285
296
  object = get_object_file(source)
286
- dep_filename = calcDepFile(object, type)
287
297
  if File.exist?object
288
298
  puts "Deleting file #{object}" if Bake.options.verbose >= 2
289
299
  FileUtils.rm_rf(object)
290
300
  end
291
- if File.exist?dep_filename
292
- puts "Deleting file #{dep_filename}" if Bake.options.verbose >= 2
293
- FileUtils.rm_rf(dep_filename)
301
+ if not Bake.options.analyze
302
+ dep_filename = calcDepFile(object, type)
303
+ if dep_filename and File.exist?dep_filename
304
+ puts "Deleting file #{dep_filename}" if Bake.options.verbose >= 2
305
+ FileUtils.rm_rf(dep_filename)
306
+ end
294
307
  end
295
308
  end
296
309
  end
@@ -99,8 +99,15 @@ module Bake
99
99
  cmd = Utils.flagSplit(linker[:COMMAND], false) # g++
100
100
  cmd += linker[:MUST_FLAGS].split(" ")
101
101
  cmd += Bake::Utils::flagSplit(linker[:FLAGS],true)
102
+
103
+
102
104
  cmd << linker[:EXE_FLAG]
103
- cmd << @exe_name # -o debug/x.exe
105
+ if linker[:EXE_FLAG_SPACE]
106
+ cmd << @exe_name
107
+ else
108
+ cmd[cmd.length-1] += @exe_name
109
+ end
110
+
104
111
  cmd += @compileBlock.objects
105
112
  cmd << linker[:SCRIPT] if @linker_script # -T
106
113
  cmd << @linker_script if @linker_script # xy/xy.dld
@@ -52,7 +52,13 @@ module Bake
52
52
  cmd = Utils.flagSplit(archiver[:COMMAND], false) # ar
53
53
  cmd += Bake::Utils::flagSplit(archiver[:FLAGS],true) # --all_load
54
54
  cmd += archiver[:ARCHIVE_FLAGS].split(" ")
55
- cmd << archive_name
55
+
56
+ if archiver[:ARCHIVE_FLAGS_SPACE]
57
+ cmd << archive_name
58
+ else
59
+ cmd[cmd.length-1] += archive_name
60
+ end
61
+
56
62
  cmd += @compileBlock.objects
57
63
 
58
64
  success, consoleOutput = ProcessHelper.run(cmd, false, false)
@@ -42,7 +42,6 @@ module Bake
42
42
  pid, status = Process.wait2(pid)
43
43
  @@pid = nil
44
44
  @@rd = nil
45
- cmdLineArray.pop
46
45
  return [false, output] if status.nil?
47
46
  [status.success?, output]
48
47
  end
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.2.2"
4
+ "2.3.4"
5
5
  end
6
6
  end
7
7
 
@@ -102,7 +102,7 @@ module Bake
102
102
 
103
103
  Blocks::ALL_BLOCKS[config.qname] = block
104
104
 
105
- if not Bake.options.linkOnly and not Bake.options.prepro and not Bake.options.lint and not Bake.options.docu and not Bake.options.filename
105
+ if not Bake.options.linkOnly and not Bake.options.prepro and not Bake.options.lint and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
106
106
  addSteps(block, block.preSteps, config.preSteps)
107
107
  addSteps(block, block.postSteps, config.postSteps)
108
108
  end
@@ -110,7 +110,7 @@ module Bake
110
110
  if Bake.options.docu
111
111
  block.mainSteps << Blocks::Docu.new(config, @configTcMap[config])
112
112
  elsif Metamodel::CustomConfig === config
113
- if not Bake.options.linkOnly and not Bake.options.prepro and not Bake.options.lint and not Bake.options.docu and not Bake.options.filename
113
+ if not Bake.options.linkOnly and not Bake.options.prepro and not Bake.options.lint and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
114
114
  addSteps(block, block.mainSteps, config) if config.step
115
115
  end
116
116
  elsif Bake.options.lint
@@ -119,7 +119,7 @@ module Bake
119
119
  compile = Blocks::Compile.new(block, config, @loadedConfig.referencedConfigs, @configTcMap[config])
120
120
  (Blocks::ALL_COMPILE_BLOCKS[projName] ||= []) << compile
121
121
  block.mainSteps << compile
122
- if not Bake.options.filename
122
+ if not Bake.options.filename and not Bake.options.analyze
123
123
  if Metamodel::LibraryConfig === config
124
124
  block.mainSteps << Blocks::Library.new(block, config, @loadedConfig.referencedConfigs, @configTcMap[config], compile)
125
125
  else
@@ -219,6 +219,8 @@ module Bake
219
219
  @loadedConfig = Config.new
220
220
  @loadedConfig.load
221
221
 
222
+ taskType = "Analyzing" if Bake.options.analyze
223
+
222
224
  @mainConfig = @loadedConfig.referencedConfigs[Bake.options.main_project_name].select { |c| c.name == Bake.options.build_config }.first
223
225
 
224
226
  if Bake.options.lint
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext
@@ -91,6 +91,7 @@ files:
91
91
  - lib/bake/options/usage.rb
92
92
  - lib/bake/subst.rb
93
93
  - lib/bake/toolchain/clang.rb
94
+ - lib/bake/toolchain/clang_analyze.rb
94
95
  - lib/bake/toolchain/colorizing_formatter.rb
95
96
  - lib/bake/toolchain/diab.rb
96
97
  - lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb
@@ -103,6 +104,8 @@ files:
103
104
  - lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb
104
105
  - lib/bake/toolchain/errorparser/keil_linker_error_parser.rb
105
106
  - lib/bake/toolchain/errorparser/lint_error_parser.rb
107
+ - lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb
108
+ - lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb
106
109
  - lib/bake/toolchain/errorparser/process_output.rb
107
110
  - lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb
108
111
  - lib/bake/toolchain/errorparser/ti_linker_error_parser.rb
@@ -111,6 +114,7 @@ files:
111
114
  - lib/bake/toolchain/greenhills.rb
112
115
  - lib/bake/toolchain/keil.rb
113
116
  - lib/bake/toolchain/lint.rb
117
+ - lib/bake/toolchain/msvc.rb
114
118
  - lib/bake/toolchain/provider.rb
115
119
  - lib/bake/toolchain/ti.rb
116
120
  - lib/bake/util.rb
@@ -157,6 +161,7 @@ files:
157
161
  - doc/concepts/hier.png
158
162
  - doc/concepts/mainproject.html
159
163
  - doc/deployDoc.bat
164
+ - doc/dyk/clang.html
160
165
  - doc/dyk/keys.png
161
166
  - doc/dyk/lint.html
162
167
  - doc/dyk/tipps.html
@@ -201,6 +206,8 @@ files:
201
206
  - doc/syntax/syntax.html
202
207
  - doc/vs/create.html
203
208
  - doc/vs/create/cvsp.png
209
+ - doc/vs/debug.html
210
+ - doc/vs/echse/echse.png
204
211
  - doc/vs/install.html
205
212
  - doc/vs/install/install1.png
206
213
  - doc/vs/install/install2010.png