Sha256: 4a88658140a5e437089b0223d84cbe166019bd3aed947a67d843025bdd9235d4

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'albacore/albacoretask'

class XBuild
  TaskName = [:xbuild, :mono]
  include AlbacoreTask
  include 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

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.2.0.preview2 lib/albacore/xbuild.rb