bake-toolkit 2.19.2 → 2.20.1
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/documentation/_build/html/_images/dot.png +0 -0
- data/documentation/_build/html/_images/dotP.png +0 -0
- data/documentation/_build/html/_images/dotPC.png +0 -0
- data/documentation/_build/html/_sources/changelog.txt +12 -0
- data/documentation/_build/html/_sources/concepts/concepts.txt +2 -0
- data/documentation/_build/html/_sources/concepts/inject.txt +65 -0
- data/documentation/_build/html/_sources/concepts/prebuild.txt +56 -0
- data/documentation/_build/html/_sources/index.txt +1 -1
- data/documentation/_build/html/_sources/syntax/auto_adjustment.txt +43 -0
- data/documentation/_build/html/_sources/syntax/syntax.txt +1 -1
- data/documentation/_build/html/_sources/syntax/variable_substitutions.txt +41 -68
- data/documentation/_build/html/_sources/tips_and_tricks/dot.txt +34 -0
- data/documentation/_build/html/_sources/tips_and_tricks/tips_and_tricks.txt +1 -1
- data/documentation/_build/html/_static/dot.png +0 -0
- data/documentation/_build/html/_static/dotP.png +0 -0
- data/documentation/_build/html/_static/dotPC.png +0 -0
- data/documentation/_build/html/_static/syntax.html +20 -0
- data/documentation/_build/html/changelog.html +17 -3
- data/documentation/_build/html/commandline/commandline.html +3 -3
- data/documentation/_build/html/concepts/build_hierarchy.html +3 -3
- data/documentation/_build/html/concepts/concepts.html +13 -3
- data/documentation/_build/html/concepts/inject.html +217 -0
- data/documentation/_build/html/concepts/link_order.html +3 -3
- data/documentation/_build/html/concepts/prebuild.html +205 -0
- data/documentation/_build/html/concepts/the_main_project.html +3 -3
- data/documentation/_build/html/concepts/the_project_meta_file.html +3 -3
- data/documentation/_build/html/genindex.html +3 -3
- data/documentation/_build/html/ide/eclipse/eclipse.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_convert_existing_cdt_workspace.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_create_a_new_project_in_eclipse.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_create_a_workspace_in_eclipse.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_debug_in_eclipse.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_install_eclipse_plugin.html +3 -3
- data/documentation/_build/html/ide/eclipse/how_to_use_bake_in_eclipse.html +3 -3
- data/documentation/_build/html/ide/ide_integrations.html +3 -3
- data/documentation/_build/html/ide/vs/how_to_create_vs_projects.html +3 -3
- data/documentation/_build/html/ide/vs/how_to_debug_in_vs.html +3 -3
- data/documentation/_build/html/ide/vs/how_to_used_bake_in_vs.html +3 -3
- data/documentation/_build/html/ide/vs/vs.html +3 -3
- data/documentation/_build/html/ide/vs/vs_install.html +3 -3
- data/documentation/_build/html/index.html +10 -7
- data/documentation/_build/html/install/install_bake.html +3 -3
- data/documentation/_build/html/internal.html +3 -3
- data/documentation/_build/html/known_issues.html +3 -3
- data/documentation/_build/html/license.html +3 -3
- data/documentation/_build/html/performance/performance.html +5 -5
- data/documentation/_build/html/quickstart/quickstart.html +3 -3
- data/documentation/_build/html/search.html +3 -3
- data/documentation/_build/html/searchindex.js +1 -1
- data/documentation/_build/html/syntax/adapt_configs.html +3 -3
- data/documentation/_build/html/syntax/auto_adjustment.html +190 -0
- data/documentation/_build/html/syntax/derive_configs.html +3 -3
- data/documentation/_build/html/syntax/project_meta_syntax.html +23 -3
- data/documentation/_build/html/syntax/syntax.html +11 -7
- data/documentation/_build/html/syntax/variable_substitutions.html +54 -67
- data/documentation/_build/html/tips_and_tricks/{bundle.html → dot.html} +25 -19
- data/documentation/_build/html/tips_and_tricks/how_to_use_bake_with_cygwin.html +3 -3
- data/documentation/_build/html/tips_and_tricks/static_code_analysis.html +3 -3
- data/documentation/_build/html/tips_and_tricks/the_bakery.html +3 -3
- data/documentation/_build/html/tips_and_tricks/the_clang.html +5 -5
- data/documentation/_build/html/tips_and_tricks/tips_and_tricks.html +4 -4
- data/documentation/_build/html/why_bake/why_bake.html +5 -5
- data/lib/adapt/config/loader.rb +37 -35
- data/lib/bake/config/checks.rb +19 -11
- data/lib/bake/config/loader.rb +67 -60
- data/lib/bake/model/metamodel.rb +56 -30
- data/lib/bake/options/options.rb +37 -3
- data/lib/bake/options/usage.rb +12 -3
- data/lib/bake/subst.rb +5 -2
- data/lib/blocks/block.rb +27 -6
- data/lib/blocks/blockBase.rb +2 -17
- data/lib/blocks/compile.rb +91 -91
- data/lib/blocks/executable.rb +41 -41
- data/lib/common/version.rb +1 -1
- data/lib/tocxx.rb +212 -55
- metadata +16 -4
- data/documentation/_build/html/_sources/tips_and_tricks/bundle.txt +0 -24
data/lib/blocks/executable.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'blocks/blockBase'
|
|
2
2
|
|
|
3
3
|
module Bake
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
module Blocks
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
class Executable < BlockBase
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def initialize(block, config, referencedConfigs, tcs, compileBlock)
|
|
10
10
|
super(block, config, referencedConfigs, tcs)
|
|
11
11
|
@compileBlock = compileBlock
|
|
@@ -15,59 +15,59 @@ module Bake
|
|
|
15
15
|
calcLinkerScript
|
|
16
16
|
|
|
17
17
|
end
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
def calcLinkerScript
|
|
20
|
-
@linker_script = @config.linkerScript.nil? ? nil : @block.convPath(@config.linkerScript)
|
|
20
|
+
@linker_script = @config.linkerScript.nil? ? nil : @block.convPath(@config.linkerScript)
|
|
21
21
|
end
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def calcArtifactName
|
|
24
|
-
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
|
24
|
+
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
|
25
25
|
baseFilename = @config.artifactName.name
|
|
26
26
|
else
|
|
27
27
|
baseFilename = "#{@projectName}#{@tcs[:LINKER][:OUTPUT_ENDING]}"
|
|
28
28
|
end
|
|
29
29
|
@exe_name ||= File.join([@output_dir, baseFilename])
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
def calcCmdlineFile()
|
|
33
33
|
@exe_name + ".cmdline"
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
def calcMapFile
|
|
37
37
|
@mapfile = nil
|
|
38
38
|
if (not Bake.options.docu) and (not Bake.options.lint) and (not @config.mapFile.nil?)
|
|
39
39
|
if @config.mapFile.name == ""
|
|
40
40
|
@mapfile = @exe_name.chomp(File.extname(@exe_name)) + ".map"
|
|
41
41
|
else
|
|
42
|
-
@mapfile = @config.mapFile.name
|
|
42
|
+
@mapfile = @config.mapFile.name
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
def ignore?
|
|
48
48
|
Bake.options.prepro
|
|
49
49
|
end
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
def needed?(libs)
|
|
52
52
|
return "because linkOnly was specified" if Bake.options.linkOnly
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
# exe
|
|
55
55
|
return "because executable does not exist" if not File.exists?(@exe_name)
|
|
56
56
|
|
|
57
57
|
eTime = File.mtime(@exe_name)
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
# linkerscript
|
|
60
60
|
if @linker_script
|
|
61
61
|
return "because linker script does not exist - will most probably result in an error" if not File.exists?(@linker_script)
|
|
62
62
|
return "because linker script is newer than executable" if eTime < File.mtime(@linker_script)
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
# sources
|
|
66
66
|
@compileBlock.objects.each do |obj|
|
|
67
67
|
return "because object #{obj} does not exist" if not File.exists?(obj)
|
|
68
68
|
return "because object #{obj} is newer than executable" if eTime < File.mtime(obj)
|
|
69
69
|
end
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
# libs
|
|
72
72
|
libs.each do |lib|
|
|
73
73
|
return "because library #{lib} does not exist" if not File.exists?(lib)
|
|
@@ -75,12 +75,12 @@ module Bake
|
|
|
75
75
|
end
|
|
76
76
|
false
|
|
77
77
|
end
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
def execute
|
|
80
80
|
Dir.chdir(@projectDir) do
|
|
81
|
-
childs = getBlocks(:childs)
|
|
81
|
+
childs = @block.getBlocks(:childs)
|
|
82
82
|
return false if childs.any? { |b| b.result == false }
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
allSources = []
|
|
85
85
|
(childs + [@block]).each do |b|
|
|
86
86
|
Dir.chdir(b.projectDir) do
|
|
@@ -91,28 +91,28 @@ module Bake
|
|
|
91
91
|
end
|
|
92
92
|
duplicateSources = allSources.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)
|
|
93
93
|
duplicateSources.each do |d|
|
|
94
|
-
Bake.formatter.printWarning("Source compiled more than once: #{d}")
|
|
94
|
+
Bake.formatter.printWarning("Source compiled more than once: #{d}")
|
|
95
95
|
end
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
libs, linker_libs_array = LibElements.calc_linker_lib_string(@block, @tcs)
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
cmdLineCheck = false
|
|
100
100
|
cmdLineFile = calcCmdlineFile()
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
return true if ignore?
|
|
103
103
|
reason = needed?(libs)
|
|
104
104
|
if not reason
|
|
105
105
|
cmdLineCheck = true
|
|
106
106
|
reason = config_changed?(cmdLineFile)
|
|
107
107
|
end
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
linker = @tcs[:LINKER]
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
cmd = Utils.flagSplit(linker[:COMMAND], false) # g++
|
|
112
112
|
cmd += linker[:MUST_FLAGS].split(" ")
|
|
113
113
|
cmd += Bake::Utils::flagSplit(linker[:FLAGS],true)
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
|
|
115
|
+
|
|
116
116
|
cmd << linker[:EXE_FLAG]
|
|
117
117
|
if linker[:EXE_FLAG_SPACE]
|
|
118
118
|
cmd << @exe_name
|
|
@@ -124,52 +124,52 @@ module Bake
|
|
|
124
124
|
cmd << linker[:SCRIPT] if @linker_script # -T
|
|
125
125
|
cmd << @linker_script if @linker_script # xy/xy.dld
|
|
126
126
|
cmd += linker[:MAP_FILE_FLAG].split(" ") if @mapfile # -Wl,-m6
|
|
127
|
-
if not linker[:MAP_FILE_PIPE] and @mapfile
|
|
128
|
-
cmd[cmd.length-1] << @mapfile
|
|
127
|
+
if not linker[:MAP_FILE_PIPE] and @mapfile
|
|
128
|
+
cmd[cmd.length-1] << @mapfile
|
|
129
129
|
end
|
|
130
130
|
cmd += Bake::Utils::flagSplit(linker[:LIB_PREFIX_FLAGS],true) # "-Wl,--whole-archive "
|
|
131
131
|
cmd += linker_libs_array
|
|
132
132
|
cmd += Bake::Utils::flagSplit(linker[:LIB_POSTFIX_FLAGS],true) # "-Wl,--no-whole-archive "
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
mapfileStr = (@mapfile and linker[:MAP_FILE_PIPE]) ? " >#{@mapfile}" : ""
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
# pre print because linking can take much time
|
|
137
137
|
cmdLinePrint = cmd.dup
|
|
138
138
|
outPipe = (@mapfile and linker[:MAP_FILE_PIPE]) ? "#{@mapfile}" : nil
|
|
139
139
|
cmdLinePrint << "> #{outPipe}" if outPipe
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
|
|
142
142
|
success = true
|
|
143
143
|
else
|
|
144
144
|
ToCxx.linkBlock
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
BlockBase.prepareOutput(@exe_name)
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
printCmd(cmdLinePrint, "Linking #{@exe_name}", reason, false)
|
|
149
149
|
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
|
150
150
|
success, consoleOutput = ProcessHelper.run(cmd, false, false, outPipe)
|
|
151
151
|
process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, reason, success)
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
check_config_file()
|
|
154
154
|
end
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
Bake::Bundle.instance.addBinary(@exe_name, @linker_script, isMainProject? ? @config : nil)
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
return success
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
def clean
|
|
163
163
|
Dir.chdir(@projectDir) do
|
|
164
|
-
if File.exist?@output_dir
|
|
164
|
+
if File.exist?@output_dir
|
|
165
165
|
puts "Deleting folder #{@output_dir}" if Bake.options.verbose >= 2
|
|
166
166
|
FileUtils.rm_rf(@output_dir)
|
|
167
167
|
end
|
|
168
168
|
end unless Bake.options.filename
|
|
169
169
|
return true
|
|
170
170
|
end
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
end
|
|
173
|
-
|
|
173
|
+
|
|
174
174
|
end
|
|
175
175
|
end
|
data/lib/common/version.rb
CHANGED
data/lib/tocxx.rb
CHANGED
|
@@ -40,15 +40,15 @@ module Bake
|
|
|
40
40
|
|
|
41
41
|
class SystemCommandFailed < Exception
|
|
42
42
|
end
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
class ToCxx
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
@@linkBlock = 0
|
|
47
47
|
|
|
48
48
|
def self.linkBlock
|
|
49
49
|
@@linkBlock = 1
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
def initialize
|
|
53
53
|
@configTcMap = {}
|
|
54
54
|
end
|
|
@@ -58,7 +58,7 @@ module Bake
|
|
|
58
58
|
configs.each do |config|
|
|
59
59
|
tcs = Utils.deep_copy(@defaultToolchain)
|
|
60
60
|
@configTcMap[config] = tcs
|
|
61
|
-
end
|
|
61
|
+
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -66,23 +66,23 @@ module Bake
|
|
|
66
66
|
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
67
67
|
configs.each do |config|
|
|
68
68
|
integrateToolchain(@configTcMap[config], config.toolchain)
|
|
69
|
-
end
|
|
69
|
+
end
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
def substVars
|
|
74
74
|
Subst.itute(@mainConfig, Bake.options.main_project_name, true, @configTcMap[@mainConfig], @loadedConfig, @configTcMap)
|
|
75
75
|
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
76
76
|
configs.each do |config|
|
|
77
|
-
if config != @mainConfig
|
|
77
|
+
if config != @mainConfig
|
|
78
78
|
Subst.itute(config, projName, false, @configTcMap[config], @loadedConfig, @configTcMap)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
|
-
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
|
|
85
|
+
|
|
86
86
|
def addSteps(block, blockSteps, configSteps)
|
|
87
87
|
Array(configSteps.step).each do |step|
|
|
88
88
|
if Bake::Metamodel::Makefile === step
|
|
@@ -102,53 +102,205 @@ module Bake
|
|
|
102
102
|
block.childs << blockRef
|
|
103
103
|
blockRef.parents << block
|
|
104
104
|
break
|
|
105
|
-
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def calcPrebuildBlocks
|
|
111
|
+
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
112
|
+
configs.each do |config|
|
|
113
|
+
if config.prebuild
|
|
114
|
+
@prebuild ||= {}
|
|
115
|
+
config.prebuild.except.each do |except|
|
|
116
|
+
pName = projName
|
|
117
|
+
if not except.name.empty?
|
|
118
|
+
if not @loadedConfig.referencedConfigs.keys.include? except.name
|
|
119
|
+
Bake.formatter.printWarning("Warning: prebuild project #{except.name} not found")
|
|
120
|
+
next
|
|
121
|
+
end
|
|
122
|
+
pName = except.name
|
|
123
|
+
end
|
|
124
|
+
if except.config != "" && !@loadedConfig.referencedConfigs[pName].any? {|config| config.name == except.config}
|
|
125
|
+
Bake.formatter.printWarning("Warning: prebuild config #{except.config} of project #{pName} not found")
|
|
126
|
+
next
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if not @prebuild.include?pName
|
|
130
|
+
@prebuild[pName] = [except.config]
|
|
131
|
+
else
|
|
132
|
+
@prebuild[pName] << except.config
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
106
136
|
end
|
|
107
137
|
end
|
|
108
|
-
end
|
|
138
|
+
end
|
|
109
139
|
|
|
110
140
|
def makeBlocks
|
|
111
141
|
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
112
142
|
configs.each do |config|
|
|
113
|
-
|
|
143
|
+
|
|
144
|
+
prebuild = !@prebuild.nil?
|
|
145
|
+
if @prebuild and @prebuild.has_key?projName
|
|
146
|
+
prebuild = false if (@prebuild[projName].include?"" or @prebuild[projName].include?config.name)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
block = Blocks::Block.new(config, @loadedConfig.referencedConfigs, prebuild)
|
|
114
150
|
Blocks::ALL_BLOCKS[config.qname] = block
|
|
115
151
|
end
|
|
116
152
|
end
|
|
117
153
|
end
|
|
118
|
-
|
|
154
|
+
|
|
119
155
|
def makeGraph
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
157
|
+
configs.each do |config|
|
|
158
|
+
block = Blocks::ALL_BLOCKS[config.qname]
|
|
159
|
+
addDependencies(block, config)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
Blocks::ALL_BLOCKS.each do |name,block|
|
|
163
|
+
block.dependencies.uniq!
|
|
164
|
+
block.childs.uniq!
|
|
165
|
+
block.parents.uniq!
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# inject dependencies
|
|
169
|
+
num_interations = 0
|
|
170
|
+
begin
|
|
171
|
+
if (num_interations > 0) and Bake.options.debug and Bake.options.verbose >= 3
|
|
172
|
+
puts "Inject dependencies, iteration #{num_interations}:"
|
|
173
|
+
Blocks::ALL_BLOCKS.each do |name,block|
|
|
174
|
+
puts block.config.qname
|
|
175
|
+
block.dependencies.each { |d| puts "- #{d}" }
|
|
124
176
|
end
|
|
125
177
|
end
|
|
178
|
+
|
|
179
|
+
counter = 0
|
|
126
180
|
Blocks::ALL_BLOCKS.each do |name,block|
|
|
127
|
-
block.
|
|
128
|
-
|
|
129
|
-
|
|
181
|
+
block.getBlocks(:parents).each do |b|
|
|
182
|
+
b.config.dependency.each do |d|
|
|
183
|
+
next if d.inject == ""
|
|
184
|
+
|
|
185
|
+
dqname = "#{d.name},#{d.config}"
|
|
186
|
+
next if name == dqname
|
|
187
|
+
next if block.dependencies.include? dqname
|
|
188
|
+
dblock = Blocks::ALL_BLOCKS[dqname]
|
|
189
|
+
counter += 1
|
|
190
|
+
newD = MergeConfig::cloneModelElement(d)
|
|
191
|
+
newD.setInject("")
|
|
192
|
+
ls = block.config.getLibStuff
|
|
193
|
+
dblock.parents << block
|
|
194
|
+
|
|
195
|
+
if d.inject == "front"
|
|
196
|
+
block.config.setLibStuff(ls.unshift(newD))
|
|
197
|
+
block.childs.unshift dblock
|
|
198
|
+
block.dependencies.unshift dqname
|
|
199
|
+
else
|
|
200
|
+
block.config.setLibStuff(ls + [newD])
|
|
201
|
+
block.childs << dblock
|
|
202
|
+
block.dependencies << dqname
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
num_interations += 1
|
|
208
|
+
end while counter > 0
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def makeDot
|
|
212
|
+
|
|
213
|
+
File.open(Bake.options.dot, 'w') do |file|
|
|
214
|
+
puts "Creating #{Bake.options.dot}"
|
|
215
|
+
|
|
216
|
+
file.write "# Generated by bake\n"
|
|
217
|
+
file.write "# Example to show the graph: dot #{Bake.options.dot} -Tpng -o out.png\n"
|
|
218
|
+
file.write "# Example to reduce the graph: tred #{Bake.options.dot} | dot -Tpng -o out.png\n\n"
|
|
219
|
+
|
|
220
|
+
file.write "digraph #{Bake.options.main_project_name}_#{Bake.options.build_config} {\n\n"
|
|
221
|
+
|
|
222
|
+
file.write " concentrate = true\n\n"
|
|
223
|
+
|
|
224
|
+
onlyProjectName = nil
|
|
225
|
+
onlyConfigName = nil
|
|
226
|
+
if Bake.options.project
|
|
227
|
+
splitted = Bake.options.project.split(',')
|
|
228
|
+
onlyProjectName = splitted[0]
|
|
229
|
+
onlyConfigName = splitted[1] if splitted.length == 2
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
if onlyProjectName
|
|
233
|
+
if not @loadedConfig.referencedConfigs.include? onlyProjectName
|
|
234
|
+
Bake.formatter.printError("Error: project #{onlyProjectName} not found")
|
|
235
|
+
ExitHelper.exit(1)
|
|
236
|
+
end
|
|
237
|
+
if onlyConfigName
|
|
238
|
+
if not @loadedConfig.referencedConfigs[onlyProjectName].any? {|c| c.name == onlyConfigName}
|
|
239
|
+
Bake.formatter.printError("Error: project #{onlyProjectName} with config #{onlyConfigName} not found")
|
|
240
|
+
ExitHelper.exit(1)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
foundProjs = {}
|
|
246
|
+
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
247
|
+
configs.each do |config|
|
|
248
|
+
config.dependency.each do |d|
|
|
249
|
+
if onlyProjectName
|
|
250
|
+
next if config.parent.name != onlyProjectName && d.name != onlyProjectName
|
|
251
|
+
if onlyConfigName
|
|
252
|
+
leftSide = config.name == onlyConfigName && config.parent.name == onlyProjectName
|
|
253
|
+
rightSide = d.config == onlyConfigName && d.name == onlyProjectName
|
|
254
|
+
next if not leftSide and not rightSide
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
file.write " \"#{config.qname}\" -> \"#{d.name},#{d.config}\"\n"
|
|
258
|
+
|
|
259
|
+
foundProjs[config.parent.name] = [] if not foundProjs.include? config.parent.name
|
|
260
|
+
foundProjs[config.parent.name] << config.name if not foundProjs[config.parent.name].include? config.name
|
|
261
|
+
foundProjs[d.name] = [] if not foundProjs.include? d.name
|
|
262
|
+
foundProjs[d.name] << d.config if not foundProjs[config.parent.name].include? d.config
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
file.write "\n"
|
|
267
|
+
|
|
268
|
+
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
269
|
+
next if Bake.options.project and not foundProjs.include?projName
|
|
270
|
+
file.write " subgraph cluster_#{projName} {\n"
|
|
271
|
+
file.write " label =\"#{projName}\"\n"
|
|
272
|
+
configs.each do |config|
|
|
273
|
+
next if Bake.options.project and not foundProjs[projName].include? config.name
|
|
274
|
+
file.write " \"#{projName},#{config.name}\" [label = #{config.name}, style = filled, fillcolor = #{config.color}]\n"
|
|
275
|
+
end
|
|
276
|
+
file.write " }\n\n"
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
file.write "}\n"
|
|
130
280
|
end
|
|
281
|
+
|
|
282
|
+
ExitHelper.exit(0)
|
|
131
283
|
end
|
|
132
|
-
|
|
284
|
+
|
|
133
285
|
def convert2bb
|
|
134
286
|
@loadedConfig.referencedConfigs.each do |projName, configs|
|
|
135
287
|
configs.each do |config|
|
|
136
288
|
block = Blocks::ALL_BLOCKS[config.qname]
|
|
137
|
-
|
|
289
|
+
|
|
138
290
|
addSteps(block, block.startupSteps, config.startupSteps)
|
|
139
291
|
addSteps(block, block.exitSteps, config.exitSteps)
|
|
140
|
-
|
|
292
|
+
|
|
141
293
|
if not Bake.options.prepro and not Bake.options.lint and not Bake.options.conversion_info and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
|
|
142
294
|
addSteps(block, block.preSteps, config.preSteps)
|
|
143
295
|
addSteps(block, block.postSteps, config.postSteps)
|
|
144
296
|
end
|
|
145
|
-
|
|
297
|
+
|
|
146
298
|
if Bake.options.docu
|
|
147
299
|
block.mainSteps << Blocks::Docu.new(config, @configTcMap[config])
|
|
148
300
|
elsif Metamodel::CustomConfig === config
|
|
149
301
|
if not Bake.options.prepro and not Bake.options.lint and not Bake.options.conversion_info and not Bake.options.docu and not Bake.options.filename and not Bake.options.analyze
|
|
150
302
|
addSteps(block, block.mainSteps, config) if config.step
|
|
151
|
-
end
|
|
303
|
+
end
|
|
152
304
|
elsif Bake.options.conversion_info
|
|
153
305
|
block.mainSteps << Blocks::Convert.new(block, config, @loadedConfig.referencedConfigs, @configTcMap[config])
|
|
154
306
|
elsif Bake.options.lint
|
|
@@ -167,7 +319,7 @@ module Bake
|
|
|
167
319
|
end
|
|
168
320
|
|
|
169
321
|
|
|
170
|
-
|
|
322
|
+
|
|
171
323
|
end
|
|
172
324
|
end
|
|
173
325
|
end
|
|
@@ -181,11 +333,11 @@ module Bake
|
|
|
181
333
|
if Bake.options.debug
|
|
182
334
|
puts ex.message
|
|
183
335
|
puts ex.backtrace
|
|
184
|
-
end
|
|
336
|
+
end
|
|
185
337
|
return false
|
|
186
338
|
end
|
|
187
339
|
end
|
|
188
|
-
|
|
340
|
+
|
|
189
341
|
def callBlocks(startBlocks, method, ignoreStopOnFirstError = false)
|
|
190
342
|
Blocks::ALL_BLOCKS.each {|name,block| block.visited = false; block.result = true; block.inDeps = false }
|
|
191
343
|
Blocks::Block.reset_block_counter
|
|
@@ -198,7 +350,7 @@ module Bake
|
|
|
198
350
|
end
|
|
199
351
|
return result
|
|
200
352
|
end
|
|
201
|
-
|
|
353
|
+
|
|
202
354
|
def calcStartBlocks
|
|
203
355
|
startProjectName = nil
|
|
204
356
|
startConfigName = nil
|
|
@@ -233,9 +385,9 @@ module Bake
|
|
|
233
385
|
startBlocks = [Blocks::ALL_BLOCKS[Bake.options.main_project_name+","+Bake.options.build_config]]
|
|
234
386
|
Blocks::Block.set_num_projects(Blocks::ALL_BLOCKS.length)
|
|
235
387
|
end
|
|
236
|
-
return startBlocks
|
|
388
|
+
return startBlocks
|
|
237
389
|
end
|
|
238
|
-
|
|
390
|
+
|
|
239
391
|
def doit()
|
|
240
392
|
|
|
241
393
|
taskType = "Building"
|
|
@@ -253,19 +405,19 @@ module Bake
|
|
|
253
405
|
taskType = "Rebuilding"
|
|
254
406
|
elsif Bake.options.clean
|
|
255
407
|
taskType = "Cleaning"
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
begin
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
begin
|
|
259
411
|
al = AdaptConfig.new
|
|
260
412
|
adaptConfigs = al.load()
|
|
261
|
-
|
|
413
|
+
|
|
262
414
|
@loadedConfig = Config.new
|
|
263
415
|
@loadedConfig.load(adaptConfigs)
|
|
264
|
-
|
|
416
|
+
|
|
265
417
|
taskType = "Analyzing" if Bake.options.analyze
|
|
266
|
-
|
|
418
|
+
|
|
267
419
|
@mainConfig = @loadedConfig.referencedConfigs[Bake.options.main_project_name].select { |c| c.name == Bake.options.build_config }.first
|
|
268
|
-
|
|
420
|
+
|
|
269
421
|
if Bake.options.lint
|
|
270
422
|
@defaultToolchain = Utils.deep_copy(Bake::Toolchain::Provider["Lint"])
|
|
271
423
|
else
|
|
@@ -276,7 +428,7 @@ module Bake
|
|
|
276
428
|
ExitHelper.exit(1)
|
|
277
429
|
end
|
|
278
430
|
|
|
279
|
-
# The flag "-FS" must only be set for VS2013 and above
|
|
431
|
+
# The flag "-FS" must only be set for VS2013 and above
|
|
280
432
|
ENV["MSVC_FORCE_SYNC_PDB_WRITES"] = ""
|
|
281
433
|
if basedOn == "MSVC"
|
|
282
434
|
begin
|
|
@@ -296,33 +448,38 @@ module Bake
|
|
|
296
448
|
ExitHelper.exit(1)
|
|
297
449
|
end
|
|
298
450
|
end
|
|
299
|
-
|
|
451
|
+
|
|
300
452
|
@defaultToolchain = Utils.deep_copy(basedOnToolchain)
|
|
301
453
|
Bake.options.envToolchain = true if (basedOn.include?"_ENV")
|
|
302
454
|
end
|
|
303
455
|
integrateToolchain(@defaultToolchain, @mainConfig.defaultToolchain)
|
|
304
|
-
|
|
456
|
+
|
|
305
457
|
# todo: cleanup this hack
|
|
306
458
|
Bake.options.analyze = @defaultToolchain[:COMPILER][:CPP][:COMPILE_FLAGS].include?"analyze"
|
|
307
459
|
Bake.options.eclipseOrder = @mainConfig.defaultToolchain.eclipseOrder
|
|
308
|
-
|
|
460
|
+
|
|
309
461
|
createBaseTcsForConfig
|
|
310
462
|
substVars
|
|
311
463
|
createTcsForConfig
|
|
312
|
-
|
|
464
|
+
|
|
313
465
|
@@linkBlock = 0
|
|
314
|
-
|
|
466
|
+
|
|
467
|
+
@prebuild = nil
|
|
468
|
+
calcPrebuildBlocks if Bake.options.prebuild
|
|
469
|
+
|
|
315
470
|
makeBlocks
|
|
316
471
|
makeGraph
|
|
472
|
+
makeDot if Bake.options.dot
|
|
473
|
+
|
|
317
474
|
convert2bb
|
|
318
|
-
|
|
475
|
+
|
|
319
476
|
Blocks::Show.includes if Bake.options.show_includes
|
|
320
477
|
Blocks::Show.includesAndDefines(@mainConfig, @configTcMap[@mainConfig]) if Bake.options.show_includes_and_defines
|
|
321
|
-
|
|
478
|
+
|
|
322
479
|
startBlocks = calcStartBlocks
|
|
323
480
|
|
|
324
481
|
Bake::IDEInterface.instance.set_build_info(@mainConfig.parent.name, @mainConfig.name, Blocks::ALL_BLOCKS.length)
|
|
325
|
-
|
|
482
|
+
|
|
326
483
|
ideAbort = false
|
|
327
484
|
begin
|
|
328
485
|
result = callBlocks(startBlocks, :startup, true)
|
|
@@ -335,21 +492,21 @@ module Bake
|
|
|
335
492
|
if not Bake.options.stopOnFirstError or result
|
|
336
493
|
result = callBlocks(startBlocks, :execute) && result
|
|
337
494
|
end
|
|
338
|
-
end
|
|
495
|
+
end
|
|
339
496
|
rescue AbortException
|
|
340
497
|
ideAbort = true
|
|
341
498
|
end
|
|
342
499
|
result = callBlocks(startBlocks, :exits, true) && result
|
|
343
|
-
|
|
500
|
+
|
|
344
501
|
if ideAbort
|
|
345
502
|
Bake.formatter.printError("\n#{taskType} aborted.")
|
|
346
503
|
ExitHelper.set_exit_code(1)
|
|
347
504
|
return
|
|
348
505
|
end
|
|
349
|
-
|
|
506
|
+
|
|
350
507
|
if Bake.options.cc2j_filename
|
|
351
508
|
Blocks::BlockBase.prepareOutput(Bake.options.cc2j_filename)
|
|
352
|
-
File.open(Bake.options.cc2j_filename, 'w') do |f|
|
|
509
|
+
File.open(Bake.options.cc2j_filename, 'w') do |f|
|
|
353
510
|
f.puts "["
|
|
354
511
|
noComma = Blocks::CC2J.length - 1
|
|
355
512
|
Blocks::CC2J.each_with_index do |c, index|
|
|
@@ -361,7 +518,7 @@ module Bake
|
|
|
361
518
|
f.puts "]"
|
|
362
519
|
end
|
|
363
520
|
end
|
|
364
|
-
|
|
521
|
+
|
|
365
522
|
if result == false
|
|
366
523
|
Bake.formatter.printError("\n#{taskType} failed.")
|
|
367
524
|
ExitHelper.set_exit_code(1)
|
|
@@ -376,7 +533,7 @@ module Bake
|
|
|
376
533
|
rescue SystemExit
|
|
377
534
|
Bake.formatter.printError("\n#{taskType} failed.") if ExitHelper.exit_code != 0
|
|
378
535
|
end
|
|
379
|
-
|
|
536
|
+
|
|
380
537
|
end
|
|
381
538
|
|
|
382
539
|
def connect()
|