class Object
Constants
- AkroLibrary
- AkroTest
Public Instance Methods
add_binaries(*paths)
click to toggle source
# File lib/akro.rb, line 80 def add_binaries(*paths) puts("add_binaries call is obsolete. Use add_binary with array instead") paths.each do |path| $AKRO_BINARIES << path.to_str() end end
add_binary(path: nil, additional_link_params: nil)
click to toggle source
# File lib/akro.rb, line 95 def add_binary(path: nil, additional_link_params: nil) raise "No path defined" if path.nil? files = path; if !files.kind_of?(Array) files = [path] end files.each do |file| add_binary_internal(path: file, additional_link_params: additional_link_params) end end
add_binary_internal(path: nil, additional_link_params: nil)
click to toggle source
# File lib/akro.rb, line 87 def add_binary_internal(path: nil, additional_link_params: nil) raise "Must specify path for binary" if path.nil? if !additional_link_params.nil? && additional_link_params != "" $BIN_EXTRA_FLAGS[path] = additional_link_params end $AKRO_BINARIES << path.to_str() end
add_dynamic_library(path: nil, sources: nil, recurse: true, capture_deps: true, additional_params: nil)
click to toggle source
# File lib/akro.rb, line 114 def add_dynamic_library(path: nil, sources: nil, recurse: true, capture_deps: true, additional_params: nil) raise "Must specify path for dynamic library" if path.nil? raise "Must specify source for dynamic library #{path}" if sources.nil? $AKRO_LIBS << AkroLibrary.new(path, sources, false, recurse, capture_deps, additional_params) end
add_static_library(path: nil, sources: nil, recurse: true, capture_deps: true, additional_params: nil)
click to toggle source
# File lib/akro.rb, line 109 def add_static_library(path: nil, sources: nil, recurse: true, capture_deps: true, additional_params: nil) raise "Must specify path for static library" if path.nil? raise "Must specify source for static library #{path}" if sources.nil? $AKRO_LIBS << AkroLibrary.new(path, sources, true, recurse, capture_deps, additional_params) end
add_test(name: nil, script: nil, binary: nil, cmdline: nil)
click to toggle source
# File lib/akro.rb, line 67 def add_test(name: nil, script: nil, binary: nil, cmdline: nil) raise "Test must have a name" if name.nil? raise "Test must have at least a script and a binary" if script.nil? and binary.nil? raise "Binary must end in .exe" if !binary.nil? and !binary.end_with?(".exe") test = AkroTest.new(name, script, binary, cmdline) $AKRO_TESTS << test raise "Test #{name} appears multiple times" if $AKRO_TESTS_MAP.has_key?(name) $AKRO_TESTS_MAP[name] = test end
add_tests(*tests)
click to toggle source
# File lib/akro.rb, line 120 def add_tests(*tests) tests.each do |t| if t.respond_to?(:to_str) s = t.to_str() add_test(name: s, script: s, binary: s, cmdline: nil) elsif t.is_a?(AkroTest) $AKRO_TESTS << t else raise "Can't add test of class #{t.class.name} " end end end
akro_multitask()
click to toggle source
# File lib/akro.rb, line 194 def akro_multitask Rake.application.options.always_multitask = true end
silent_exec(command, verbose: false, lines_if_error: 200, env: {})
click to toggle source
Execute command, redirect output to temporary file, and print if error
# File lib/akro.rb, line 174 def silent_exec(command, verbose: false, lines_if_error: 200, env: {}) Tempfile.open('testout') do |output| puts command if verbose if !system(env, command, [:out, :err] => output) output.close(unlink_now=false) if env.empty?() puts "Command <#{command}> failed:" else envstr = env.map{|k,v| "#{k}=#{v}"}.join(' ') puts "Command <#{envstr} #{command}> failed:" end lines = IO.readlines(output.path) lines = lines[-lines_if_error..-1] if lines.size() > lines_if_error puts lines return false end end return true end
windows?()
click to toggle source
# File lib/akro.rb, line 45 def windows? (RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/) != nil end