bake-toolkit 2.3.4 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b64fc98f1d57e95813caf1aa0b720befa42b89a
4
- data.tar.gz: 019eaba3c441e8c9e4a3fce2ba48f30fab2e8c94
3
+ metadata.gz: 5988f843e875a56d7340d145eb04d2802ded9afc
4
+ data.tar.gz: a1385eaa3a37f33d7266790bea4ff5cb5d877fa0
5
5
  SHA512:
6
- metadata.gz: d879d2b96339f55d99275a8bdba981c77cf647b6fa9146990e47a4dfcddc897c8ec1a2c5902e20e2ce25e9cc92b47bcd7f9fdeeed8a420d6d2d2d5725a6918a6
7
- data.tar.gz: 098620c65ab6537b77fa7b8580a9b65a1aa7d6eea893c7fe3aeac7c65e7089ff86a48a0a91e4f41e2437d1edd8c95b6e755a51dbf19267d9aa456591048772a1
6
+ metadata.gz: 213f610952f6bcfacef10bbb4e8e27c877f6c3eadbdd590f419e483eb0c9b206a7136d255de5f8ce65bc311440745ea5ec361a866a98b8c024a5bf691799fa9f
7
+ data.tar.gz: 8f0c811eebcf0af7ebf827dbfc6dace9b221352dc5941ffd3be73cc2325b2369055a497269ba06d6da487acd1cb6362e7e820e1905832dce6d453c9b3e96ca7f
@@ -7,6 +7,19 @@
7
7
  <body>
8
8
  <h1>Changelog</h1>
9
9
 
10
+ March 30, 2015 - bake-toolkit 2.4.3<br>
11
+ <ul>
12
+ <li><b>Added: If Project.meta files are updated, sources will only be recompiled if necessary</b>
13
+ <li><b>Added: <i>Set</i> command in Project.meta has now an <i>env</i> attribute to store variables also in system environment which makes them accessible from user scripts</b>
14
+ <li><b>Added: GCC_ENV toolchain (uses environment variables)</b>
15
+ <li><b>Added: Improved MSVC support</b>
16
+ </ul>
17
+
18
+ March 16, 2015 - VS plugin 1.0.1 <br>
19
+ <ul>
20
+ <li><b>Added: Support for VS2013</b>
21
+ </ul>
22
+
10
23
  March 12, 2015 - bake-toolkit 2.3.4<br>
11
24
  <ul>
12
25
  <li><b>Changed: Clang command is now "clang" per default instead of llvm-gcc</b>
data/doc/index.html CHANGED
@@ -74,7 +74,7 @@ bake is used to build software <font color="#009900"><b>fast</b></font> and <fon
74
74
 
75
75
  <p>
76
76
  <hr>
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>
77
+ <table width="100%" border="0"><tr><td align="left">Described bake-toolkit version: 2.4.3</td><td align="right">March 30, 2015</td></tr></table>
78
78
 
79
79
  </body>
80
80
 
@@ -81,7 +81,7 @@ z-index: 100;
81
81
 
82
82
  <span><span style="background-color:#EEEEEE;" class="show">
83
83
  &nbsp; &nbsp; <span class="mycomment"># Valid for all config types</span><br><br>
84
- &nbsp; &nbsp; <span class="help" onMouseover="showSet()" onMouseout="notip()">Set</span> &#60;variable&#62;, value: &#60;value&#62; | cmd: &#60;line&#62;<br>
84
+ &nbsp; &nbsp; <span class="help" onMouseover="showSet()" onMouseout="notip()">Set</span> &#60;variable&#62;, value: &#60;value&#62; | cmd: &#60;line&#62;, <span class="help" onMouseover="showEnv()" onMouseout="notip()">env</span>: true|false<br>
85
85
  &nbsp; &nbsp; <span class="help" onMouseover="showDependency()" onMouseout="notip()">Dependency</span> &#60;project&#62;,
86
86
  <span class="help" onMouseover="showDependencyConfig()" onMouseout="notip()">config</span>: &#60;name&#62;<br>
87
87
  &nbsp; &nbsp; <span class="help" onMouseover="showExternalLibrary()" onMouseout="notip()">ExternalLibrary</span> &#60;lib&#62;,
@@ -431,6 +431,11 @@ function showSet() {
431
431
  ddrivetip("Set", "No","0..n","-",str)
432
432
  }
433
433
 
