bake-toolkit 2.32.0 → 2.33.0
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 +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
data/lib/blocks/compile.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'blocks/blockBase'
|
2
|
+
|
2
3
|
require 'multithread/job'
|
3
4
|
require 'common/process'
|
5
|
+
require 'common/ext/dir'
|
4
6
|
require 'common/utils'
|
5
7
|
require 'bake/toolchain/colorizing_formatter'
|
6
8
|
require 'bake/config/loader'
|
@@ -13,6 +15,10 @@ module Bake
|
|
13
15
|
|
14
16
|
attr_reader :objects, :include_list
|
15
17
|
|
18
|
+
def mutex
|
19
|
+
@mutex ||= Mutex.new
|
20
|
+
end
|
21
|
+
|
16
22
|
def initialize(block, config, referencedConfigs)
|
17
23
|
super(block, config, referencedConfigs)
|
18
24
|
@objects = []
|
@@ -41,47 +47,50 @@ module Bake
|
|
41
47
|
return "because analyzer toolchain is configured" if Bake.options.analyze
|
42
48
|
return "because prepro was specified and source is no assembler file" if Bake.options.prepro
|
43
49
|
|
44
|
-
|
45
|
-
|
50
|
+
Dir.mutex.synchronize do
|
51
|
+
Dir.chdir(@projectDir) do
|
52
|
+
return "because object does not exist" if not File.exist?(object)
|
53
|
+
oTime = File.mtime(object)
|
46
54
|
|
47
|
-
|
55
|
+
return "because source is newer than object" if oTime < File.mtime(source)
|
48
56
|
|
49
|
-
|
50
|
-
|
57
|
+
if type != :ASM
|
58
|
+
return "because dependency file does not exist" if not File.exist?(dep_filename_conv)
|
51
59
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
begin
|
61
|
+
File.readlines(dep_filename_conv).map{|line| line.strip}.each do |dep|
|
62
|
+
Thread.current[:filelist].add(File.expand_path(dep, @projectDir)) if Bake.options.filelist
|
63
|
+
|
64
|
+
if not File.exist?(dep)
|
65
|
+
# we need a hack here. with some windows configurations the compiler prints unix paths
|
66
|
+
# into the dep file which cannot be found easily. this will be true for system includes,
|
67
|
+
# e.g. /usr/lib/...xy.h
|
68
|
+
if (Bake::Utils::OS.windows? and dep.start_with?"/") or
|
69
|
+
(not Bake::Utils::OS.windows? and dep.length > 1 and dep[1] == ":")
|
70
|
+
puts "Dependency header file #{dep} ignored!" if Bake.options.debug
|
71
|
+
else
|
72
|
+
return "because dependent header #{dep} does not exist"
|
73
|
+
end
|
74
|
+
else
|
75
|
+
return "because dependent header #{dep} is newer than object" if oTime < File.mtime(dep)
|
76
|
+
end
|
65
77
|
end
|
66
|
-
|
67
|
-
|
78
|
+
rescue Exception => ex
|
79
|
+
if Bake.options.debug
|
80
|
+
puts "While reading #{dep_filename_conv}:"
|
81
|
+
puts ex.message
|
82
|
+
puts ex.backtrace
|
83
|
+
end
|
84
|
+
return "because dependency file could not be loaded"
|
68
85
|
end
|
69
86
|
end
|
70
|
-
rescue Exception => ex
|
71
|
-
if Bake.options.debug
|
72
|
-
puts "While reading #{dep_filename_conv}:"
|
73
|
-
puts ex.message
|
74
|
-
puts ex.backtrace
|
75
|
-
end
|
76
|
-
return "because dependency file could not be loaded"
|
77
87
|
end
|
78
88
|
end
|
79
|
-
|
80
|
-
false
|
89
|
+
return false
|
81
90
|
end
|
82
91
|
|
83
92
|
def calcCmdlineFile(object)
|
84
|
-
object[0..-3] + ".cmdline"
|
93
|
+
File.expand_path(object[0..-3] + ".cmdline", @projectDir)
|
85
94
|
end
|
86
95
|
|
87
96
|
def calcDepFile(object, type)
|
@@ -125,7 +134,7 @@ module Bake
|
|
125
134
|
reason = config_changed?(cmdLineFile)
|
126
135
|
end
|
127
136
|
|
128
|
-
Thread.current[:filelist].add(File.expand_path(source)) if Bake.options.filelist
|
137
|
+
Thread.current[:filelist].add(File.expand_path(source, @projectDir)) if Bake.options.filelist
|
129
138
|
|
130
139
|
if @fileTcs.include?(source)
|
131
140
|
compiler = @fileTcs[source][:COMPILER][type]
|
@@ -189,23 +198,26 @@ module Bake
|
|
189
198
|
end
|
190
199
|
|
191
200
|
if not (cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile))
|
192
|
-
BlockBase.prepareOutput(object)
|
201
|
+
BlockBase.prepareOutput(File.expand_path(object,@projectDir))
|
193
202
|
outputType = Bake.options.analyze ? "Analyzing" : (Bake.options.prepro ? "Preprocessing" : "Compiling")
|
194
|
-
printCmd(cmd, "#{outputType} #{source}", reason, false)
|
195
|
-
flushOutput()
|
203
|
+
printCmd(cmd, "#{outputType} #{@projectName} (#{@config.name}): #{source}", reason, false)
|
204
|
+
SyncOut.flushOutput()
|
196
205
|
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
197
206
|
|
198
207
|
success = true
|
199
208
|
consoleOutput = ""
|
200
|
-
success, consoleOutput = ProcessHelper.run(cmd, false, false) if !Bake.options.dry
|
209
|
+
success, consoleOutput = ProcessHelper.run(cmd, false, false, nil, [0], @projectDir) if !Bake.options.dry
|
201
210
|
incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], nil, reason, success)
|
202
|
-
|
203
211
|
if type != :ASM and not Bake.options.analyze and not Bake.options.prepro
|
204
|
-
|
205
|
-
|
212
|
+
Dir.mutex.synchronize do
|
213
|
+
Dir.chdir(@projectDir) do
|
214
|
+
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
|
215
|
+
Compile.write_depfile(incList, dep_filename_conv)
|
216
|
+
end
|
217
|
+
end
|
206
218
|
|
207
219
|
incList.each do |h|
|
208
|
-
Thread.current[:filelist].add(File.expand_path(h))
|
220
|
+
Thread.current[:filelist].add(File.expand_path(h, @projectDir))
|
209
221
|
end if Bake.options.filelist
|
210
222
|
end
|
211
223
|
check_config_file
|
@@ -264,72 +276,44 @@ module Bake
|
|
264
276
|
end
|
265
277
|
end
|
266
278
|
|
267
|
-
def mutex
|
268
|
-
@mutex ||= Mutex.new
|
269
|
-
end
|
270
|
-
|
271
|
-
def flushOutput
|
272
|
-
mutex.synchronize do
|
273
|
-
tmp = Thread.current[:stdout]
|
274
|
-
if tmp.string.length > 0
|
275
|
-
Thread.current[:stdout] = Thread.current[:tmpStdout]
|
276
|
-
puts tmp.string
|
277
|
-
tmp.reopen("")
|
278
|
-
Thread.current[:stdout] = tmp
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
|
284
279
|
def execute
|
285
|
-
Dir.chdir(@projectDir) do
|
280
|
+
#Dir.chdir(@projectDir) do
|
286
281
|
|
287
282
|
calcSources
|
288
283
|
calcObjects
|
289
284
|
|
290
|
-
@error_strings = {}
|
291
|
-
|
292
285
|
fileListBlock = Set.new if Bake.options.filelist
|
293
286
|
compileJobs = Multithread::Jobs.new(@source_files) do |jobs|
|
294
287
|
while source = jobs.get_next_or_nil do
|
295
288
|
|
296
|
-
if (jobs.failed and Bake.options.stopOnFirstError) or Bake::IDEInterface.instance.get_abort
|
289
|
+
if ((jobs.failed || !Blocks::Block.delayed_result) and Bake.options.stopOnFirstError) or Bake::IDEInterface.instance.get_abort
|
297
290
|
break
|
298
291
|
end
|
299
292
|
|
300
|
-
|
301
|
-
Thread.current[:tmpStdout] = Thread.current[:stdout]
|
302
|
-
Thread.current[:stdout] = s unless Thread.current[:tmpStdout]
|
303
|
-
Thread.current[:filelist] = Set.new if Bake.options.filelist
|
304
|
-
Thread.current[:lastCommand] = nil
|
305
|
-
|
306
|
-
result = false
|
293
|
+
SyncOut.startStream()
|
307
294
|
begin
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
295
|
+
Thread.current[:filelist] = Set.new if Bake.options.filelist
|
296
|
+
Thread.current[:lastCommand] = nil
|
297
|
+
|
298
|
+
result = false
|
299
|
+
begin
|
300
|
+
compileFile(source)
|
301
|
+
result = true
|
302
|
+
rescue Bake::SystemCommandFailed => scf # normal compilation error
|
303
|
+
rescue SystemExit => exSys
|
304
|
+
rescue Exception => ex1
|
305
|
+
if not Bake::IDEInterface.instance.get_abort
|
306
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
307
|
+
puts ex1.backtrace if Bake.options.debug
|
308
|
+
end
|
316
309
|
end
|
317
|
-
end
|
318
310
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
mutex.synchronize do
|
311
|
+
jobs.set_failed if not result
|
312
|
+
ensure
|
313
|
+
SyncOut.stopStream(result)
|
314
|
+
end
|
315
|
+
self.mutex.synchronize do
|
324
316
|
fileListBlock.merge(Thread.current[:filelist]) if Bake.options.filelist
|
325
|
-
|
326
|
-
if s.string.length > 0
|
327
|
-
if Bake.options.stopOnFirstError and not result
|
328
|
-
@error_strings[source] = s.string
|
329
|
-
else
|
330
|
-
puts s.string
|
331
|
-
end
|
332
|
-
end
|
333
317
|
end
|
334
318
|
|
335
319
|
end
|
@@ -339,8 +323,9 @@ module Bake
|
|
339
323
|
if Bake.options.filelist && !Bake.options.dry
|
340
324
|
Bake.options.filelist.merge(fileListBlock.merge(fileListBlock))
|
341
325
|
|
342
|
-
|
343
|
-
|
326
|
+
odir = File.expand_path(@block.output_dir, @projectDir)
|
327
|
+
FileUtils.mkdir_p(odir)
|
328
|
+
File.open(odir + "/" + "file-list.txt", 'wb') do |f|
|
344
329
|
fileListBlock.sort.each do |entry|
|
345
330
|
f.puts(entry)
|
346
331
|
end
|
@@ -348,16 +333,9 @@ module Bake
|
|
348
333
|
|
349
334
|
end
|
350
335
|
|
351
|
-
|
352
|
-
# can only happen in case of bail_on_first_error.
|
353
|
-
# if not sorted, it may be confusing when builing more than once and the order of the error appearances changes from build to build
|
354
|
-
# (it is not deterministic which file compilation finishes first)
|
355
|
-
@error_strings.sort.each {|es| puts es[1]}
|
356
|
-
|
357
336
|
raise SystemCommandFailed.new if compileJobs.failed
|
358
337
|
|
359
|
-
|
360
|
-
end
|
338
|
+
#end
|
361
339
|
return true
|
362
340
|
end
|
363
341
|
|
@@ -419,65 +397,64 @@ module Bake
|
|
419
397
|
|
420
398
|
def calcSources(cleaning = false, keep = false)
|
421
399
|
return @source_files if @source_files and not @source_files.empty?
|
422
|
-
|
423
|
-
@source_files = []
|
400
|
+
@source_files = []
|
424
401
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
402
|
+
exclude_files = Set.new
|
403
|
+
@config.excludeFiles.each do |p|
|
404
|
+
Dir.glob_dir(p.name, @projectDir).each {|f| exclude_files << f}
|
405
|
+
end
|
429
406
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
end
|
443
|
-
end
|
444
|
-
res.each do |f|
|
445
|
-
next if exclude_files.include?(f)
|
446
|
-
next if source_files.include?(f)
|
447
|
-
source_files << f
|
448
|
-
@source_files << f
|
407
|
+
source_files = Set.new
|
408
|
+
@config.files.each do |sources|
|
409
|
+
p = sources.name
|
410
|
+
p = p[2..-1] if p.start_with?"./"
|
411
|
+
|
412
|
+
res = Dir.glob_dir(p, @projectDir).sort
|
413
|
+
if res.length == 0 and cleaning == false
|
414
|
+
if not p.include?"*" and not p.include?"?"
|
415
|
+
Bake.formatter.printError("Source file '#{p}' not found", sources)
|
416
|
+
raise SystemCommandFailed.new
|
417
|
+
elsif Bake.options.verbose >= 1
|
418
|
+
Bake.formatter.printInfo("Source file pattern '#{p}' does not match to any file", sources)
|
449
419
|
end
|
450
420
|
end
|
421
|
+
res.each do |f|
|
422
|
+
next if exclude_files.include?(f)
|
423
|
+
next if source_files.include?(f)
|
424
|
+
source_files << f
|
425
|
+
@source_files << f
|
426
|
+
end
|
427
|
+
end
|
451
428
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
end
|
429
|
+
if Bake.options.filename
|
430
|
+
@source_files.keep_if do |source|
|
431
|
+
source.include?Bake.options.filename
|
432
|
+
end
|
433
|
+
if @source_files.length == 0 and cleaning == false and @config.files.length > 0
|
434
|
+
Bake.formatter.printInfo("#{Bake.options.filename} does not match to any source", @config)
|
459
435
|
end
|
436
|
+
end
|
460
437
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
end
|
438
|
+
if Bake.options.eclipseOrder # directories reverse order, files in directories in alphabetical order
|
439
|
+
dirs = []
|
440
|
+
filemap = {}
|
441
|
+
@source_files.sort.reverse.each do |o|
|
442
|
+
d = File.dirname(o)
|
443
|
+
if filemap.include?(d)
|
444
|
+
filemap[d] << o
|
445
|
+
else
|
446
|
+
filemap[d] = [o]
|
447
|
+
dirs << d
|
472
448
|
end
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
449
|
+
end
|
450
|
+
@source_files = []
|
451
|
+
dirs.each do |d|
|
452
|
+
filemap[d].reverse.each do |f|
|
453
|
+
@source_files << f
|
478
454
|
end
|
479
455
|
end
|
480
456
|
end
|
457
|
+
|
481
458
|
@source_files
|
482
459
|
end
|
483
460
|
|
data/lib/blocks/executable.rb
CHANGED
@@ -153,7 +153,7 @@ module Bake
|
|
153
153
|
|
154
154
|
BlockBase.prepareOutput(@exe_name)
|
155
155
|
|
156
|
-
printCmd(cmdLinePrint, "Linking #{@exe_name}", reason, false)
|
156
|
+
printCmd(cmdLinePrint, "Linking #{@projectName} (#{@config.name}): #{@exe_name}", reason, false)
|
157
157
|
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
158
158
|
success = true
|
159
159
|
consoleOutput = ""
|
data/lib/blocks/library.rb
CHANGED
@@ -1,132 +1,148 @@
|
|
1
|
-
require 'blocks/blockBase'
|
2
|
-
|
3
|
-
module Bake
|
4
|
-
|
5
|
-
module Blocks
|
6
|
-
|
7
|
-
class Library < BlockBase
|
8
|
-
|
9
|
-
attr_reader :compileBlock, :archive_name
|
10
|
-
|
11
|
-
def initialize(block, config, referencedConfigs, compileBlock)
|
12
|
-
super(block,config, referencedConfigs)
|
13
|
-
@compileBlock = compileBlock
|
14
|
-
|
15
|
-
block.set_library(self)
|
16
|
-
|
17
|
-
calcArtifactName
|
18
|
-
end
|
19
|
-
|
20
|
-
def calcArtifactName
|
21
|
-
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
22
|
-
baseFilename = @config.artifactName.name
|
23
|
-
else
|
24
|
-
baseFilename = "lib#{@projectName}.a"
|
25
|
-
end
|
26
|
-
@archive_name ||= File.join([@block.output_dir, baseFilename])
|
27
|
-
end
|
28
|
-
|
29
|
-
def calcCmdlineFile()
|
30
|
-
@archive_name + ".cmdline"
|
31
|
-
end
|
32
|
-
|
33
|
-
def ignore?
|
34
|
-
Bake.options.linkOnly or Bake.options.prepro
|
35
|
-
end
|
36
|
-
|
37
|
-
def needed?
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
success
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
return
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
|
1
|
+
require 'blocks/blockBase'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
|
5
|
+
module Blocks
|
6
|
+
|
7
|
+
class Library < BlockBase
|
8
|
+
|
9
|
+
attr_reader :compileBlock, :archive_name
|
10
|
+
|
11
|
+
def initialize(block, config, referencedConfigs, compileBlock)
|
12
|
+
super(block,config, referencedConfigs)
|
13
|
+
@compileBlock = compileBlock
|
14
|
+
|
15
|
+
block.set_library(self)
|
16
|
+
|
17
|
+
calcArtifactName
|
18
|
+
end
|
19
|
+
|
20
|
+
def calcArtifactName
|
21
|
+
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
22
|
+
baseFilename = @config.artifactName.name
|
23
|
+
else
|
24
|
+
baseFilename = "lib#{@projectName}.a"
|
25
|
+
end
|
26
|
+
@archive_name ||= File.join([@block.output_dir, baseFilename])
|
27
|
+
end
|
28
|
+
|
29
|
+
def calcCmdlineFile()
|
30
|
+
File.expand_path(@archive_name + ".cmdline", @projectDir)
|
31
|
+
end
|
32
|
+
|
33
|
+
def ignore?
|
34
|
+
Bake.options.linkOnly or Bake.options.prepro
|
35
|
+
end
|
36
|
+
|
37
|
+
def needed?
|
38
|
+
Dir.mutex.synchronize do
|
39
|
+
Dir.chdir(@projectDir) do
|
40
|
+
# lib
|
41
|
+
return "because library does not exist" if not File.exists?(@archive_name)
|
42
|
+
|
43
|
+
aTime = File.mtime(@archive_name)
|
44
|
+
|
45
|
+
# sources
|
46
|
+
@objects.each do |obj|
|
47
|
+
return "because object #{obj} does not exist" if not File.exists?(obj)
|
48
|
+
return "because object #{obj} is newer than executable" if aTime < File.mtime(obj)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
|
55
|
+
def execute
|
56
|
+
|
57
|
+
#Dir.chdir(@projectDir) do
|
58
|
+
|
59
|
+
@objects = @compileBlock.objects
|
60
|
+
if !@block.prebuild
|
61
|
+
if @objects.empty?
|
62
|
+
SyncOut.mutex.synchronize do
|
63
|
+
puts "No source files, library won't be created" if Bake.options.verbose >= 2
|
64
|
+
end
|
65
|
+
return true
|
66
|
+
end
|
67
|
+
else
|
68
|
+
@objects = Dir.glob_dir("#{@block.output_dir}/**/*.o", @projectDir)
|
69
|
+
if @objects.empty?
|
70
|
+
if !File.exists?(File.expand_path(@archive_name, @projectDir))
|
71
|
+
SyncOut.mutex.synchronize do
|
72
|
+
puts "No object files, library won't be created" if Bake.options.verbose >= 2
|
73
|
+
end
|
74
|
+
end
|
75
|
+
return true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
cmdLineCheck = false
|
80
|
+
cmdLineFile = calcCmdlineFile()
|
81
|
+
|
82
|
+
return true if ignore?
|
83
|
+
reason = needed?
|
84
|
+
if not reason
|
85
|
+
cmdLineCheck = true
|
86
|
+
reason = config_changed?(cmdLineFile)
|
87
|
+
end
|
88
|
+
archiver = @block.tcs[:ARCHIVER]
|
89
|
+
|
90
|
+
cmd = Utils.flagSplit(archiver[:PREFIX], false)
|
91
|
+
cmd += Utils.flagSplit(archiver[:COMMAND], false) # ar
|
92
|
+
cmd += Bake::Utils::flagSplit(archiver[:FLAGS],true) # --all_load
|
93
|
+
cmd += archiver[:ARCHIVE_FLAGS].split(" ")
|
94
|
+
|
95
|
+
if archiver[:ARCHIVE_FLAGS_SPACE]
|
96
|
+
cmd << @archive_name
|
97
|
+
else
|
98
|
+
cmd[cmd.length-1] += @archive_name
|
99
|
+
end
|
100
|
+
|
101
|
+
cmd += @objects
|
102
|
+
|
103
|
+
if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
|
104
|
+
success = true
|
105
|
+
else
|
106
|
+
SyncOut.startStream()
|
107
|
+
|
108
|
+
begin
|
109
|
+
success = true
|
110
|
+
BlockBase.prepareOutput(File.expand_path(@archive_name, @projectDir))
|
111
|
+
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
112
|
+
consoleOutput = ""
|
113
|
+
|
114
|
+
printCmd(cmd, "Creating #{@projectName} (#{@config.name}): #{@archive_name}", reason, false)
|
115
|
+
SyncOut.flushOutput()
|
116
|
+
|
117
|
+
success, consoleOutput = ProcessHelper.run(cmd, false, false, nil, [0], @projectDir) if !Bake.options.dry
|
118
|
+
process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], nil, reason, success)
|
119
|
+
|
120
|
+
check_config_file()
|
121
|
+
ensure
|
122
|
+
SyncOut.stopStream(success)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
return success
|
127
|
+
#end
|
128
|
+
end
|
129
|
+
|
130
|
+
def clean
|
131
|
+
if @block.prebuild
|
132
|
+
Dir.chdir(@projectDir) do
|
133
|
+
@objects = Dir.glob_dir("#{@block.output_dir}/**/*.o", @projectDir)
|
134
|
+
if !@objects.empty? && File.exist?(@archive_name)
|
135
|
+
puts "Deleting file #{@archive_name}" if Bake.options.verbose >= 2
|
136
|
+
if !Bake.options.dry
|
137
|
+
FileUtils.rm_rf(@archive_name)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else
|
142
|
+
return cleanProjectDir()
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
132
148
|
end
|