bake-toolkit 2.24.0 → 2.24.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,55 +1,59 @@
1
- require 'common/utils'
2
- require 'bake/toolchain/provider'
3
- require 'bake/toolchain/errorparser/error_parser'
4
- require 'bake/toolchain/errorparser/gcc_compiler_error_parser'
5
- require 'bake/toolchain/errorparser/gcc_linker_error_parser'
6
-
7
- module Bake
8
- module Toolchain
9
-
10
- def self.getGccVersion
11
- gccVersionStr = `g++ --version`
12
- splitted = gccVersionStr.split("\n")[0].split(" ")
13
- return splitted[splitted.length-1].split(".").map { |v| v.to_i }
14
- end
15
-
16
- GCCChain = Provider.add("GCC")
17
-
18
- GCCChain[:COMPILER][:CPP].update({
19
- :COMMAND => "g++",
20
- :DEFINE_FLAG => "-D",
21
- :OBJECT_FILE_FLAG => "-o",
22
- :OBJ_FLAG_SPACE => true,
23
- :INCLUDE_PATH_FLAG => "-I",
24
- :COMPILE_FLAGS => "-c ",
25
- :DEP_FLAGS => "-MD -MF",
26
- :DEP_FLAGS_SPACE => true,
27
- :PREPRO_FLAGS => "-E -P"
28
- })
29
-
30
- GCCChain[:COMPILER][:C] = Utils.deep_copy(GCCChain[:COMPILER][:CPP])
31
- GCCChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
32
- GCCChain[:COMPILER][:C][:COMMAND] = "gcc"
33
-
34
- GCCChain[:COMPILER][:ASM] = Utils.deep_copy(GCCChain[:COMPILER][:C])
35
- GCCChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
36
-
37
- GCCChain[:ARCHIVER][:COMMAND] = "ar"
38
- GCCChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-rc"
39
-
40
- GCCChain[:LINKER][:COMMAND] = "g++"
41
- GCCChain[:LINKER][:SCRIPT] = "-T"
42
- GCCChain[:LINKER][:USER_LIB_FLAG] = "-l:"
43
- GCCChain[:LINKER][:EXE_FLAG] = "-o"
44
- GCCChain[:LINKER][:LIB_FLAG] = "-l"
45
- GCCChain[:LINKER][:LIB_PATH_FLAG] = "-L"
46
-
47
- gccCompilerErrorParser = GCCCompilerErrorParser.new
48
- GCCChain[:COMPILER][:C][:ERROR_PARSER] = gccCompilerErrorParser
49
- GCCChain[:COMPILER][:CPP][:ERROR_PARSER] = gccCompilerErrorParser
50
- GCCChain[:COMPILER][:ASM][:ERROR_PARSER] = gccCompilerErrorParser
51
- GCCChain[:ARCHIVER][:ERROR_PARSER] = gccCompilerErrorParser
52
- GCCChain[:LINKER][:ERROR_PARSER] = GCCLinkerErrorParser.new
53
-
54
- end
55
- end
1
+ require 'common/utils'
2
+ require 'bake/toolchain/provider'
3
+ require 'bake/toolchain/errorparser/error_parser'
4
+ require 'bake/toolchain/errorparser/gcc_compiler_error_parser'
5
+ require 'bake/toolchain/errorparser/gcc_linker_error_parser'
6
+
7
+ module Bake
8
+ module Toolchain
9
+
10
+ def self.getGccVersion
11
+ gccVersionStr = `g++ --version`
12
+ splitted = gccVersionStr.split("\n")[0].split(" ")
13
+ return splitted[splitted.length-1].split(".").map { |v| v.to_i }
14
+ end
15
+
16
+ def self.getGccPlatform
17
+ `g++ -dumpmachine`
18
+ end
19
+
20
+ GCCChain = Provider.add("GCC")
21
+
22
+ GCCChain[:COMPILER][:CPP].update({
23
+ :COMMAND => "g++",
24
+ :DEFINE_FLAG => "-D",
25
+ :OBJECT_FILE_FLAG => "-o",
26
+ :OBJ_FLAG_SPACE => true,
27
+ :INCLUDE_PATH_FLAG => "-I",
28
+ :COMPILE_FLAGS => "-c ",
29
+ :DEP_FLAGS => "-MD -MF",
30
+ :DEP_FLAGS_SPACE => true,
31
+ :PREPRO_FLAGS => "-E -P"
32
+ })
33
+
34
+ GCCChain[:COMPILER][:C] = Utils.deep_copy(GCCChain[:COMPILER][:CPP])
35
+ GCCChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
36
+ GCCChain[:COMPILER][:C][:COMMAND] = "gcc"
37
+
38
+ GCCChain[:COMPILER][:ASM] = Utils.deep_copy(GCCChain[:COMPILER][:C])
39
+ GCCChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
40
+
41
+ GCCChain[:ARCHIVER][:COMMAND] = "ar"
42
+ GCCChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-rc"
43
+
44
+ GCCChain[:LINKER][:COMMAND] = "g++"
45
+ GCCChain[:LINKER][:SCRIPT] = "-T"
46
+ GCCChain[:LINKER][:USER_LIB_FLAG] = "-l:"
47
+ GCCChain[:LINKER][:EXE_FLAG] = "-o"
48
+ GCCChain[:LINKER][:LIB_FLAG] = "-l"
49
+ GCCChain[:LINKER][:LIB_PATH_FLAG] = "-L"
50
+
51
+ gccCompilerErrorParser = GCCCompilerErrorParser.new
52
+ GCCChain[:COMPILER][:C][:ERROR_PARSER] = gccCompilerErrorParser
53
+ GCCChain[:COMPILER][:CPP][:ERROR_PARSER] = gccCompilerErrorParser
54
+ GCCChain[:COMPILER][:ASM][:ERROR_PARSER] = gccCompilerErrorParser
55
+ GCCChain[:ARCHIVER][:ERROR_PARSER] = gccCompilerErrorParser
56
+ GCCChain[:LINKER][:ERROR_PARSER] = GCCLinkerErrorParser.new
57
+
58
+ end
59
+ end
@@ -111,7 +111,7 @@ module Bake
111
111
  parse_internal(true, bakeOptions)