434
+ function showEnv() {
435
+ str = 'Stores the variable also in system environment, which makes it available in everything which is executed by bake, e.g. in Pre- and PostSteps.'
436
+ ddrivetip("env", "No","-","false",str)
437
+ }
438
+
434
439
  function showDependency() {
435
440
  str = 'Specifies another project to be built before this project.<br>'+
436
441
  'The archive, linker libs and search paths are imported from this project to the this project automatically.<br>'+
data/doc/vs/debug.html CHANGED
@@ -29,7 +29,7 @@ Add debug flags to the MSVC toolchain:
29
29
  }
30
30
  }</code></pre>
31
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>.
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="create.html">How to create a solution / projects in Visual Studio</a>.
33
33
 
34
34
  <pre id="rundrum"><code>set PATH=%PATH%;C:\tools\Microsoft Visual Studio 11.0\VC\bin
35
35
  call "C:\tools\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
data/lib/bake/cache.rb CHANGED
@@ -13,15 +13,11 @@ module Bake
13
13
  attr_accessor :workspace_roots
14
14
  attr_accessor :include_filter
15
15
  attr_accessor :exclude_filter
16
- attr_accessor :defaultToolchain
17
- attr_accessor :defaultToolchainTime
18
16
  attr_accessor :no_autodir
19
17
  attr_accessor :build_config
20
18
  end
21
19
 
22
20
  class CacheAccess
23
- attr_reader :defaultToolchain
24
- attr_reader :defaultToolchainTime
25
21
  attr_reader :cacheFilename
26
22
 
27
23
  def initialize()
@@ -32,8 +28,6 @@ module Bake
32
28
  end
33
29
 
34
30
  FileUtils.mkdir_p(File.dirname(@cacheFilename))
35
- @defaultToolchain = nil
36
- @defaultToolchainTime = nil
37
31
  end
38
32
 
39
33
  def load_cache
@@ -48,10 +42,7 @@ module Bake
48
42
  if cache.version != Version.number
49
43
  Bake.formatter.printInfo("Info: cache version ("+cache.version+") does not match to bake version ("+Version.number+"), reloading meta information")
50
44
  cache = nil
51
- else
52
- @defaultToolchain = cache.defaultToolchain
53
- @defaultToolchainTime = cache.defaultToolchainTime
54
- end
45
+ end
55
46
 
56
47
  if cache != nil
57
48
  if cache.cache_file != @cacheFilename
@@ -138,7 +129,7 @@ module Bake
138
129
  return nil
139
130
  end
140
131
 
141
- def write_cache(project_files, referencedConfigs, defaultToolchain, defaultToolchainTime)
132
+ def write_cache(project_files, referencedConfigs)
142
133
  cache = Cache.new
143
134
  cache.referencedConfigs = referencedConfigs
144
135
  cache.files = project_files
@@ -148,8 +139,6 @@ module Bake
148
139
  cache.no_autodir = Bake.options.no_autodir
149
140
  cache.exclude_filter = Bake.options.exclude_filter
150
141
  cache.workspace_roots = Bake.options.roots
151
- cache.defaultToolchain = defaultToolchain
152
- cache.defaultToolchainTime = defaultToolchainTime
153
142
  cache.build_config = Bake.options.build_config
154
143
  bbdump = Marshal.dump(cache)
155
144
  begin
@@ -4,13 +4,6 @@ module Bake
4
4
 
5
5
  class Config
6
6
  attr_reader :referencedConfigs
7
- attr_reader :defaultToolchain
8
-
9
- @@defaultToolchainTime = nil
10
-
11
- def self.defaultToolchainTime
12
- @@defaultToolchainTime
13
- end
14
7
 
15
8
  def getFullProject(configs, configname) # note: configs is never empty
16
9
 
@@ -196,16 +189,6 @@ module Bake
196
189
  ExitHelper.exit(1)
197
190
  end
198
191
 
199
- basedOn = config.defaultToolchain.basedOn
200
- @basedOnToolchain = Bake::Toolchain::Provider[basedOn]
201
- if @basedOnToolchain.nil?
202
- Bake.formatter.printError("DefaultToolchain based on unknown compiler '#{basedOn}'", config.defaultToolchain)
203
- ExitHelper.exit(1)
204
- end
205
- @defaultToolchain = Utils.deep_copy(@basedOnToolchain)
206
- integrateToolchain(@defaultToolchain, config.defaultToolchain)
207
- @@defaultToolchainTime = File.mtime(mainMeta)
208
-
209
192
  validateDependencies(config)
210
193
  @depsPending = config.dependency
211
194
  end
@@ -267,36 +250,11 @@ module Bake
267
250
  while dep = @depsPending.shift
268
251
  loadMeta(dep)
