bake-toolkit 2.32.0 → 2.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -40
- data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -35
- data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -32
- data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -40
- data/lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb +63 -63
- data/lib/bake/toolchain/errorparser/tasking_compiler_error_parser.rb +31 -31
- data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -30
- data/lib/blocks/block.rb +121 -22
- data/lib/blocks/blockBase.rb +206 -205
- data/lib/blocks/compile.rb +124 -147
- data/lib/blocks/executable.rb +1 -1
- data/lib/blocks/library.rb +147 -131
- data/lib/common/cleanup.rb +14 -10
- data/lib/common/ext/dir.rb +19 -0
- data/lib/common/ext/stdout.rb +95 -45
- data/lib/common/process.rb +64 -64
- data/lib/common/version.rb +1 -1
- data/lib/multithread/job.rb +73 -44
- data/lib/tocxx.rb +13 -2
- metadata +3 -2
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'bake/toolchain/errorparser/error_parser'
|
2
|
-
|
3
|
-
module Bake
|
4
|
-
class TICompilerErrorParser < ErrorParser
|
5
|
-
|
6
|
-
def initialize()
|
7
|
-
@error_expression = /\"([^,^\"]+)\", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z]+): (.+)/
|
8
|
-
end
|
9
|
-
|
10
|
-
def scan_lines(consoleOutput, proj_dir)
|
11
|
-
res = []
|
12
|
-
consoleOutputFullnames = ""
|
13
|
-
consoleOutput[0].each_line do |l|
|
14
|
-
d = ErrorDesc.new
|
15
|
-
scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
|
16
|
-
if scan_res.length > 0
|
17
|
-
d.file_name = File.expand_path(scan_res[0][0])
|
18
|
-
d.line_number = scan_res[0][1].to_i
|
19
|
-
d.message = scan_res[0][4]
|
20
|
-
d.severity = get_severity(scan_res[0][3])
|
21
|
-
l.gsub!(scan_res[0][0],d.file_name)
|
22
|
-
end
|
23
|
-
res << d
|
24
|
-
consoleOutputFullnames << l
|
25
|
-
end
|
26
|
-
[res, consoleOutputFullnames]
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'bake/toolchain/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
class TICompilerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@error_expression = /\"([^,^\"]+)\", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z]+): (.+)/
|
8
|
+
end
|
9
|
+
|
10
|
+
def scan_lines(consoleOutput, proj_dir)
|
11
|
+
res = []
|
12
|
+
consoleOutputFullnames = ""
|
13
|
+
consoleOutput[0].each_line do |l|
|
14
|
+
d = ErrorDesc.new
|
15
|
+
scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
|
16
|
+
if scan_res.length > 0
|
17
|
+
d.file_name = File.expand_path(scan_res[0][0], proj_dir)
|
18
|
+
d.line_number = scan_res[0][1].to_i
|
19
|
+
d.message = scan_res[0][4]
|
20
|
+
d.severity = get_severity(scan_res[0][3])
|
21
|
+
l.gsub!(scan_res[0][0],d.file_name)
|
22
|
+
end
|
23
|
+
res << d
|
24
|
+
consoleOutputFullnames << l
|
25
|
+
end
|
26
|
+
[res, consoleOutputFullnames]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/blocks/block.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'bake/libElement'
|
2
2
|
require 'bake/model/metamodel'
|
3
3
|
require 'common/abortException'
|
4
|
+
require "multithread/job"
|
5
|
+
require "thwait"
|
4
6
|
|
5
7
|
module Bake
|
6
8
|
|
@@ -16,6 +18,10 @@ module Bake
|
|
16
18
|
|
17
19
|
class Block
|
18
20
|
|
21
|
+
@@block_counter = 0
|
22
|
+
@@delayed_result = true
|
23
|
+
@@threads = []
|
24
|
+
|
19
25
|
attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :prebuild, :output_dir, :tcs
|
20
26
|
attr_accessor :visited, :inDeps, :result
|
21
27
|
|
@@ -73,7 +79,6 @@ module Bake
|
|
73
79
|
@projectName = config.parent.name
|
74
80
|
@configName = config.name
|
75
81
|
@projectDir = config.get_project_dir
|
76
|
-
@@block_counter = 0
|
77
82
|
@result = true
|
78
83
|
@tcs = tcs
|
79
84
|
|
@@ -99,7 +104,9 @@ module Bake
|
|
99
104
|
inc = d.split("/")
|
100
105
|
if (inc[0] == "..") # very simple check, but should be okay for 99.9 % of the cases
|
101
106
|
if elem and Bake.options.verbose >= 2
|
102
|
-
|
107
|
+
SyncOut.mutex.synchronize do
|
108
|
+
Bake.formatter.printInfo("path starts with \"..\"", elem)
|
109
|
+
end
|
103
110
|
end
|
104
111
|
end
|
105
112
|
|
@@ -138,9 +145,11 @@ module Bake
|
|
138
145
|
|
139
146
|
if warnIfLocal && res.length > 1
|
140
147
|
if elem and Bake.options.verbose >= 2
|
141
|
-
|
142
|
-
|
143
|
-
|
148
|
+
SyncOut.mutex.synchronize do
|
149
|
+
Bake.formatter.printInfo("#{d} matches several paths:", elem)
|
150
|
+
puts " #{res[0]} (chosen)"
|
151
|
+
res[1..-1].each { |r| puts " #{r}" }
|
152
|
+
end
|
144
153
|
end
|
145
154
|
end
|
146
155
|
|
@@ -159,6 +168,18 @@ module Bake
|
|
159
168
|
@@block_counter = 0
|
160
169
|
end
|
161
170
|
|
171
|
+
def self.reset_delayed_result
|
172
|
+
@@delayed_result = true
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.delayed_result
|
176
|
+
@@delayed_result
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.threads
|
180
|
+
@@threads
|
181
|
+
end
|
182
|
+
|
162
183
|
def calcIsBuildBlock
|
163
184
|
@startupSteps ||= []
|
164
185
|
|
@@ -207,8 +228,10 @@ module Bake
|
|
207
228
|
rescue Exception => ex1
|
208
229
|
@result = false
|
209
230
|
if not Bake::IDEInterface.instance.get_abort
|
210
|
-
|
211
|
-
|
231
|
+
SyncOut.mutex.synchronize do
|
232
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
233
|
+
puts ex1.backtrace if Bake.options.debug
|
234
|
+
end
|
212
235
|
end
|
213
236
|
end
|
214
237
|
|
@@ -248,26 +271,88 @@ module Bake
|
|
248
271
|
return depResult
|
249
272
|
end
|
250
273
|
|
274
|
+
def execute_in_thread(method)
|
275
|
+
if method == :execute
|
276
|
+
@@mutex.synchronize do
|
277
|
+
if @@threads.length == Bake.options.threads
|
278
|
+
endedThread = ThreadsWait.new(@@threads).next_wait
|
279
|
+
@@threads.delete(endedThread)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
thread = Thread.new() {
|
283
|
+
|
284
|
+
exceptionOccured = false
|
285
|
+
begin
|
286
|
+
yield
|
287
|
+
exceptionOccured = true
|
288
|
+
rescue Bake::SystemCommandFailed => scf # normal compilation error
|
289
|
+
rescue SystemExit => exSys
|
290
|
+
rescue Exception => ex1
|
291
|
+
if not Bake::IDEInterface.instance.get_abort
|
292
|
+
SyncOut.mutex.synchronize do
|
293
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
294
|
+
puts ex1.backtrace if Bake.options.debug
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
if !exceptionOccured
|
299
|
+
@result = false
|
300
|
+
@@delayed_result = false
|
301
|
+
end
|
302
|
+
}
|
303
|
+
@@mutex.synchronize do
|
304
|
+
@@threads << thread
|
305
|
+
end
|
306
|
+
else
|
307
|
+
yield
|
308
|
+
end
|
309
|
+
raise AbortException.new if Bake::IDEInterface.instance.get_abort
|
310
|
+
end
|
311
|
+
|
312
|
+
def blockAbort?(res)
|
313
|
+
((not res) || !@@delayed_result) and Bake.options.stopOnFirstError or Bake::IDEInterface.instance.get_abort
|
314
|
+
end
|
315
|
+
|
251
316
|
def callSteps(method)
|
252
317
|
|
253
318
|
@config.writeEnvVars()
|
254
319
|
Thread.current[:lastCommand] = nil
|
255
320
|
|
256
321
|
preSteps.each do |step|
|
322
|
+
ThreadsWait.all_waits(Blocks::Block::threads)
|
257
323
|
@result = executeStep(step, method) if @result
|
258
|
-
return false if
|
324
|
+
return false if blockAbort?(@result)
|
259
325
|
end unless @prebuild
|
260
326
|
|
261
|
-
mainSteps.
|
327
|
+
threadableSteps = mainSteps.select { |step| method == :execute && (Library === step || Compile === step) }
|
328
|
+
nonThreadableSteps = mainSteps.select { |step| method != :execute || !(Library === step || Compile === step) }
|
329
|
+
|
330
|
+
execute_in_thread(method) {
|
331
|
+
threadableSteps.each do |step|
|
332
|
+
if !@prebuild || (Library === step)
|
333
|
+
Multithread::Jobs.incThread() if Library === step
|
334
|
+
begin
|
335
|
+
@result = executeStep(step, method) if @result
|
336
|
+
ensure
|
337
|
+
Multithread::Jobs.decThread() if Library === step
|
338
|
+
end
|
339
|
+
@@delayed_result &&= @result
|
340
|
+
end
|
341
|
+
break if blockAbort?(@result)
|
342
|
+
end
|
343
|
+
} if !threadableSteps.empty?
|
344
|
+
nonThreadableSteps.each do |step|
|
262
345
|
if !@prebuild || (Library === step)
|
346
|
+
ThreadsWait.all_waits(Blocks::Block::threads)
|
263
347
|
@result = executeStep(step, method) if @result
|
264
348
|
end
|
265
|
-
return false if
|
349
|
+
return false if blockAbort?(@result)
|
266
350
|
end
|
267
351
|
|
268
352
|
postSteps.each do |step|
|
353
|
+
ThreadsWait.all_waits(Blocks::Block::threads)
|
269
354
|
@result = executeStep(step, method) if @result
|
270
|
-
return false if
|
355
|
+
return false if blockAbort?(@result)
|
271
356
|
end unless @prebuild
|
272
357
|
|
273
358
|
return @result
|
@@ -276,7 +361,9 @@ module Bake
|
|
276
361
|
def execute
|
277
362
|
if (@inDeps)
|
278
363
|
if Bake.options.verbose >= 3
|
279
|
-
|
364
|
+
SyncOut.mutex.synchronize do
|
365
|
+
Bake.formatter.printWarning("While calculating next config, a circular dependency was found including project #{@projectName} with config #{@configName}", @config)
|
366
|
+
end
|
280
367
|
end
|
281
368
|
return true
|
282
369
|
end
|
@@ -287,21 +374,23 @@ module Bake
|
|
287
374
|
@inDeps = true
|
288
375
|
depResult = callDeps(:execute)
|
289
376
|
@inDeps = false
|
290
|
-
return false if
|
377
|
+
return false if blockAbort?(depResult)
|
291
378
|
|
292
379
|
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
293
380
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
381
|
+
SyncOut.mutex.synchronize do
|
382
|
+
if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
|
383
|
+
typeStr = "Building"
|
384
|
+
if @prebuild
|
385
|
+
typeStr = "Using"
|
386
|
+
elsif not isBuildBlock?
|
387
|
+
typeStr = "Applying"
|
388
|
+
end
|
389
|
+
Block.inc_block_counter()
|
390
|
+
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
300
391
|
end
|
301
|
-
|
302
|
-
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
392
|
+
puts "Project path: #{@projectDir}" if Bake.options.projectPaths
|
303
393
|
end
|
304
|
-
puts "Project path: #{@projectDir}" if Bake.options.projectPaths
|
305
394
|
|
306
395
|
@result = callSteps(:execute)
|
307
396
|
return (depResult && @result)
|
@@ -315,6 +404,10 @@ module Bake
|
|
315
404
|
return false if not depResult and Bake.options.stopOnFirstError
|
316
405
|
|
317
406
|
if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
|
407
|
+
Block.inc_block_counter()
|
408
|
+
end
|
409
|
+
|
410
|
+
if Bake.options.verbose >= 2
|
318
411
|
typeStr = "Cleaning"
|
319
412
|
if @prebuild
|
320
413
|
typeStr = "Checking"
|
@@ -346,6 +439,12 @@ module Bake
|
|
346
439
|
return (depResult && @result)
|
347
440
|
end
|
348
441
|
|
442
|
+
def self.init_threads()
|
443
|
+
@@threads = []
|
444
|
+
@@result = true
|
445
|
+
@@mutex = Mutex.new
|
446
|
+
end
|
447
|
+
|
349
448
|
def startup
|
350
449
|
return true if (@visited)
|
351
450
|
@visited = true
|
data/lib/blocks/blockBase.rb
CHANGED
@@ -1,205 +1,206 @@
|
|
1
|
-
module Bake
|
2
|
-
module Blocks
|
3
|
-
|
4
|
-
class BlockBase
|
5
|
-
|
6
|
-
attr_reader :projectDir, :block
|
7
|
-
|
8
|
-
def initialize(block, config, referencedConfigs)
|
9
|
-
@block = block
|
10
|
-
@config = config
|
11
|
-
@referencedConfigs = referencedConfigs
|
12
|
-
@projectName = config.parent.name
|
13
|
-
@projectDir = config.get_project_dir
|
14
|
-
@config_date = Time.now
|
15
|
-
end
|
16
|
-
|
17
|
-
def check_config_file()
|
18
|
-
if File.exists?(@config.file_name) and File.mtime(@config.file_name) > @config_date
|
19
|
-
begin
|
20
|
-
FileUtils.touch(@config.file_name) if !Bake.options.dry
|
21
|
-
rescue Exception=>e
|
22
|
-
if Bake.options.verbose >= 2
|
23
|
-
Bake.formatter.printWarning("Could not touch #{@config.file_name}: #{e.message}", @config.file_name)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.prepareOutput(filename)
|
30
|
-
return if Bake.options.dry
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
puts e.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
return "because
|
54
|
-
return "because
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
puts e.
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
puts e.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if Bake.options.verbose >=
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
console_output =
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
Bake.formatter.printWarning("
|
154
|
-
Bake.formatter.printWarning(
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
if
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
if
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
1
|
+
module Bake
|
2
|
+
module Blocks
|
3
|
+
|
4
|
+
class BlockBase
|
5
|
+
|
6
|
+
attr_reader :projectDir, :block
|
7
|
+
|
8
|
+
def initialize(block, config, referencedConfigs)
|
9
|
+
@block = block
|
10
|
+
@config = config
|
11
|
+
@referencedConfigs = referencedConfigs
|
12
|
+
@projectName = config.parent.name
|
13
|
+
@projectDir = config.get_project_dir
|
14
|
+
@config_date = Time.now
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_config_file()
|
18
|
+
if File.exists?(@config.file_name) and File.mtime(@config.file_name) > @config_date
|
19
|
+
begin
|
20
|
+
FileUtils.touch(@config.file_name) if !Bake.options.dry
|
21
|
+
rescue Exception=>e
|
22
|
+
if Bake.options.verbose >= 2
|
23
|
+
Bake.formatter.printWarning("Could not touch #{@config.file_name}: #{e.message}", @config.file_name)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.prepareOutput(filename)
|
30
|
+
return if Bake.options.dry
|
31
|
+
filename = File.expand_path(filename, @projectDir)
|
32
|
+
begin
|
33
|
+
if File.exists?(filename)
|
34
|
+
FileUtils.rm(filename)
|
35
|
+
else
|
36
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
37
|
+
end
|
38
|
+
rescue Exception => e
|
39
|
+
if Bake.options.debug
|
40
|
+
puts e.message
|
41
|
+
puts e.backtrace
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def defaultToolchainTime
|
47
|
+
@defaultToolchainTime ||= File.mtime(Bake.options.main_dir+"/Project.meta")
|
48
|
+
end
|
49
|
+
|
50
|
+
def config_changed?(cmdLineFile)
|
51
|
+
return "because command line file does not exist" if not File.exist?(cmdLineFile)
|
52
|
+
cmdTime = File.mtime(cmdLineFile)
|
53
|
+
return "because config file has been changed" if cmdTime < File.mtime(@config.file_name)
|
54
|
+
return "because DefaultToolchain has been changed" if cmdTime < defaultToolchainTime
|
55
|
+
return "because command line has been changed"
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.isCmdLineEqual?(cmd, cmdLineFile)
|
59
|
+
begin
|
60
|
+
if File.exist?cmdLineFile
|
61
|
+
lastCmdLineArray = File.readlines(cmdLineFile)[0];
|
62
|
+
if lastCmdLineArray == cmd.join(" ")
|
63
|
+
FileUtils.touch(cmdLineFile) if !Bake.options.dry
|
64
|
+
return true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
rescue Exception => e
|
68
|
+
if Bake.options.debug
|
69
|
+
puts e.message
|
70
|
+
puts e.backtrace
|
71
|
+
end
|
72
|
+
end
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.writeCmdLineFile(cmd, cmdLineFile)
|
77
|
+
begin
|
78
|
+
if !Bake.options.dry
|
79
|
+
File.open(cmdLineFile, 'w') { |f| f.write(cmd.join(" ")) }
|
80
|
+
end
|
81
|
+
rescue Exception => e
|
82
|
+
if Bake.options.debug
|
83
|
+
puts e.message
|
84
|
+
puts e.backtrace
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def printCmd(cmd, alternate, reason, forceVerbose)
|
90
|
+
if (cmd == Thread.current[:lastCommand])
|
91
|
+
if (Bake.options.verbose >= 2 or (Thread.current[:printedCmdAlternate] and not forceVerbose))
|
92
|
+
return
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
Thread.current[:lastCommand] = cmd
|
97
|
+
|
98
|
+
return if Bake.options.verbose == 0 and not forceVerbose
|
99
|
+
|
100
|
+
if forceVerbose or Bake.options.verbose >= 2 or not alternate
|
101
|
+
Thread.current[:printedCmdAlternate] = false
|
102
|
+
puts "" if Bake.options.verbose >= 2 # for A.K. :-)
|
103
|
+
if Bake.options.verbose >= 3
|
104
|
+
exedIn = "\n(executed in '#{@projectDir}')"
|
105
|
+
because = reason ? "\n(#{reason})" : ""
|
106
|
+
else
|
107
|
+
exedIn = ""
|
108
|
+
because = ""
|
109
|
+
end
|
110
|
+
|
111
|
+
if cmd.is_a?(Array)
|
112
|
+
puts cmd.join(' ') + exedIn + because
|
113
|
+
else
|
114
|
+
puts cmd + exedIn + because
|
115
|
+
end
|
116
|
+
else
|
117
|
+
Thread.current[:printedCmdAlternate] = true
|
118
|
+
puts alternate
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
def process_console_output(console_output, error_parser)
|
124
|
+
ret = false
|
125
|
+
incList = nil
|
126
|
+
#if not console_output.empty?
|
127
|
+
if error_parser
|
128
|
+
begin
|
129
|
+
x = [console_output]
|
130
|
+
error_descs, console_output_full, incList = error_parser.scan_lines(x, @projectDir)
|
131
|
+
|
132
|
+
console_output = x[0]
|
133
|
+
console_output = console_output_full if Bake.options.consoleOutput_fullnames
|
134
|
+
|
135
|
+
if Bake.options.consoleOutput_visualStudio
|
136
|
+
console_output_VS = ""
|
137
|
+
descCounter = 0
|
138
|
+
console_output.each_line do |l|
|
139
|
+
d = error_descs[descCounter]
|
140
|
+
console_output_VS << error_parser.makeVsError(l.rstrip, d) << "\n"
|
141
|
+
descCounter = descCounter + 1
|
142
|
+
end
|
143
|
+
console_output = console_output_VS
|
144
|
+
end
|
145
|
+
|
146
|
+
ret = error_descs.any? { |e| e.severity == ErrorParser::SEVERITY_ERROR }
|
147
|
+
|
148
|
+
console_output.gsub!(/[\r]/, "")
|
149
|
+
Bake.formatter.format(console_output, error_descs, error_parser) unless console_output.empty?
|
150
|
+
|
151
|
+
Bake::IDEInterface.instance.set_errors(error_descs)
|
152
|
+
rescue Exception => e
|
153
|
+
Bake.formatter.printWarning("Parsing output failed (maybe language not set to English?): " + e.message)
|
154
|
+
Bake.formatter.printWarning("Original output:")
|
155
|
+
Bake.formatter.printWarning(console_output)
|
156
|
+
raise e
|
157
|
+
end
|
158
|
+
else
|
159
|
+
puts console_output # fallback
|
160
|
+
end
|
161
|
+
#end
|
162
|
+
[ret, incList]
|
163
|
+
end
|
164
|
+
|
165
|
+
def process_result(cmd, console_output, error_parser, alternate, reason, success)
|
166
|
+
hasError = (success == false)
|
167
|
+
printCmd(cmd, alternate, reason, hasError)
|
168
|
+
errorPrinted, incList = process_console_output(console_output, error_parser)
|
169
|
+
if hasError and not errorPrinted
|
170
|
+
Bake.formatter.printError("System command failed", @projectDir)
|
171
|
+
end
|
172
|
+
if hasError or (Bake.options.wparse and errorPrinted)
|
173
|
+
raise SystemCommandFailed.new
|
174
|
+
end
|
175
|
+
incList
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
def cleanProjectDir
|
180
|
+
if !Bake.options.filename
|
181
|
+
Dir.chdir(@projectDir) do
|
182
|
+
if File.exist?@block.output_dir
|
183
|
+
puts "Deleting folder #{@block.output_dir}" if Bake.options.verbose >= 2
|
184
|
+
if !Bake.options.dry
|
185
|
+
FileUtils.rm_rf(@block.output_dir)
|
186
|
+
end
|
187
|
+
|
188
|
+
if (@block.tcs[:OUTPUT_DIR] == nil) && (Bake.options.buildDirDelimiter == "/") # in this case all builds are placed in a "build" folder
|
189
|
+
buildDir = File.dirname(@block.output_dir)
|
190
|
+
if (File.basename(buildDir) == "build") && (Dir.entries(buildDir).size == 2)# double check if it's really "build" and check if it's empty (except "." and "..")
|
191
|
+
puts "Deleting folder #{buildDir}" if Bake.options.verbose >= 2
|
192
|
+
if !Bake.options.dry
|
193
|
+
FileUtils.rm_rf(buildDir)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
return true
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|