112
112
  set_main_dir(Dir.pwd) if @main_dir.nil?
113
113
 
114
- if not ENV["QAC_HOME"]
114
+ if !ENV["QAC_HOME"] || ENV["QAC_HOME"].empty?
115
115
  Bake.formatter.printError("Error: specify the environment variable QAC_HOME.")
116
116
  ExitHelper.exit(1)
117
117
  end
@@ -135,14 +135,26 @@ module Bake
135
135
  ExitHelper.exit(1)
136
136
  end
137
137
 
138
- if RUBY_PLATFORM =~ /mingw/
138
+ plStr = nil
139
+ gccPlatform = Bake::Toolchain::getGccPlatform
140
+ if gccPlatform.include?"mingw"
139
141
  plStr = "w64-mingw32"
140
- elsif RUBY_PLATFORM =~ /cygwin/
142
+ elsif gccPlatform.include?"cygwin"
141
143
  plStr = "pc-cygwin"
142
- else
144
+ elsif gccPlatform.include?"linux"
143
145
  plStr = "generic-linux"
144
146
  end
145
147
 
148
+ if plStr.nil? # fallback
149
+ if RUBY_PLATFORM =~ /mingw/
150
+ plStr = "w64-mingw32"
151
+ elsif RUBY_PLATFORM =~ /cygwin/
152
+ plStr = "pc-cygwin"
153
+ else
154
+ plStr = "generic-linux"
155
+ end
156
+ end
157
+
146
158
  while (@cct.empty? or gccVersion[0]>=5)
147
159
  @cct = [qac_home + "/config/cct/GNU_GCC-g++_#{gccVersion[0]}.#{gccVersion[1]}-i686-#{plStr}-C++#{@cVersion}.cct"]
148
160
  break if File.exist?@cct[0]
@@ -155,11 +167,11 @@ module Bake
155
167
  gccVersion[1] = 20
156
168
  end
157
169
  end
158
-
159
- cctInDir = searchCctFile(@main_dir)
160
- @cct_append = cctInDir.gsub(/[\\]/,'/') if cctInDir
161
170
  end