269
252
  end
270
-
271
-
272
-
273
- if (cache.defaultToolchain)
274
- if @defaultToolchain[:LINKER][:FLAGS] == cache.defaultToolchain[:LINKER][:FLAGS] and
275
- @defaultToolchain[:LINKER][:LIB_PREFIX_FLAGS] == cache.defaultToolchain[:LINKER][:LIB_PREFIX_FLAGS] and
276
- @defaultToolchain[:LINKER][:LIB_POSTFIX_FLAGS] == cache.defaultToolchain[:LINKER][:LIB_POSTFIX_FLAGS] and
277
- @defaultToolchain[:ARCHIVER][:FLAGS] == cache.defaultToolchain[:ARCHIVER][:FLAGS] and
278
- @defaultToolchain[:COMPILER][:CPP][:FLAGS] == cache.defaultToolchain[:COMPILER][:CPP][:FLAGS] and
279
- @defaultToolchain[:COMPILER][:CPP][:DEFINES].join("") == cache.defaultToolchain[:COMPILER][:CPP][:DEFINES].join("") and
280
- @defaultToolchain[:COMPILER][:C][:FLAGS] == cache.defaultToolchain[:COMPILER][:C][:FLAGS] and
281
- @defaultToolchain[:COMPILER][:C][:DEFINES].join("") == cache.defaultToolchain[:COMPILER][:C][:DEFINES].join("") and
282
- @defaultToolchain[:COMPILER][:ASM][:FLAGS] == cache.defaultToolchain[:COMPILER][:ASM][:FLAGS] and
283
- @defaultToolchain[:COMPILER][:ASM][:DEFINES].join("") == cache.defaultToolchain[:COMPILER][:ASM][:DEFINES].join("") and
284
- @defaultToolchain[:LINT_POLICY].join("") == cache.defaultToolchain[:LINT_POLICY].join("")
285
- @defaultToolchain[:DOCU] == cache.defaultToolchain[:DOCU]
286
- @@defaultToolchainTime = cache.defaultToolchainTime
287
- end
288
- end
289
-
253
+
290
254
  filterSteps
291
255
 
292
- cache.write_cache(@project_files, @referencedConfigs, @defaultToolchain, @@defaultToolchainTime)
293
- else
294
- @defaultToolchain = cache.defaultToolchain
295
- @@defaultToolchainTime = cache.defaultToolchainTime
256
+ cache.write_cache(@project_files, @referencedConfigs)
296
257
  end
297
-
298
- # todo: cleanup this hack
299
- Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
300
258
 
301
259
  end
302
260
 
@@ -142,6 +142,7 @@ module Bake
142
142
  has_attr 'name', String, :defaultValueLiteral => ""
143
143
  has_attr 'default', String, :defaultValueLiteral => "on"
144
144
  has_attr 'filter', String, :defaultValueLiteral => ""
145
+ has_many_attr 'validExitCodes', Integer, :defaultValueLiteral => ["0"]
145
146
  end
146
147
 
147
148
  class Makefile < Step
@@ -162,6 +163,10 @@ module Bake
162
163
  contains_many 'step', Step, 'parent'
163
164
  end
164
165
 
166
+ class ExitSteps < ModelElement
167
+ contains_many 'step', Step, 'parent'
168
+ end
169
+
165
170
  class UserLibrary < ModelElement
166
171
  has_attr 'lib', String, :defaultValueLiteral => ""
167
172
  end
@@ -182,6 +187,7 @@ module Bake
182
187
  has_attr 'name', String, :defaultValueLiteral => ""
183
188
  has_attr 'value', String, :defaultValueLiteral => ""
184
189
  has_attr 'cmd', String, :defaultValueLiteral => ""
190
+ has_attr 'env', Boolean, :defaultValueLiteral => "false"
185
191
  end
186
192
 
187
193
  class BaseConfig_INTERNAL < ModelElement
@@ -189,6 +195,7 @@ module Bake
189
195
  has_attr 'extends', String, :defaultValueLiteral => ""
190
196
  contains_one 'preSteps', PreSteps, 'parent'
191
197
  contains_one 'postSteps', PostSteps, 'parent'
198
+ contains_one 'exitSteps', ExitSteps, 'parent'
192
199
  contains_many 'userLibrary', UserLibrary, 'parent'
193
200
  contains_many 'exLib', ExternalLibrary, 'parent'
194
201
  contains_many 'exLibSearchPath', ExternalLibrarySearchPath, 'parent'
@@ -17,7 +17,7 @@ module Bake
17
17
  end
