bake-toolkit 2.31.0 → 2.31.2
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/options/showDoc.rb +8 -5
- data/lib/bake/toolchain/errorparser/error_parser.rb +6 -0
- data/lib/bake/toolchain/errorparser/tasking_compiler_error_parser.rb +31 -0
- data/lib/bake/toolchain/errorparser/tasking_linker_error_parser.rb +28 -0
- data/lib/bake/toolchain/provider.rb +2 -0
- data/lib/bake/toolchain/tasking.rb +55 -0
- data/lib/blocks/block.rb +1 -0
- data/lib/blocks/blockBase.rb +5 -8
- data/lib/blocks/compile.rb +32 -8
- data/lib/blocks/executable.rb +175 -169
- data/lib/common/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d4c90f1806dd4419c84066cccc6baac0f7f0239
|
4
|
+
data.tar.gz: 86d52706bbfa8461f352319416ce055179529955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51c7d5cd389a6dde533f73bd67d6677fcc6a29e0e427702f40f7f0439ff6a68fa69c3b7ee38515b73dfba4ca034699cffa4006f0239a571395df3792b363074
|
7
|
+
data.tar.gz: 8d0396add934e717654ee9b218d9e7cf1338feac4e2b0e66e589f2f91c4c08601dfff9b781620c830901cceec3345c7f6cddae55974fb0c03248eebd5c34b544
|
data/lib/bake/options/showDoc.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require "open-uri"
|
2
2
|
require "fileutils"
|
3
|
+
require "common/version"
|
4
|
+
require "openssl"
|
3
5
|
|
4
6
|
module Bake
|
5
7
|
class Doc
|
6
8
|
def self.show
|
7
|
-
if File.exist?(File.dirname(__FILE__)+"/../../../
|
8
|
-
link = File.expand_path(File.dirname(__FILE__)+"/../../../
|
9
|
+
if File.exist?(File.dirname(__FILE__)+"/../../../docs/index.html")
|
10
|
+
link = File.expand_path(File.dirname(__FILE__)+"/../../../docs/index.html")
|
9
11
|
else
|
10
12
|
link = "http://esrlabs.github.io/bake"
|
11
13
|
end
|
@@ -24,10 +26,11 @@ module Bake
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.install
|
27
|
-
|
29
|
+
|
30
|
+
docuSource = "https://raw.githubusercontent.com/esrlabs/bake/$(Bake::Version.number)/docs/"
|
28
31
|
docuTarget = File.dirname(__FILE__)+"/../../../doc/"
|
29
32
|
begin
|
30
|
-
f = open(docuSource+"files.txt")
|
33
|
+
f = open(docuSource+"files.txt", {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE})
|
31
34
|
rescue OpenURI::HTTPError => e
|
32
35
|
puts "Could not open #{docuSource}files.txt"
|
33
36
|
ExitHelper.exit(0)
|
@@ -35,7 +38,7 @@ module Bake
|
|
35
38
|
f.each_line do |fileName|
|
36
39
|
fileName = fileName[2..-1].strip
|
37
40
|
begin
|
38
|
-
sourceFile = open(docuSource+fileName)
|
41
|
+
sourceFile = open(docuSource+fileName, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE})
|
39
42
|
puts "[OK] "+ docuSource+fileName
|
40
43
|
rescue OpenURI::HTTPError => e
|
41
44
|
puts "[FAILED] "+ docuSource+fileName
|
@@ -31,6 +31,12 @@ module Bake
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def get_tasking_severity(str)
|
35
|
+
return SEVERITY_INFO if str.start_with?"R"
|
36
|
+
return SEVERITY_WARNING if str.start_with?"W"
|
37
|
+
return SEVERITY_ERROR # F,E and S
|
38
|
+
end
|
39
|
+
|
34
40
|
def inv_severity(s)
|
35
41
|
if s == SEVERITY_INFO
|
36
42
|
"info"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'bake/toolchain/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
class TaskingCompilerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@error_expression = /.* (.+): \[\"(.+)\" ([0-9]+)\] (.*)/
|
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
|
+
lstripped = l.rstrip
|
16
|
+
scan_res = lstripped.scan(@error_expression)
|
17
|
+
if scan_res.length > 0
|
18
|
+
d.file_name = File.expand_path(scan_res[0][1])
|
19
|
+
d.line_number = scan_res[0][2].to_i
|
20
|
+
d.message = scan_res[0][3]
|
21
|
+
d.severity = get_tasking_severity(scan_res[0][0])
|
22
|
+
l.gsub!(scan_res[0][0],d.file_name)
|
23
|
+
end
|
24
|
+
res << d
|
25
|
+
consoleOutputFullnames << l
|
26
|
+
end
|
27
|
+
[res, consoleOutputFullnames]
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'bake/toolchain/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
class TaskingLinkerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@error_expression = /.* (.+): (.*)/
|
8
|
+
end
|
9
|
+
|
10
|
+
def scan_lines(consoleOutput, proj_dir)
|
11
|
+
res = []
|
12
|
+
consoleOutput[0].each_line do |l|
|
13
|
+
l.rstrip!
|
14
|
+
d = ErrorDesc.new
|
15
|
+
scan_res = l.scan(@error_expression)
|
16
|
+
if scan_res.length > 0
|
17
|
+
d.file_name = proj_dir
|
18
|
+
d.line_number = 0
|
19
|
+
d.message = scan_res[0][1]
|
20
|
+
d.severity = get_tasking_severity(scan_res[0][0])
|
21
|
+
end
|
22
|
+
res << d
|
23
|
+
end
|
24
|
+
[res, consoleOutput[0]]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -91,6 +91,7 @@ module Bake
|
|
91
91
|
:PREFIX => "$(LinkerPrefix)",
|
92
92
|
:MUST_FLAGS => "",
|
93
93
|
:SCRIPT => "",
|
94
|
+
:SCRIPT_SPACE => true,
|
94
95
|
:USER_LIB_FLAG => "",
|
95
96
|
:EXE_FLAG => "",
|
96
97
|
:EXE_FLAG_SPACE => true,
|
@@ -158,3 +159,4 @@ require 'bake/toolchain/greenhills'
|
|
158
159
|
require 'bake/toolchain/keil'
|
159
160
|
require 'bake/toolchain/msvc'
|
160
161
|
require 'bake/toolchain/gcc_env'
|
162
|
+
require 'bake/toolchain/tasking'
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'bake/toolchain/provider'
|
2
|
+
require 'common/utils'
|
3
|
+
require 'bake/toolchain/errorparser/tasking_compiler_error_parser'
|
4
|
+
require 'bake/toolchain/errorparser/tasking_linker_error_parser'
|
5
|
+
|
6
|
+
module Bake
|
7
|
+
module Toolchain
|
8
|
+
|
9
|
+
TaskingChain = Provider.add("Tasking")
|
10
|
+
|
11
|
+
TaskingChain[:COMPILER][:C].update({
|
12
|
+
:COMMAND => "cctc",
|
13
|
+
:FLAGS => "",
|
14
|
+
:DEFINE_FLAG => "-D",
|
15
|
+
:OBJECT_FILE_FLAG => "-o",
|
16
|
+
:OBJ_FLAG_SPACE => true,
|
17
|
+
:COMPILE_FLAGS => "-c",
|
18
|
+
:DEP_FLAGS => "--dep-file=",
|
19
|
+
:DEP_FLAGS_SPACE => false,
|
20
|
+
:PREPRO_FLAGS => "-P"
|
21
|
+
})
|
22
|
+
|
23
|
+
TaskingChain[:COMPILER][:CPP] = Utils.deep_copy(TaskingChain[:COMPILER][:C])
|
24
|
+
TaskingChain[:COMPILER][:CPP][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:CPP][:SOURCE_FILE_ENDINGS]
|
25
|
+
|
26
|
+
TaskingChain[:COMPILER][:ASM] = Utils.deep_copy(TaskingChain[:COMPILER][:C])
|
27
|
+
TaskingChain[:COMPILER][:ASM][:COMMAND] = "astc"
|
28
|
+
TaskingChain[:COMPILER][:ASM][:COMPILE_FLAGS] = ""
|
29
|
+
TaskingChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
30
|
+
TaskingChain[:COMPILER][:ASM][:PREPRO_FLAGS] = ""
|
31
|
+
|
32
|
+
TaskingChain[:ARCHIVER][:COMMAND] = "artc"
|
33
|
+
TaskingChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-rcu"
|
34
|
+
|
35
|
+
TaskingChain[:LINKER][:COMMAND] = "cctc"
|
36
|
+
TaskingChain[:LINKER][:SCRIPT] = "--lsl-file="
|
37
|
+
TaskingChain[:LINKER][:SCRIPT_SPACE] = false
|
38
|
+
TaskingChain[:LINKER][:USER_LIB_FLAG] = "-l"
|
39
|
+
TaskingChain[:LINKER][:EXE_FLAG] = "-o"
|
40
|
+
TaskingChain[:LINKER][:LIB_FLAG] = "-l"
|
41
|
+
TaskingChain[:LINKER][:LIB_PATH_FLAG] = "-L"
|
42
|
+
TaskingChain[:LINKER][:MAP_FILE_PIPE] = false
|
43
|
+
TaskingChain[:LINKER][:MAP_FILE_FLAG] = "--map-file="
|
44
|
+
TaskingChain[:LINKER][:OUTPUT_ENDING] = ".elf"
|
45
|
+
|
46
|
+
taskingCompilerErrorParser = TaskingCompilerErrorParser.new
|
47
|
+
TaskingChain[:COMPILER][:C][:ERROR_PARSER] = taskingCompilerErrorParser
|
48
|
+
TaskingChain[:COMPILER][:CPP][:ERROR_PARSER] = taskingCompilerErrorParser
|
49
|
+
TaskingChain[:COMPILER][:ASM][:ERROR_PARSER] = taskingCompilerErrorParser
|
50
|
+
TaskingChain[:ARCHIVER][:ERROR_PARSER] = taskingCompilerErrorParser
|
51
|
+
TaskingChain[:LINKER][:ERROR_PARSER] = TaskingLinkerErrorParser.new
|
52
|
+
|
53
|
+
TaskingChain[:COMPILER][:DEP_FILE_SINGLE_LINE] = true
|
54
|
+
end
|
55
|
+
end
|
data/lib/blocks/block.rb
CHANGED
data/lib/blocks/blockBase.rb
CHANGED
@@ -12,9 +12,6 @@ module Bake
|
|
12
12
|
@projectName = config.parent.name
|
13
13
|
@projectDir = config.get_project_dir
|
14
14
|
@config_date = Time.now
|
15
|
-
|
16
|
-
@printedCmdAlternate = false
|
17
|
-
@lastCommand = nil
|
18
15
|
end
|
19
16
|
|
20
17
|
def check_config_file()
|
@@ -89,18 +86,18 @@ module Bake
|
|
89
86
|
end
|
90
87
|
|
91
88
|
def printCmd(cmd, alternate, reason, forceVerbose)
|
92
|
-
if (cmd ==
|
93
|
-
if (Bake.options.verbose >= 2 or (
|
89
|
+
if (cmd == Thread.current[:lastCommand])
|
90
|
+
if (Bake.options.verbose >= 2 or (Thread.current[:printedCmdAlternate] and not forceVerbose))
|
94
91
|
return
|
95
92
|
end
|
96
93
|
end
|
97
94
|
|
98
|
-
|
95
|
+
Thread.current[:lastCommand] = cmd
|
99
96
|
|
100
97
|
return if Bake.options.verbose == 0 and not forceVerbose
|
101
98
|
|
102
99
|
if forceVerbose or Bake.options.verbose >= 2 or not alternate
|
103
|
-
|
100
|
+
Thread.current[:printedCmdAlternate] = false
|
104
101
|
puts "" if Bake.options.verbose >= 2 # for A.K. :-)
|
105
102
|
if Bake.options.verbose >= 3
|
106
103
|
exedIn = "\n(executed in '#{@projectDir}')"
|
@@ -116,7 +113,7 @@ module Bake
|
|
116
113
|
puts cmd + exedIn + because
|
117
114
|
end
|
118
115
|
else
|
119
|
-
|
116
|
+
Thread.current[:printedCmdAlternate] = true
|
120
117
|
puts alternate
|
121
118
|
end
|
122
119
|
|
data/lib/blocks/compile.rb
CHANGED
@@ -190,13 +190,15 @@ module Bake
|
|
190
190
|
|
191
191
|
if not (cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile))
|
192
192
|
BlockBase.prepareOutput(object)
|
193
|
+
outputType = Bake.options.analyze ? "Analyzing" : (Bake.options.prepro ? "Preprocessing" : "Compiling")
|
194
|
+
printCmd(cmd, "#{outputType} #{source}", reason, false)
|
195
|
+
flushOutput()
|
193
196
|
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
197
|
+
|
194
198
|
success = true
|
195
199
|
consoleOutput = ""
|
196
200
|
success, consoleOutput = ProcessHelper.run(cmd, false, false) if !Bake.options.dry
|
197
|
-
|
198
|
-
outputType = Bake.options.analyze ? "Analyzing" : (Bake.options.prepro ? "Preprocessing" : "Compiling")
|
199
|
-
incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "#{outputType} #{source}", reason, success)
|
201
|
+
incList = process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], nil, reason, success)
|
200
202
|
|
201
203
|
if type != :ASM and not Bake.options.analyze and not Bake.options.prepro
|
202
204
|
incList = Compile.read_depfile(dep_filename, @projectDir, @block.tcs[:COMPILER][:DEP_FILE_SINGLE_LINE]) if incList.nil?
|
@@ -219,7 +221,16 @@ module Bake
|
|
219
221
|
if singleLine
|
220
222
|
File.readlines(dep_filename).each do |line|
|
221
223
|
splitted = line.split(": ")
|
222
|
-
|
224
|
+
if splitted.length > 1
|
225
|
+
deps << splitted[1].gsub(/[\\]/,'/')
|
226
|
+
else
|
227
|
+
splitted = line.split(":\t") # right now only for tasking compiler
|
228
|
+
if splitted.length > 1
|
229
|
+
dep = splitted[1].gsub(/[\\]/,'/').strip
|
230
|
+
dep = dep[1..-2] if dep.start_with?("\"")
|
231
|
+
deps << dep
|
232
|
+
end
|
233
|
+
end
|
223
234
|
end
|
224
235
|
else
|
225
236
|
deps_string = File.read(dep_filename)
|
@@ -257,6 +268,19 @@ module Bake
|
|
257
268
|
@mutex ||= Mutex.new
|
258
269
|
end
|
259
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
|
+
|
260
284
|
def execute
|
261
285
|
Dir.chdir(@projectDir) do
|
262
286
|
|
@@ -274,10 +298,10 @@ module Bake
|
|
274
298
|
end
|
275
299
|
|
276
300
|
s = StringIO.new
|
277
|
-
|
278
|
-
Thread.current[:stdout] = s unless
|
279
|
-
|
301
|
+
Thread.current[:tmpStdout] = Thread.current[:stdout]
|
302
|
+
Thread.current[:stdout] = s unless Thread.current[:tmpStdout]
|
280
303
|
Thread.current[:filelist] = Set.new if Bake.options.filelist
|
304
|
+
Thread.current[:lastCommand] = nil
|
281
305
|
|
282
306
|
result = false
|
283
307
|
begin
|
@@ -294,7 +318,7 @@ module Bake
|
|
294
318
|
|
295
319
|
jobs.set_failed if not result
|
296
320
|
|
297
|
-
Thread.current[:stdout] =
|
321
|
+
Thread.current[:stdout] = Thread.current[:tmpStdout]
|
298
322
|
|
299
323
|
mutex.synchronize do
|
300
324
|
fileListBlock.merge(Thread.current[:filelist]) if Bake.options.filelist
|
data/lib/blocks/executable.rb
CHANGED
@@ -1,170 +1,176 @@
|
|
1
|
-
require 'blocks/blockBase'
|
2
|
-
|
3
|
-
module Bake
|
4
|
-
|
5
|
-
module Blocks
|
6
|
-
|
7
|
-
class Executable < BlockBase
|
8
|
-
|
9
|
-
def initialize(block, config, referencedConfigs, compileBlock)
|
10
|
-
super(block, config, referencedConfigs)
|
11
|
-
@compileBlock = compileBlock
|
12
|
-
|
13
|
-
calcArtifactName
|
14
|
-
calcMapFile
|
15
|
-
calcLinkerScript
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def calcLinkerScript
|
20
|
-
@linker_script = @config.linkerScript.nil? ? nil : @block.convPath(@config.linkerScript)
|
21
|
-
end
|
22
|
-
|
23
|
-
def calcArtifactName
|
24
|
-
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
25
|
-
baseFilename = @config.artifactName.name
|
26
|
-
else
|
27
|
-
baseFilename = "#{@projectName}#{Bake::Toolchain.outputEnding(@block.tcs)}"
|
28
|
-
end
|
29
|
-
@exe_name ||= File.join([@block.output_dir, baseFilename])
|
30
|
-
end
|
31
|
-
|
32
|
-
def calcCmdlineFile()
|
33
|
-
@exe_name + ".cmdline"
|
34
|
-
end
|
35
|
-
|
36
|
-
def calcMapFile
|
37
|
-
@mapfile = nil
|
38
|
-
if (not Bake.options.docu) and (not @config.mapFile.nil?)
|
39
|
-
if @config.mapFile.name == ""
|
40
|
-
@mapfile = @exe_name.chomp(File.extname(@exe_name)) + ".map"
|
41
|
-
else
|
42
|
-
@mapfile = @config.mapFile.name
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def ignore?
|
48
|
-
Bake.options.prepro
|
49
|
-
end
|
50
|
-
|
51
|
-
def needed?(libs)
|
52
|
-
return "because linkOnly was specified" if Bake.options.linkOnly
|
53
|
-
|
54
|
-
# exe
|
55
|
-
return "because executable does not exist" if not File.exists?(@exe_name)
|
56
|
-
|
57
|
-
eTime = File.mtime(@exe_name)
|
58
|
-
|
59
|
-
# linkerscript
|
60
|
-
if @linker_script
|
61
|
-
return "because linker script does not exist - will most probably result in an error" if not File.exists?(@linker_script)
|
62
|
-
return "because linker script is newer than executable" if eTime < File.mtime(@linker_script)
|
63
|
-
end
|
64
|
-
|
65
|
-
# sources
|
66
|
-
@compileBlock.objects.each do |obj|
|
67
|
-
return "because object #{obj} does not exist" if not File.exists?(obj)
|
68
|
-
return "because object #{obj} is newer than executable" if eTime < File.mtime(obj)
|
69
|
-
end
|
70
|
-
|
71
|
-
# libs
|
72
|
-
libs.each do |lib|
|
73
|
-
return "because library #{lib} does not exist" if not File.exists?(lib)
|
74
|
-
return "because library #{lib} is newer than executable" if eTime < File.mtime(lib)
|
75
|
-
end
|
76
|
-
false
|
77
|
-
end
|
78
|
-
|
79
|
-
def execute
|
80
|
-
Dir.chdir(@projectDir) do
|
81
|
-
childs = @block.getBlocks(:childs)
|
82
|
-
return false if childs.any? { |b| b.result == false }
|
83
|
-
|
84
|
-
allSources = []
|
85
|
-
(childs + [@block]).each do |b|
|
86
|
-
Dir.chdir(b.projectDir) do
|
87
|
-
b.getCompileBlocks.each do |c|
|
88
|
-
allSources += c.calcSources(true, true).map { |s| File.expand_path(s) }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
duplicateSources = allSources.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)
|
93
|
-
duplicateSources.each do |d|
|
94
|
-
Bake.formatter.printWarning("Source compiled more than once: #{d}")
|
95
|
-
end
|
96
|
-
|
97
|
-
libs, linker_libs_array = LibElements.calc_linker_lib_string(@block, @block.tcs)
|
98
|
-
|
99
|
-
cmdLineCheck = false
|
100
|
-
cmdLineFile = calcCmdlineFile()
|
101
|
-
|
102
|
-
return true if ignore?
|
103
|
-
reason = needed?(libs)
|
104
|
-
if not reason
|
105
|
-
cmdLineCheck = true
|
106
|
-
reason = config_changed?(cmdLineFile)
|
107
|
-
end
|
108
|
-
|
109
|
-
linker = @block.tcs[:LINKER]
|
110
|
-
|
111
|
-
cmd = Utils.flagSplit(linker[:PREFIX], false)
|
112
|
-
cmd += Utils.flagSplit(linker[:COMMAND], false) # g++
|
113
|
-
cmd += linker[:MUST_FLAGS].split(" ")
|
114
|
-
cmd += Bake::Utils::flagSplit(linker[:FLAGS],true)
|
115
|
-
|
116
|
-
|
117
|
-
cmd << linker[:EXE_FLAG]
|
118
|
-
if linker[:EXE_FLAG_SPACE]
|
119
|
-
cmd << @exe_name
|
120
|
-
else
|
121
|
-
cmd[cmd.length-1] += @exe_name
|
122
|
-
end
|
123
|
-
|
124
|
-
cmd += @compileBlock.objects
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
cmd +=
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
1
|
+
require 'blocks/blockBase'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
|
5
|
+
module Blocks
|
6
|
+
|
7
|
+
class Executable < BlockBase
|
8
|
+
|
9
|
+
def initialize(block, config, referencedConfigs, compileBlock)
|
10
|
+
super(block, config, referencedConfigs)
|
11
|
+
@compileBlock = compileBlock
|
12
|
+
|
13
|
+
calcArtifactName
|
14
|
+
calcMapFile
|
15
|
+
calcLinkerScript
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def calcLinkerScript
|
20
|
+
@linker_script = @config.linkerScript.nil? ? nil : @block.convPath(@config.linkerScript)
|
21
|
+
end
|
22
|
+
|
23
|
+
def calcArtifactName
|
24
|
+
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
25
|
+
baseFilename = @config.artifactName.name
|
26
|
+
else
|
27
|
+
baseFilename = "#{@projectName}#{Bake::Toolchain.outputEnding(@block.tcs)}"
|
28
|
+
end
|
29
|
+
@exe_name ||= File.join([@block.output_dir, baseFilename])
|
30
|
+
end
|
31
|
+
|
32
|
+
def calcCmdlineFile()
|
33
|
+
@exe_name + ".cmdline"
|
34
|
+
end
|
35
|
+
|
36
|
+
def calcMapFile
|
37
|
+
@mapfile = nil
|
38
|
+
if (not Bake.options.docu) and (not @config.mapFile.nil?)
|
39
|
+
if @config.mapFile.name == ""
|
40
|
+
@mapfile = @exe_name.chomp(File.extname(@exe_name)) + ".map"
|
41
|
+
else
|
42
|
+
@mapfile = @config.mapFile.name
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def ignore?
|
48
|
+
Bake.options.prepro
|
49
|
+
end
|
50
|
+
|
51
|
+
def needed?(libs)
|
52
|
+
return "because linkOnly was specified" if Bake.options.linkOnly
|
53
|
+
|
54
|
+
# exe
|
55
|
+
return "because executable does not exist" if not File.exists?(@exe_name)
|
56
|
+
|
57
|
+
eTime = File.mtime(@exe_name)
|
58
|
+
|
59
|
+
# linkerscript
|
60
|
+
if @linker_script
|
61
|
+
return "because linker script does not exist - will most probably result in an error" if not File.exists?(@linker_script)
|
62
|
+
return "because linker script is newer than executable" if eTime < File.mtime(@linker_script)
|
63
|
+
end
|
64
|
+
|
65
|
+
# sources
|
66
|
+
@compileBlock.objects.each do |obj|
|
67
|
+
return "because object #{obj} does not exist" if not File.exists?(obj)
|
68
|
+
return "because object #{obj} is newer than executable" if eTime < File.mtime(obj)
|
69
|
+
end
|
70
|
+
|
71
|
+
# libs
|
72
|
+
libs.each do |lib|
|
73
|
+
return "because library #{lib} does not exist" if not File.exists?(lib)
|
74
|
+
return "because library #{lib} is newer than executable" if eTime < File.mtime(lib)
|
75
|
+
end
|
76
|
+
false
|
77
|
+
end
|
78
|
+
|
79
|
+
def execute
|
80
|
+
Dir.chdir(@projectDir) do
|
81
|
+
childs = @block.getBlocks(:childs)
|
82
|
+
return false if childs.any? { |b| b.result == false }
|
83
|
+
|
84
|
+
allSources = []
|
85
|
+
(childs + [@block]).each do |b|
|
86
|
+
Dir.chdir(b.projectDir) do
|
87
|
+
b.getCompileBlocks.each do |c|
|
88
|
+
allSources += c.calcSources(true, true).map { |s| File.expand_path(s) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
duplicateSources = allSources.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)
|
93
|
+
duplicateSources.each do |d|
|
94
|
+
Bake.formatter.printWarning("Source compiled more than once: #{d}")
|
95
|
+
end
|
96
|
+
|
97
|
+
libs, linker_libs_array = LibElements.calc_linker_lib_string(@block, @block.tcs)
|
98
|
+
|
99
|
+
cmdLineCheck = false
|
100
|
+
cmdLineFile = calcCmdlineFile()
|
101
|
+
|
102
|
+
return true if ignore?
|
103
|
+
reason = needed?(libs)
|
104
|
+
if not reason
|
105
|
+
cmdLineCheck = true
|
106
|
+
reason = config_changed?(cmdLineFile)
|
107
|
+
end
|
108
|
+
|
109
|
+
linker = @block.tcs[:LINKER]
|
110
|
+
|
111
|
+
cmd = Utils.flagSplit(linker[:PREFIX], false)
|
112
|
+
cmd += Utils.flagSplit(linker[:COMMAND], false) # g++
|
113
|
+
cmd += linker[:MUST_FLAGS].split(" ")
|
114
|
+
cmd += Bake::Utils::flagSplit(linker[:FLAGS],true)
|
115
|
+
|
116
|
+
|
117
|
+
cmd << linker[:EXE_FLAG]
|
118
|
+
if linker[:EXE_FLAG_SPACE]
|
119
|
+
cmd << @exe_name
|
120
|
+
else
|
121
|
+
cmd[cmd.length-1] += @exe_name
|
122
|
+
end
|
123
|
+
|
124
|
+
cmd += @compileBlock.objects
|
125
|
+
if @linker_script
|
126
|
+
if linker[:SCRIPT_SPACE]
|
127
|
+
cmd << linker[:SCRIPT] # -T
|
128
|
+
cmd << @linker_script # xy/xy.dld
|
129
|
+
else
|
130
|
+
cmd << linker[:SCRIPT]+@linker_script
|
131
|
+
end
|
132
|
+
end
|
133
|
+
cmd += linker[:MAP_FILE_FLAG].split(" ") if @mapfile # -Wl,-m6
|
134
|
+
if not linker[:MAP_FILE_PIPE] and @mapfile
|
135
|
+
cmd[cmd.length-1] << @mapfile
|
136
|
+
end
|
137
|
+
cmd += Bake::Utils::flagSplit(linker[:LIB_PREFIX_FLAGS],true) # "-Wl,--whole-archive "
|
138
|
+
cmd += linker_libs_array
|
139
|
+
cmd += Bake::Utils::flagSplit(linker[:LIB_POSTFIX_FLAGS],true) # "-Wl,--no-whole-archive "
|
140
|
+
|
141
|
+
mapfileStr = (@mapfile and linker[:MAP_FILE_PIPE]) ? " >#{@mapfile}" : ""
|
142
|
+
|
143
|
+
# pre print because linking can take much time
|
144
|
+
cmdLinePrint = cmd.dup
|
145
|
+
outPipe = (@mapfile and linker[:MAP_FILE_PIPE]) ? "#{@mapfile}" : nil
|
146
|
+
cmdLinePrint << "> #{outPipe}" if outPipe
|
147
|
+
|
148
|
+
if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
|
149
|
+
success = true
|
150
|
+
else
|
151
|
+
ToCxx.linkBlock
|
152
|
+
|
153
|
+
BlockBase.prepareOutput(@exe_name)
|
154
|
+
|
155
|
+
printCmd(cmdLinePrint, "Linking #{@exe_name}", reason, false)
|
156
|
+
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
157
|
+
success = true
|
158
|
+
consoleOutput = ""
|
159
|
+
success, consoleOutput = ProcessHelper.run(cmd, false, false, outPipe) if !Bake.options.dry
|
160
|
+
process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, reason, success)
|
161
|
+
|
162
|
+
check_config_file()
|
163
|
+
end
|
164
|
+
|
165
|
+
return success
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def clean
|
170
|
+
return cleanProjectDir()
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
170
176
|
end
|
data/lib/common/version.rb
CHANGED
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.31.
|
4
|
+
version: 2.31.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Schaal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|
@@ -162,6 +162,8 @@ files:
|
|
162
162
|
- lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb
|
163
163
|
- lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb
|
164
164
|
- lib/bake/toolchain/errorparser/process_output.rb
|
165
|
+
- lib/bake/toolchain/errorparser/tasking_compiler_error_parser.rb
|
166
|
+
- lib/bake/toolchain/errorparser/tasking_linker_error_parser.rb
|
165
167
|
- lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb
|
166
168
|
- lib/bake/toolchain/errorparser/ti_linker_error_parser.rb
|
167
169
|
- lib/bake/toolchain/gcc.rb
|
@@ -170,6 +172,7 @@ files:
|
|
170
172
|
- lib/bake/toolchain/keil.rb
|
171
173
|
- lib/bake/toolchain/msvc.rb
|
172
174
|
- lib/bake/toolchain/provider.rb
|
175
|
+
- lib/bake/toolchain/tasking.rb
|
173
176
|
- lib/bake/toolchain/ti.rb
|
174
177
|
- lib/bake/util.rb
|
175
178
|
- lib/bakeclean/options/options.rb
|