Sha256: 2175120234294ff8bd4d39a7ffbfc48e48d7cfc4714213705b4d32633e99219b

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

require 'albacore/albacoretask'

class XBuild
  TaskName = [:xbuild, :mono]
  include Albacore::Task
  include Albacore::RunCommand
  
  attr_accessor :solution, :verbosity
  attr_array :targets
  attr_hash :properties
  
  def initialize
    @command = 'xbuild'
    super()
    update_attributes Albacore.configuration.xbuild.to_hash
  end
  
  def execute
    build_solution(@solution)
  end
  
  def build_solution(solution)
    check_solution solution
    
    command_parameters = []
    command_parameters << "\"#{solution}\""
    command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil
    command_parameters << build_properties if @properties != nil
    command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
    
    result = run_command "xBuild", command_parameters.join(" ")
    
    failure_message = 'xBuild Failed. See Build Log For Detail'
    fail_with_message failure_message if !result
  end
  
  def check_solution(file)
    return if file
    msg = 'solution cannot be nil'
    fail_with_message msg
  end
  
  def build_targets
    @targets.join ";"
  end

  def build_properties
    option_text = []
    @properties.each do |key, value|
      option_text << "/p:#{key}\=\"#{value}\""
    end
    option_text.join(" ")
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
albacore-0.3.6 lib/albacore/xbuild.rb
albacore-1.0.0.rc.2 lib/albacore/xbuild.rb
albacore-1.0.0.rc.1 lib/albacore/xbuild.rb
albacore-0.3.5 lib/albacore/xbuild.rb
albacore-0.3.4 lib/albacore/xbuild.rb
albacore-0.3.3 lib/albacore/xbuild.rb
albacore-0.3.2 lib/albacore/xbuild.rb
albacore-0.3.1 lib/albacore/xbuild.rb
albacore-0.3.0 lib/albacore/xbuild.rb
albacore-0.2.7 lib/albacore/xbuild.rb
albacore-0.2.6 lib/albacore/xbuild.rb