18
18
 
19
19
  class Options < Parser
20
- attr_accessor :build_config, :nocache, :analyze
20
+ attr_accessor :build_config, :nocache, :analyze, :envToolchain
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
+ @envToolchain = false
33
34
  @analyze = false
34
35
  @showConfigs = false
35
36
  @consoleOutput_fullnames = false
data/lib/bake/subst.rb CHANGED
@@ -18,12 +18,14 @@ module Bake
18
18
  linkerCmd = @@config.toolchain.linker.command if @@config.toolchain.linker and @@config.toolchain.linker.command != ""
19
19
  archiverCmd = @@config.toolchain.archiver.command if @@config.toolchain.linker and @@config.toolchain.archiver.command != ""
20
20
  @@config.toolchain.compiler.each do |c|
21
- if c.ctype == :CPP
22
- cppCmd = c.command
23
- elsif c.ctype == :C
24
- cCmd = c.command
25
- elsif c.ctype == :ASM
26
- asmCmd = c.command
21
+ if c.command != ""
22
+ if c.ctype == :CPP
23
+ cppCmd = c.command
24
+ elsif c.ctype == :C
25
+ cCmd = c.command
26
+ elsif c.ctype == :ASM
27
+ asmCmd = c.command
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -81,6 +83,7 @@ module Bake
81
83
  Bake.formatter.printWarning("Name of variable must not be empty - variable will be ignored", s)
82
84
  else
83
85
  @@userVarMap[s.name] = substString(s.value, s)
86
+ ENV[s.name] = @@userVarMap[s.name] if s.env
84
87
  end
85
88
  else
86
89
  cmd_result = false
@@ -90,6 +93,7 @@ module Bake
90
93
  cmd = [substString(s.cmd, s)]
91
94
  cmd_result, consoleOutput = ProcessHelper.run(cmd)
92
95
  @@userVarMap[s.name] = consoleOutput.chomp
96
+ ENV[s.name] = @@userVarMap[s.name] if s.env
93
97
  end
94
98
  rescue Exception=>e
95
99
  consoleOutput = e.message
@@ -97,6 +101,7 @@ module Bake
97
101
  if (cmd_result == false)
98
102
  Bake.formatter.printWarning("Command not successful, variable #{s.name} will be set to \"\" (#{consoleOutput.chomp}).", s)
99
103
  @@userVarMap[s.name] = ""
104
+ ENV[s.name] = "" if s.env
100
105
  end
101
106
  end
102
107
 
@@ -262,7 +267,7 @@ module Bake
262
267
  substStr << str[posSubst..-1]
263
268
  substStr
264
269
  end
265
-
270
+
266
271
  def self.substToolchain(elem)
267
272
  if Hash === elem
268
273
  elem.each do |k, e|
@@ -4,7 +4,7 @@ module Bake
4
4
  class MSVCCompilerErrorParser < ErrorParser
5
5
 
6
6
  def initialize()
7
- @error_expression = /(.+)\(([0-9]+)\) : ([A-Za-z\._]+) (.+)/
7
+ @error_expression = /(.+)\(([0-9]+)\) : ([A-Za-z\._]+) (C[\d]+: .+)/
8
8
  @incEng = "Note: including file: "
9
9
  @incGer = "Hinweis: Einlesen der Datei: "
10
10
  end
@@ -28,7 +28,7 @@ module Bake
28
28
  filterLine = 100
29
29
 
30
30
  if l.include?@incEng
31
- includeList << l[@incEng.length..-1]
31
+ includeList << l[@incEng.length..-1].strip
32
32
  next
33
33
  end
34
34
  if l.include?@incGer
