Class: Rake::Task
- Inherits:
-
Object
- Object
- Rake::Task
- Defined in:
- lib/cxxproject/ext/rake.rb,
lib/cxxproject/ext/rake_dirty.rb
Direct Known Subclasses
Constant Summary collapse
- UNKNOWN =
0x0000- OBJECT =
0x0001- SOURCEMULTI =
x
0x0002- DEPFILE =
0x0004- LIBRARY =
x
0x0008- EXECUTABLE =
x
0x0010- CONFIG =
0x0020- APPLY =
0x0040- UTIL =
0x0080- BINARY =
x
0x0100- MODULE =
x
0x0200- MAKE =
x
0x0400- RUN =
0x0800- CUSTOM =
x
0x1000- COMMANDLINE =
x
0x2000- SHARED_LIBRARY =
x
0x4000- STANDARD =
x above means included in STANDARD
0x371A
- @@bail_on_first_error =
true
Class Attribute Summary collapse
-
.output_disabled ⇒ Object
Returns the value of attribute output_disabled.
Instance Attribute Summary collapse
-
#deps ⇒ Object
used to store deps by depfile task for the apply task (no re-read of depsfile).
-
#failure ⇒ Object
specified if that task has failed.
-
#ignore ⇒ Object
readonly
Returns the value of attribute ignore.
-
#immediate_output ⇒ Object
Returns the value of attribute immediate_output.
-
#output_after_execute ⇒ Object
Returns the value of attribute output_after_execute.
-
#output_string ⇒ Object
Returns the value of attribute output_string.
-
#prerequisites ⇒ Object
Returns the value of attribute prerequisites.
- #tags ⇒ Object
-
#transparent_timestamp ⇒ Object
Returns the value of attribute transparent_timestamp.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #calc_dirty_for_prerequsites ⇒ Object
-
#dirty? ⇒ Boolean
return true if this or one of the prerequisites is dirty.
- #handle_error(exception, isSysCmd) ⇒ Object
- #ignore_missing_file ⇒ Object
- #new_execute(execute_org, arg) ⇒ Object
- #new_invoke_prerequisites(task_args, invocation_chain) ⇒ Object
- #output(name, to_output) ⇒ Object
- #set_failed ⇒ Object
- #visit(&block) ⇒ Object
Class Attribute Details
.output_disabled ⇒ Object
Returns the value of attribute output_disabled.
227 228 229 |
# File 'lib/cxxproject/ext/rake.rb', line 227 def output_disabled @output_disabled end |
Instance Attribute Details
#deps ⇒ Object
used to store deps by depfile task for the apply task (no re-read of depsfile)
231 232 233 |
# File 'lib/cxxproject/ext/rake.rb', line 231 def deps @deps end |
#failure ⇒ Object
specified if that task has failed
230 231 232 |
# File 'lib/cxxproject/ext/rake.rb', line 230 def failure @failure end |
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
262 263 264 |
# File 'lib/cxxproject/ext/rake.rb', line 262 def ignore @ignore end |
#immediate_output ⇒ Object
Returns the value of attribute immediate_output.
236 237 238 |
# File 'lib/cxxproject/ext/rake.rb', line 236 def immediate_output @immediate_output end |
#output_after_execute ⇒ Object
Returns the value of attribute output_after_execute.
235 236 237 |
# File 'lib/cxxproject/ext/rake.rb', line 235 def output_after_execute @output_after_execute end |
#output_string ⇒ Object
Returns the value of attribute output_string.
234 235 236 |
# File 'lib/cxxproject/ext/rake.rb', line 234 def output_string @output_string end |
#prerequisites ⇒ Object
Returns the value of attribute prerequisites.
237 238 239 |
# File 'lib/cxxproject/ext/rake.rb', line 237 def prerequisites @prerequisites end |
#tags ⇒ Object
239 240 241 242 |
# File 'lib/cxxproject/ext/rake.rb', line 239 def = Set.new unless return end |
#transparent_timestamp ⇒ Object
Returns the value of attribute transparent_timestamp.
233 234 235 |
# File 'lib/cxxproject/ext/rake.rb', line 233 def end |
#type ⇒ Object
Returns the value of attribute type.
232 233 234 |
# File 'lib/cxxproject/ext/rake.rb', line 232 def type @type end |
Class Method Details
.bail_on_first_error ⇒ Object
220 221 222 |
# File 'lib/cxxproject/ext/rake.rb', line 220 def self.bail_on_first_error return @@bail_on_first_error end |
.bail_on_first_error=(v) ⇒ Object
223 224 225 |
# File 'lib/cxxproject/ext/rake.rb', line 223 def self.bail_on_first_error=(v) @@bail_on_first_error = v end |
Instance Method Details
#calc_dirty_for_prerequsites ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cxxproject/ext/rake_dirty.rb', line 14 def calc_dirty_for_prerequsites res = prerequisites.find do |p| t = Task[p] if t != nil if t.dirty? true else false end else false end end return res != nil end |
#dirty? ⇒ Boolean
return true if this or one of the prerequisites is dirty
5 6 7 8 9 10 11 12 |
# File 'lib/cxxproject/ext/rake_dirty.rb', line 5 def dirty? return calc_dirty_for_prerequsites if apply?(name) if needed? return true end return calc_dirty_for_prerequsites end |
#handle_error(exception, isSysCmd) ⇒ Object
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/cxxproject/ext/rake.rb', line 381 def handle_error(exception, isSysCmd) if not application.raise_exceptions if not Rake.application.idei.get_abort() if not isSysCmd Cxxproject::Printer.printError "Error for task #{@name}: #{exception.message}" if Rake.application..trace exception.backtrace.each do |t| Cxxproject::Printer.printError t end end end end begin FileUtils.rm(@name) if File.exists?(@name) rescue Exception => follow_up_exception Cxxproject::Printer.printError "Error: Could not delete #{@name}: #{follow_up_exception.message}" end set_failed else raise exception end end |
#ignore_missing_file ⇒ Object
432 433 434 |
# File 'lib/cxxproject/ext/rake.rb', line 432 def ignore_missing_file @ignore = true end |
#new_execute(execute_org, arg) ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/cxxproject/ext/rake.rb', line 355 def new_execute(execute_org, arg) if not @immediate_output s = name == 'console' ? nil : StringIO.new tmp = Thread.current[:stdout] Thread.current[:stdout] = s unless tmp end begin execute_org.bind(self).call(arg) rescue Cxxproject::ExitHelperException raise rescue Cxxproject::SystemCommandFailed => scf handle_error(scf, true) rescue SystemExit => exSys Rake.application.idei.set_abort(true) rescue Exception => ex1 handle_error(ex1, false) end if not @immediate_output self.output_string = s.string Thread.current[:stdout] = tmp output(nil, self.output_string) end end |
#new_invoke_prerequisites(task_args, invocation_chain) ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/cxxproject/ext/rake.rb', line 291 def new_invoke_prerequisites(task_args, invocation_chain) orgLength = 0 while @prerequisites.length > orgLength do orgLength = @prerequisites.length @prerequisites.dup.each do |n| # dup needed when apply tasks changes that array break if Rake.application.idei.get_abort #break if @failure prereq = nil begin prereq = application[n, @scope] prereq_args = task_args.new_scope(prereq.arg_names) prereq.invoke_with_call_chain(prereq_args, invocation_chain) set_failed if prereq.failure rescue Cxxproject::ExitHelperException raise rescue Exception => e if not application.raise_exceptions if prereq and Rake::Task[n].ignore @prerequisites.delete(n) def self.needed? true end return end Cxxproject::Printer.printError "Error #{name}: #{e.message}" if RakeFileUtils.verbose == true puts e.backtrace end set_failed if e..include?('Circular dependency detected') Rake.application.idei.set_abort(true) end else raise e end end end end end |
#output(name, to_output) ⇒ Object
404 405 406 407 408 409 410 411 |
# File 'lib/cxxproject/ext/rake.rb', line 404 def output(name, to_output) return if Rake::Task.output_disabled return unless output_after_execute if to_output and to_output.length > 0 puts to_output end end |
#set_failed ⇒ Object
334 335 336 337 338 339 |
# File 'lib/cxxproject/ext/rake.rb', line 334 def set_failed() @failure = true if Rake::Task.bail_on_first_error Rake.application.idei.set_abort(true) end end |
#visit(&block) ⇒ Object
436 437 438 439 440 441 442 |
# File 'lib/cxxproject/ext/rake.rb', line 436 def visit(&block) if block.call(self) prerequisite_tasks.each do |t| t.visit(&block) end end end |