162
171
 
172
+ cctInDir = searchCctFile(@main_dir)
173
+ @cct_append = cctInDir.gsub(/[\\]/,'/') if cctInDir
174
+
163
175
  if @acf.nil?
164
176
  @acf = qac_home + "/config/acf/default.acf"
165
177
  end
data/lib/blocks/block.rb CHANGED
@@ -1,324 +1,334 @@
1
- require 'bake/libElement'
2
- require 'common/abortException'
3
-
4
- module Bake
5
-
6
- BUILD_PASSED = 0
7
- BUILD_FAILED = 1
8
- BUILD_ABORTED = 2
9
-
10
- module Blocks
11
-
12
- CC2J = []
13
- ALL_BLOCKS = {}
14
- ALL_COMPILE_BLOCKS = {}
15
-
16
- class Block
17
-
18
- attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :warnConvValid, :prebuild
19
- attr_accessor :visited, :inDeps, :result
20
-
21
- def startupSteps
22
- @startupSteps ||= []
23
- end
24
-
25
- def preSteps
26
- @preSteps ||= []
27
- end
28
-
29
- def mainSteps
30
- @mainSteps ||= []
31
- end
32
-
33
- def postSteps
34
- @postSteps ||= []
35
- end
36
-
37
- def exitSteps
38
- @exitSteps ||= []
39
- end
40
-
41
- def dependencies
42
- @dependencies ||= []
43
- end
44
-
45
- def childs
46
- @childs ||= []
47
- end
48
-
49
- def parents
50
- @parents ||= []
51
- end
52
-
53
- def set_library(library)
54
- @library = library
55
- end
56
-
57
- def initialize(config, referencedConfigs, prebuild)
58
- @inDeps = false
59
- @prebuild = prebuild
60
- @visited = false
61
- @library = nil
62
- @config = config
63
- @referencedConfigs = referencedConfigs
64
- @projectName = config.parent.name
65
- @configName = config.name
66
- @projectDir = config.get_project_dir
67
- @@block_counter = 0
68
- @result = true
69
-
70
- @lib_elements = Bake::LibElements.calcLibElements(self)
71
- end
72
-
73
- def getCompileBlocks()
74
- mainSteps.select { |m| Compile === m }
75
- end
76
-
77
- def convPath(dir, elem=nil, warnIfLocal=false)
78
- if dir.respond_to?("name")
79
- d = dir.name
80
- elem = dir
81
- else
82
- d = dir
83
- end
84
-
85
- @warnConvValid = false
86
-
87
- return d if Bake.options.no_autodir
88
-
89
- inc = d.split("/")
90
- res = nil
91
- if (inc[0] == @projectName)
92
- res = inc[1..-1].join("/") # within self
93
- res = "." if res == ""
94
- elsif @referencedConfigs.include?(inc[0])
95
- dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
96
- res = File.rel_from_to_project(@projectDir, dirOther, false)
97
- postfix = inc[1..-1].join("/")
98
- res = res + "/" + postfix if postfix != ""
99
- else
100
- if (inc[0] != "..")
101
- return d if File.exists?(@projectDir + "/" + d) # e.g. "include"
102
- # check if dir exists without Project.meta entry
103
- Bake.options.roots.each do |r|
104
- absIncDir = r+"/"+d
105
- if File.exists?(absIncDir)
106
- res = File.rel_from_to_project(@projectDir,absIncDir,false)
107
- end
108
- end
109
- else
110
- if elem and Bake.options.verbose >= 2
111
- Bake.formatter.printInfo("\"..\" in path name found", elem)
112
- end
113
- end
114
-
115
- if res.nil? # relative from self as last resort
116
- warnIfLocal = false # no path magic -> no warning
117
- res = d
118
- end
119
- end
120
-
121
- @warnConvValid = File.exists?(@projectDir + "/" + d) if warnIfLocal # only warn if path magic hides local path
122
-
123
- res
124
- end
125
-
126
-
127
- def self.block_counter
128
- @@block_counter += 1
129
- end
130
-
131
- def self.reset_block_counter
132
- @@block_counter = 0
133
- end
134
-
135
- def self.set_num_projects(num)
136
- @@num_projects = num
137
- end
138
-
139
- def executeStep(step, method)
140
- begin
141
- @result = step.send(method) && @result
142
- rescue Bake::SystemCommandFailed => scf
143
- @result = false
144
- ProcessHelper.killProcess(true)
145
- rescue SystemExit => exSys
146
- @result = false
147
- ProcessHelper.killProcess(true)
148
- rescue Exception => ex1
149
- @result = false
150
- if not Bake::IDEInterface.instance.get_abort
151
- Bake.formatter.printError("Error: #{ex1.message}")
152
- puts ex1.backtrace if Bake.options.debug
153
- end
154
- end
155
-
156
- if Bake::IDEInterface.instance.get_abort
157
- raise AbortException.new
158
- end
159
-
160
- # needed for ctrl-c in Cygwin console
161
- #####################################
162
- # additionally, the user has to enable raw mode of Cygwin console: "stty raw".
163
- # raw mode changes the signals into raw characters.
164
- # original problem: Cygwin is compiled with broken control handler config,
165
- # which might not be changed due to backward compatibility.
166
- # the control handler works only with programs compiled under Cygwin, which is
167
- # not true for Windows RubyInstaller packages.
168
- ctrl_c_found = false
169
- begin
170
- while IO.select([$stdin],nil,nil,0) do
171
- nextChar = $stdin.sysread(1)
172
- if nextChar == "\x03"
173
- ctrl_c_found = true
174
- end
175
- end
176
- rescue Exception => e
177
- end
178
- raise AbortException.new if ctrl_c_found
179
-
180
- return @result
181
- end
182
-
183
- def callDeps(method)
184
- depResult = true
185
- dependencies.each do |dep|
186
- depResult = (ALL_BLOCKS[dep].send(method) and depResult)
187
- break if not depResult and Bake.options.stopOnFirstError
188
- end
189
- return depResult
190
- end
191
-
192
- def callSteps(method)
193
-
194
- preSteps.each do |step|
195
- @result = executeStep(step, method) if @result
196
- return false if not @result and Bake.options.stopOnFirstError
197
- end unless @prebuild
198
-
199
- mainSteps.each do |step|
200
- if !@prebuild || (Library === step)
201
- @result = executeStep(step, method) if @result
202
- end
203
- return false if not @result and Bake.options.stopOnFirstError
204
- end
205
-
206
- postSteps.each do |step|
207
- @result = executeStep(step, method) if @result
208
- return false if not @result and Bake.options.stopOnFirstError
209
- end unless @prebuild
210
-
211
- return @result
212
- end
213
-
214
- def execute
215
- if (@inDeps)
216
- if Bake.options.verbose >= 3
217
- Bake.formatter.printWarning("While calculating next config, a circular dependency was found including project #{@projectName} with config #{@configName}", @config)
218
- end
219
- return true
220
- end
221
-
222
- return true if (@visited)
223
- @visited = true
224
-
225
- @inDeps = true
226
- depResult = callDeps(:execute)
227
- @inDeps = false
228
- return false if not depResult and Bake.options.stopOnFirstError
229
-
230
- Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
231
-
232
- if Bake.options.verbose >= 1
233
- typeStr = @prebuild ? "Using" : "Building"
234
- Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
235
- end
236
- puts "Project path: #{@projectDir}" if Bake.options.projectPaths
237
-
238
- @result = callSteps(:execute)
239
- return (depResult && @result)
240
- end
241
-
242
- def clean
243
- return true if (@visited)
244
- @visited = true
245
-
246
- depResult = callDeps(:clean)
247
- return false if not depResult and Bake.options.stopOnFirstError
248
-
249
- if Bake.options.verbose >= 2
250
- typeStr = @prebuild ? "Checking" : "Cleaning"
251
- Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
252
- end
253
-
254
- @result = callSteps(:clean)
255
-
256
- if Bake.options.clobber
257
- Dir.chdir(@projectDir) do
258
- if File.exist?".bake"
259
- puts "Deleting folder .bake" if Bake.options.verbose >= 2
260
- FileUtils.rm_rf(".bake")
261
- end
262
- end
263
- end
264
-
265
- return (depResult && @result)
266
- end
267
-
268
- def startup
269
- return true if (@visited)
270
- @visited = true
271
-
272
- depResult = callDeps(:startup)
273
-
274
- if Bake.options.verbose >= 1 and not startupSteps.empty?
275
- Bake.formatter.printAdditionalInfo "**** Starting up #{@projectName} (#{@configName}) ****"
276
- end
277
-
278
- startupSteps.each do |step|
279
- @result = executeStep(step, :startupStep) && @result
280
- end
281
-
282
- return (depResult && @result)
283
- end
284
-
285
- def exits
286
- return true if (@visited)
287
- @visited = true
288
-
289
- depResult = callDeps(:exits)
290
-
291
- if Bake.options.verbose >= 1 and not exitSteps.empty?
292
- Bake.formatter.printAdditionalInfo "**** Exiting #{@projectName} (#{@configName}) ****"
293
- end
294
-
295
- exitSteps.each do |step|
296
- @result = executeStep(step, :exitStep) && @result
297
- end
298
-
299
- return (depResult && @result)
300
- end
301
-
302
- def getSubBlocks(b, method)
303
- b.send(method).each do |child_b|
304
- if not @otherBlocks.include?child_b and not child_b == self
305
- @otherBlocks << child_b
306
- getSubBlocks(child_b, method)
307
- end
308
- end
309
- end
310
-
311
- def getBlocks(method)
312
- @otherBlocks = []
313
- getSubBlocks(self, method)
314
- return @otherBlocks
315
- end
316
-
317
- end
318
-
319
-
320
-
321
- end
322
-
323
-
1
+ require 'bake/libElement'
2
+ require 'common/abortException'
3
+
4
+ module Bake
5
+
6
+ BUILD_PASSED = 0
7
+ BUILD_FAILED = 1
8
+ BUILD_ABORTED = 2
9
+
10
+ module Blocks
11
+
12
+ CC2J = []
13
+ ALL_BLOCKS = {}
14
+ ALL_COMPILE_BLOCKS = {}
15
+
16
+ class Block
17
+
18
+ attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :prebuild
19
+ attr_accessor :visited, :inDeps, :result
20
+
21
+ def startupSteps
22
+ @startupSteps ||= []
23
+ end
24
+
25
+ def preSteps
26
+ @preSteps ||= []
27
+ end
28
+
29
+ def mainSteps
30
+ @mainSteps ||= []
31
+ end
32
+
33
+ def postSteps
34
+ @postSteps ||= []
35
+ end
36
+
37
+ def exitSteps
38
+ @exitSteps ||= []
39
+ end
40
+
41
+ def dependencies
42
+ @dependencies ||= []
43
+ end
44
+
45
+ def childs
46
+ @childs ||= []
47
+ end
48
+
49
+ def parents
50
+ @parents ||= []
51
+ end
52
+
53
+ def set_library(library)
54
+ @library = library
55
+ end
56
+
57
+ def initialize(config, referencedConfigs, prebuild)
58
+ @inDeps = false
59
+ @prebuild = prebuild
60
+ @visited = false
61
+ @library = nil
62
+ @config = config
63
+ @referencedConfigs = referencedConfigs
64
+ @projectName = config.parent.name
65
+ @configName = config.name
66
+ @projectDir = config.get_project_dir
67
+ @@block_counter = 0
68
+ @result = true
69
+
70
+ @lib_elements = Bake::LibElements.calcLibElements(self)
71
+ end
72
+
73
+ def getCompileBlocks()
74
+ mainSteps.select { |m| Compile === m }
75
+ end
76
+
77
+ def convPath(dir, elem=nil, warnIfLocal=false)
78
+ if dir.respond_to?("name")
79
+ d = dir.name
80
+ elem = dir
81
+ else
82
+ d = dir
83
+ end
84
+
85
+ return d if Bake.options.no_autodir
86
+
87
+ inc = d.split("/")
88
+ if (inc[0] == "..") # very simple check, but should be okay for 99.9 % of the cases
89
+ if elem and Bake.options.verbose >= 2
90
+ Bake.formatter.printInfo("path starts with \"..\"", elem)
91
+ end
92
+ end
93
+
94
+ res = []
95
+
96
+ if (inc[0] == @projectName) # prio 1: the real path magic
97
+ resPathMagic = inc[1..-1].join("/") # within self
98
+ resPathMagic = "." if resPathMagic == ""
99
+ res << resPathMagic
100
+ elsif @referencedConfigs.include?(inc[0])
101
+ dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
102
+ resPathMagic = File.rel_from_to_project(@projectDir, dirOther, false)
103
+ postfix = inc[1..-1].join("/")
104
+ resPathMagic = resPathMagic + "/" + postfix if postfix != ""
105
+ resPathMagic = "." if resPathMagic == ""
106
+ res << resPathMagic
107
+ end
108
+
109
+ if File.exists?(@projectDir + "/" + d) # prio 2: local, e.g. "include"
110
+ res << d
111
+ end
112
+
113
+ # prioo 3: check if dir exists without Project.meta entry
114
+ Bake.options.roots.each do |r|
115
+ absIncDir = r+"/"+d
116
+ if File.exists?(absIncDir)
117
+ res << File.rel_from_to_project(@projectDir,absIncDir,false)
118
+ end
119
+ end
120
+
121
+ return d if res.empty? # prio 4: fallback, no path found
122
+
123
+ res = res.map{ |r| Pathname.new(r).cleanpath.to_s }.uniq
124
+
125
+ if warnIfLocal && res.length > 1
126
+ if elem and Bake.options.verbose >= 2
127
+ Bake.formatter.printInfo("#{d} matches several paths:", elem)
128
+ puts " #{res[0]} (chosen)"
129
+ res[1..-1].each { |r| puts " #{r}" }
130
+ end
131
+ end
132
+
133
+ res[0]
134
+ end
135
+
136
+
137
+ def self.block_counter
138
+ @@block_counter += 1
139
+ end
140
+
141
+ def self.reset_block_counter
142
+ @@block_counter = 0
143
+ end
144
+
145
+ def self.set_num_projects(num)
146
+ @@num_projects = num
147
+ end
148
+
149
+ def executeStep(step, method)
150
+ begin
151
+ @result = step.send(method) && @result
152
+ rescue Bake::SystemCommandFailed => scf
153
+ @result = false
154
+ ProcessHelper.killProcess(true)
155
+ rescue SystemExit => exSys
156
+ @result = false
157
+ ProcessHelper.killProcess(true)
158
+ rescue Exception => ex1
159
+ @result = false
160
+ if not Bake::IDEInterface.instance.get_abort
161
+ Bake.formatter.printError("Error: #{ex1.message}")
162
+ puts ex1.backtrace if Bake.options.debug
163
+ end
164
+ end
165
+
166
+ if Bake::IDEInterface.instance.get_abort
167
+ raise AbortException.new
168
+ end
169
+
170
+ # needed for ctrl-c in Cygwin console
171
+ #####################################
172
+ # additionally, the user has to enable raw mode of Cygwin console: "stty raw".
173
+ # raw mode changes the signals into raw characters.
174
+ # original problem: Cygwin is compiled with broken control handler config,
175
+ # which might not be changed due to backward compatibility.
176
+ # the control handler works only with programs compiled under Cygwin, which is
177
+ # not true for Windows RubyInstaller packages.
178
+ ctrl_c_found = false
179
+ begin
180
+ while IO.select([$stdin],nil,nil,0) do
181
+ nextChar = $stdin.sysread(1)
182
+ if nextChar == "\x03"
183
+ ctrl_c_found = true
184
+ end
185
+ end
186
+ rescue Exception => e
187
+ end
188
+ raise AbortException.new if ctrl_c_found
189
+
190
+ return @result
191
+ end
192
+
193
+ def callDeps(method)
194
+ depResult = true
195
+ dependencies.each do |dep|
196
+ depResult = (ALL_BLOCKS[dep].send(method) and depResult)
197
+ break if not depResult and Bake.options.stopOnFirstError
198
+ end
199
+ return depResult
200
+ end
201
+
202
+ def callSteps(method)
203
+
204
+ preSteps.each do |step|
205
+ @result = executeStep(step, method) if @result
206
+ return false if not @result and Bake.options.stopOnFirstError
207
+ end unless @prebuild
208
+
209
+ mainSteps.each do |step|
210
+ if !@prebuild || (Library === step)
211
+ @result = executeStep(step, method) if @result
212
+ end
213
+ return false if not @result and Bake.options.stopOnFirstError
214
+ end
215
+
216
+ postSteps.each do |step|
217
+ @result = executeStep(step, method) if @result
218
+ return false if not @result and Bake.options.stopOnFirstError
219
+ end unless @prebuild
220
+
221
+ return @result
222
+ end
223
+
224
+ def execute
225
+ if (@inDeps)
226
+ if Bake.options.verbose >= 3
227
+ Bake.formatter.printWarning("While calculating next config, a circular dependency was found including project #{@projectName} with config #{@configName}", @config)
228
+ end
229
+ return true
230
+ end
231
+
232
+ return true if (@visited)
233
+ @visited = true
234
+
235
+ @inDeps = true
236
+ depResult = callDeps(:execute)
237
+ @inDeps = false
238
+ return false if not depResult and Bake.options.stopOnFirstError
239
+
240
+ Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
241
+
242
+ if Bake.options.verbose >= 1
243
+ typeStr = @prebuild ? "Using" : "Building"
244
+ Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
245
+ end
246
+ puts "Project path: #{@projectDir}" if Bake.options.projectPaths
247
+
248
+ @result = callSteps(:execute)
249
+ return (depResult && @result)
250
+ end
251
+
252
+ def clean
253
+ return true if (@visited)
254
+ @visited = true
255
+
256
+ depResult = callDeps(:clean)
257
+ return false if not depResult and Bake.options.stopOnFirstError
258
+
259
+ if Bake.options.verbose >= 2
260
+ typeStr = @prebuild ? "Checking" : "Cleaning"
261
+ Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
262
+ end
263
+
264
+ @result = callSteps(:clean)
265
+
266
+ if Bake.options.clobber
267
+ Dir.chdir(@projectDir) do
268
+ if File.exist?".bake"
269
+ puts "Deleting folder .bake" if Bake.options.verbose >= 2
270
+ FileUtils.rm_rf(".bake")
271
+ end
272
+ end
273
+ end
274
+
275
+ return (depResult && @result)
276
+ end
277
+
278
+ def startup
279
+ return true if (@visited)
280
+ @visited = true
281
+
282
+ depResult = callDeps(:startup)
283
+
284
+ if Bake.options.verbose >= 1 and not startupSteps.empty?
285
+ Bake.formatter.printAdditionalInfo "**** Starting up #{@projectName} (#{@configName}) ****"
286
+ end
287
+
288
+ startupSteps.each do |step|
289
+ @result = executeStep(step, :startupStep) && @result
290
+ end
291
+
292
+ return (depResult && @result)
293
+ end
294
+
295
+ def exits
296
+ return true if (@visited)
297
+ @visited = true
298
+
299
+ depResult = callDeps(:exits)
300
+
301
+ if Bake.options.verbose >= 1 and not exitSteps.empty?
302
+ Bake.formatter.printAdditionalInfo "**** Exiting #{@projectName} (#{@configName}) ****"
303
+ end
304
+
305
+ exitSteps.each do |step|
306
+ @result = executeStep(step, :exitStep) && @result
307
+ end
308
+
309
+ return (depResult && @result)
310
+ end
311
+
312
+ def getSubBlocks(b, method)
313
+ b.send(method).each do |child_b|
314
+ if not @otherBlocks.include?child_b and not child_b == self
315
+ @otherBlocks << child_b
316
+ getSubBlocks(child_b, method)
317
+ end
318
+ end
319
+ end
320
+
321
+ def getBlocks(method)
322
+ @otherBlocks = []
323
+ getSubBlocks(self, method)
324
+ return @otherBlocks
325
+ end
326
+
327
+ end
328
+
329
+
330
+
331
+ end
332
+
333
+
324
334
  end