@@ -0,0 +1,55 @@
1
+ require 'common/utils'
2
+ require 'bake/toolchain/provider'
3
+ require 'bake/toolchain/errorparser/error_parser'
4
+ require 'bake/toolchain/errorparser/gcc_compiler_error_parser'
5
+ require 'bake/toolchain/errorparser/gcc_linker_error_parser'
6
+
7
+ module Bake
8
+ module Toolchain
9
+
10
+ GCCENVChain = Provider.add("GCC_ENV")
11
+
12
+ GCCENVChain[:COMPILER][:CPP].update({
13
+ :COMMAND => "$(CXX)",
14
+ :DEFINE_FLAG => "-D",
15
+ :OBJECT_FILE_FLAG => "-o",
16
+ :OBJ_FLAG_SPACE => true,
17
+ :INCLUDE_PATH_FLAG => "-I",
18
+ :COMPILE_FLAGS => "-c ",
19
+ :DEP_FLAGS => "-MD -MF",
20
+ :DEP_FLAGS_SPACE => true,
21
+ :PREPRO_FLAGS => "-E -P",
22
+ :FLAGS => "$(CXXFLAGS)"
23
+ })
24
+
25
+ GCCENVChain[:COMPILER][:C] = Utils.deep_copy(GCCENVChain[:COMPILER][:CPP])
26
+ GCCENVChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
27
+ GCCENVChain[:COMPILER][:C][:COMMAND] = "$(CC)"
28
+ GCCENVChain[:COMPILER][:C][:FLAGS] = "$(CFLAGS)"
29
+
30
+ GCCENVChain[:COMPILER][:ASM] = Utils.deep_copy(GCCENVChain[:COMPILER][:C])
31
+ GCCENVChain[:COMPILER][:ASM][:COMMAND] = "$(AS)"
32
+ GCCENVChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
33
+ GCCENVChain[:COMPILER][:ASM][:FLAGS] = "$(ASFLAGS)"
34
+
35
+ GCCENVChain[:ARCHIVER][:COMMAND] = "$(AR)"
36
+ GCCENVChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-rc"
37
+ GCCENVChain[:ARCHIVER][:FLAGS] = "$(ARFLAGS)"
38
+
39
+ GCCENVChain[:LINKER][:COMMAND] = "$(CXX)"
40
+ GCCENVChain[:LINKER][:SCRIPT] = "-T"
41
+ GCCENVChain[:LINKER][:USER_LIB_FLAG] = "-l:"
42
+ GCCENVChain[:LINKER][:EXE_FLAG] = "-o"
43
+ GCCENVChain[:LINKER][:LIB_FLAG] = "-l"
44
+ GCCENVChain[:LINKER][:LIB_PATH_FLAG] = "-L"
45
+ GCCENVChain[:LINKER][:FLAGS] = "$(LDFLAGS)"
46
+
47
+ gccCompilerErrorParser = GCCCompilerErrorParser.new
48
+ GCCENVChain[:COMPILER][:C][:ERROR_PARSER] = gccCompilerErrorParser
49
+ GCCENVChain[:COMPILER][:CPP][:ERROR_PARSER] = gccCompilerErrorParser
50
+ GCCENVChain[:COMPILER][:ASM][:ERROR_PARSER] = gccCompilerErrorParser
51
+ GCCENVChain[:ARCHIVER][:ERROR_PARSER] = gccCompilerErrorParser
52
+ GCCENVChain[:LINKER][:ERROR_PARSER] = GCCLinkerErrorParser.new
53
+
54
+ end
55
+ end
@@ -15,7 +15,7 @@ module Bake
15
15
  :OBJECT_FILE_FLAG => "-Fo",
16
16
  :OBJ_FLAG_SPACE => false,
17
17
  :INCLUDE_PATH_FLAG => "-I",
18
- :COMPILE_FLAGS => "-c -EHsc",
18
+ :COMPILE_FLAGS => "-c -EHsc $(MSVC_FORCE_SYNC_PDB_WRITES)",
19
19
  :DEP_FLAGS_FILENAME => false,
20
20
  :DEP_FLAGS => "-showIncludes",
21
21
  :DEP_FLAGS_SPACE => true,
@@ -28,7 +28,7 @@ module Bake
28
28
 
29
29
  MSVCChain[:COMPILER][:ASM] = Utils.deep_copy(MSVCChain[:COMPILER][:C])
30
30
  MSVCChain[:COMPILER][:ASM][:COMMAND] = "ml"
31
- MSVCChain[:COMPILER][:ASM][:COMPILE_FLAGS] = "-c"
31
+ MSVCChain[:COMPILER][:ASM][:COMPILE_FLAGS] = "-c $(MSVC_FORCE_SYNC_PDB_WRITES)"
32
32
  MSVCChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
33
33
 
34
34
  MSVCChain[:ARCHIVER][:COMMAND] = "lib"
@@ -45,6 +45,7 @@ module Bake
45
45
  MSVCChain[:LINKER][:MAP_FILE_PIPE] = false
46
46
  MSVCChain[:LINKER][:SCRIPT] = "Linkerscript option not supported for MSVC"
47
47
 
48
+
48
49
  msvcCompilerErrorParser = MSVCCompilerErrorParser.new
49
50
  MSVCChain[:COMPILER][:C][:ERROR_PARSER] = msvcCompilerErrorParser
50
51
  MSVCChain[:COMPILER][:CPP][:ERROR_PARSER] = msvcCompilerErrorParser
@@ -144,3 +144,4 @@ require 'bake/toolchain/ti'
144
144
  require 'bake/toolchain/greenhills'
145
145
  require 'bake/toolchain/keil'
146
146
  require 'bake/toolchain/msvc'
147
+ require 'bake/toolchain/gcc_env'
@@ -47,6 +47,48 @@ module Bake
47
47
  end
48
48
  end
49
49
 
50
+ def defaultToolchainTime
51
+ @defaultToolchainTime ||= File.mtime(Bake.options.main_dir+"/Project.meta")
52
+ end
53
+
54
+ def config_changed?(cmdLineFile)
55
+ return "because command line file does not exist" if not File.exist?(cmdLineFile)
56
+ cmdTime = File.mtime(cmdLineFile)
57
+ return "because config file has been changed" if cmdTime < File.mtime(@config.file_name)
58
+ return "because DefaultToolchain has been changed" if cmdTime < defaultToolchainTime
59
+ return "because environment variables used for toolchain have been changed" if (Bake.options.envToolchain)
60
+ false
61
+ end
62
+
63
+ def self.isCmdLineEqual?(cmd, cmdLineFile)
64
+ begin
65
+ if File.exist?cmdLineFile
66
+ lastCmdLineArray = File.readlines(cmdLineFile)[0];
67
+ if lastCmdLineArray == cmd.join(" ")
68
+ FileUtils.touch(cmdLineFile)
69
+ return true
70
+ end
71
+ end
72
+ rescue Exception => e
73
+ if Bake.options.debug
74
+ puts e.message
75
+ puts e.backtrace
76
+ end
77
+ end
78
+ return false
79
+ end
80
+
81
+ def self.writeCmdLineFile(cmd, cmdLineFile)
82
+ begin
83
+ File.write(cmdLineFile, cmd.join(" "))
84
+ rescue Exception => e
85
+ if Bake.options.debug
86
+ puts e.message
87
+ puts e.backtrace
88
+ end
89
+ end
90
+ end
91
+
50
92
  def calcOutputDir
51
93
  if @tcs[:OUTPUT_DIR] != nil
52
94
  p = @block.convPath(@tcs[:OUTPUT_DIR])
@@ -122,7 +164,7 @@ module Bake
122
164
  end
123
165
 
124
166
  console_output.gsub!(/[\r]/, "")
125
- Bake.formatter.format(console_output, error_descs, error_parser)
167
+ Bake.formatter.format(console_output, error_descs, error_parser) unless console_output.empty?
126
168
 
127
169
  Bake::IDEInterface.instance.set_errors(error_descs)
128
170
  rescue Exception => e
@@ -142,7 +184,6 @@ module Bake
142
184
  hasError = (success == false)
143
185
  printCmd(cmd, alternate, reason, (hasError and not Bake.options.lint))
144
186
  errorPrinted, incList = process_console_output(console_output, error_parser)
145
-
146
187
  if hasError and not errorPrinted
147
188
  Bake.formatter.printError("System command failed", @projectDir)
148
189
  end
@@ -44,9 +44,6 @@ module Bake
44
44
  return "because object does not exist" if not File.exist?(object)
45
45
  oTime = File.mtime(object)
46
46
 
47
- return "because config file has been changed" if oTime < File.mtime(@config.file_name)
48
- return "Compiling #{source} because DefaultToolchain has been changed" if oTime < Bake::Config.defaultToolchainTime
49
-
50
47
  return "because source is newer than object" if oTime < File.mtime(source)
51
48
 
52
49
  if type != :ASM
@@ -81,6 +78,10 @@ module Bake
81
78
  false
82
79
  end
83
80
 
81
+ def calcCmdlineFile(object)
82
+ object[0..-3] + ".cmdline"
83
+ end
84
+
84
85
  def calcDepFile(object, type)
85
86
  dep_filename = nil
86
87
  if type != :ASM
@@ -111,7 +112,13 @@ module Bake
111
112
  dep_filename = calcDepFile(object, type)
112
113
  dep_filename_conv = calcDepFileConv(dep_filename) if type != :ASM
113
114
 
115
+ cmdLineCheck = false
116
+ cmdLineFile = calcCmdlineFile(object)
114
117
  reason = needed?(source, object, type, dep_filename_conv)
118
+ if not reason
119
+ cmdLineCheck = true
120
+ reason = config_changed?(cmdLineFile)
121
+ end
115
122
  return true unless reason
116
123
 
117
124
  if @fileTcs.include?(source)
@@ -130,8 +137,6 @@ module Bake
130
137
  raise SystemCommandFailed.new
131
138
  end
132
139
 
133
- BlockBase.prepareOutput(object)
134
-
135
140
  cmd = Utils.flagSplit(compiler[:COMMAND], false)
136
141
  cmd += compiler[:COMPILE_FLAGS].split(" ")
137
142
 
@@ -174,7 +179,13 @@ module Bake
174
179
  if Bake.options.cc2j_filename
175
180
  Blocks::CC2J << { :directory => @projectDir, :command => cmd, :file => source }
176
181
  end
182
+
183
+ return if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
184
+
185
+ BlockBase.prepareOutput(object)
177
186
  success, consoleOutput = ProcessHelper.run(cmd, false, false)
187
+ BlockBase.writeCmdLineFile(cmd, cmdLineFile) if success
188
+
178
189
  outputType = Bake.options.analyze ? "Analyzing" : (Bake.options.prepro ? "Preprocessing" : "Compiling")
179
190
  incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "#{outputType} #{source}", reason, success)
180
191
 
@@ -304,6 +315,11 @@ module Bake
304
315
  puts "Deleting file #{dep_filename}" if Bake.options.verbose >= 2
305
316
  FileUtils.rm_rf(dep_filename)
306
317
  end
318
+ cmdLineFile = calcCmdlineFile(object)
319
+ if File.exist?cmdLineFile
320
+ puts "Deleting file #{cmdLineFile}" if Bake.options.verbose >= 2
321
+ FileUtils.rm_rf(cmdLineFile)
322
+ end
307
323
  end
308
324
  end
309
325
  end
@@ -29,6 +29,10 @@ module Bake
29
29
  @exe_name ||= File.join([@output_dir, baseFilename])
30
30
  end
31
31
 
32
+ def calcCmdlineFile()
33
+ @exe_name + ".cmdline"
34
+ end
35
+
32
36
  def calcMapFile
33
37
  @mapfile = nil
34
38
  if (not Bake.options.docu) and (not Bake.options.lint) and (not @config.mapFile.nil?)
@@ -50,7 +54,6 @@ module Bake
50
54
  end
51
55
 
52
56
  def needed?(libs)
53
- return false if depHasError(@block)
54
57
  return false if Bake.options.prepro
55
58
  return "because linkOnly was specified" if Bake.options.linkOnly
56
59
 
@@ -58,10 +61,6 @@ module Bake
58
61
  return "because executable does not exist" if not File.exists?(@exe_name)
59
62
 
60
63
  eTime = File.mtime(@exe_name)
61
-
62
- # config
63
- return "because config file has been changed" if eTime < File.mtime(@config.file_name)
64
- return "because DefaultToolchain has been changed" if eTime < Bake::Config.defaultToolchainTime
65
64
 
66
65
  # linkerscript
67
66
  if @linker_script
@@ -86,13 +85,20 @@ module Bake
86
85
  def execute
87
86
 
88
87
  Dir.chdir(@projectDir) do
88
+ return false if depHasError(@block)
89
89
 
90
90
  libs, linker_libs_array = LibElements.calc_linker_lib_string(@block, @tcs)
91
91
 
92
+ cmdLineCheck = false
93
+ cmdLineFile = calcCmdlineFile()
92
94
  reason = needed?(libs)
95
+ if not reason
96
+ cmdLineCheck = true
97
+ reason = config_changed?(cmdLineFile)
98
+ end
93
99
  return unless reason
94
100
 
95
- BlockBase.prepareOutput(@exe_name)
101
+
96
102
 
97
103
  linker = @tcs[:LINKER]
98
104
 
@@ -126,8 +132,13 @@ module Bake
126
132
  outPipe = (@mapfile and linker[:MAP_FILE_PIPE]) ? "#{@mapfile}" : nil
127
133
  cmdLinePrint << "> #{outPipe}" if outPipe
128
134
 
135
+ return if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
136
+
137
+ BlockBase.prepareOutput(@exe_name)
138
+
129
139
  printCmd(cmdLinePrint, "Linking #{@exe_name}", reason, false)
130
140
  success, consoleOutput = ProcessHelper.run(cmd, false, false, outPipe)
141
+ BlockBase.writeCmdLineFile(cmd, cmdLineFile) if success
131
142
  process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, reason, success)
132
143
 
133
144
  check_config_file()
@@ -17,6 +17,10 @@ module Bake
17
17
  @archive_name ||= File.join([@output_dir, "lib#{@projectName}.a"])
18
18
  end
19
19
 
20
+ def calcCmdlineFile()
21
+ archive_name + ".cmdline"
22
+ end
23
+
20
24
  def needed?
21
25
  return false if Bake.options.linkOnly
22
26
  return false if Bake.options.prepro
@@ -25,10 +29,6 @@ module Bake
25
29
  return "because library does not exist" if not File.exists?(archive_name)
26
30
 
27
31
  aTime = File.mtime(archive_name)
28
-
29
- # config
30
- return "because config file has been changed" if aTime < File.mtime(@config.file_name)
31
- return "because DefaultToolchain has been changed" if aTime < Bake::Config.defaultToolchainTime
32
32
 
33
33
  # sources
34
34
  @compileBlock.objects.each do |obj|
@@ -42,10 +42,15 @@ module Bake
42
42
  def execute
43
43
 
44
44
  Dir.chdir(@projectDir) do
45
+
46
+ cmdLineCheck = false
47
+ cmdLineFile = calcCmdlineFile()
45
48
  reason = needed?
49
+ if not reason
50
+ cmdLineCheck = true
51
+ reason = config_changed?(cmdLineFile)
52
+ end
46
53
  return unless reason
47
-
48
- BlockBase.prepareOutput(archive_name)
49
54
 
50
55
  archiver = @tcs[:ARCHIVER]
51
56
 
@@ -58,10 +63,15 @@ module Bake
58
63
  else
59
64
  cmd[cmd.length-1] += archive_name
60
65
  end
61
-
66
+
62
67
  cmd += @compileBlock.objects
68
+
69
+ return if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
70
+
71
+ BlockBase.prepareOutput(archive_name)
63
72
 
64
73
  success, consoleOutput = ProcessHelper.run(cmd, false, false)
74
+ BlockBase.writeCmdLineFile(cmd, cmdLineFile) if success
65
75
  process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{archive_name}", reason, success)
66
76
 
67
77
  check_config_file()
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.3.4"
4
+ "2.4.3"
5
5
  end
6
6
  end
7
7
 
data/lib/tocxx.rb CHANGED
@@ -225,11 +225,33 @@ module Bake
225
225
 
226
226
  if Bake.options.lint
227
227
  @defaultToolchain = Utils.deep_copy(Bake::Toolchain::Provider["Lint"])
228
- integrateToolchain(@defaultToolchain, @mainConfig.defaultToolchain)
229
228
  else
230
- @defaultToolchain = @loadedConfig.defaultToolchain
229
+ basedOn = @mainConfig.defaultToolchain.basedOn
230
+ basedOnToolchain = Bake::Toolchain::Provider[basedOn]
231
+ if basedOnToolchain.nil?
232
+ Bake.formatter.printError("DefaultToolchain based on unknown compiler '#{basedOn}'", config.defaultToolchain)
233
+ ExitHelper.exit(1)
234
+ end
235
+
236
+ # The flag "-FS" must only be set for VS2013 and above
237
+ ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = ""
238
+ if basedOn == "MSVC"
239
+ begin
240
+ res = `cl.exe 2>&1`
241
+ scan_res = res.scan(/ersion (\d+).(\d+).(\d+)/)
242
+ ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = "-FS" if scan_res.length > 0 and scan_res[0][0].to_i >= 18 # 18 is the compiler major version in VS2013
243
+ rescue Exception
244
+ end
245
+ end
246
+
247
+ @defaultToolchain = Utils.deep_copy(basedOnToolchain)
248
+ Bake.options.envToolchain = true if (basedOn.include?"_ENV")
231
249
  end
250
+ integrateToolchain(@defaultToolchain, @mainConfig.defaultToolchain)
232
251
 
252
+ # todo: cleanup this hack
253
+ Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
254
+
233
255
  createBaseTcsForConfig
234
256
  substVars
235
257
  createTcsForConfig
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.3.4
4
+ version: 2.4.3
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-03-12 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext
@@ -110,7 +110,7 @@ files:
110
110
  - lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb
111
111
  - lib/bake/toolchain/errorparser/ti_linker_error_parser.rb
112
112
  - lib/bake/toolchain/gcc.rb
113
- - lib/bake/toolchain/gcc_param.rb
113
+ - lib/bake/toolchain/gcc_env.rb
114
114
  - lib/bake/toolchain/greenhills.rb
115
115
  - lib/bake/toolchain/keil.rb
116
116
  - lib/bake/toolchain/lint.rb
@@ -1,7 +0,0 @@
1
- module Bake
2
- module Toolchain
3
-
4
-
5
-
6
- end
7
- end