Sha256: 1e66b924dee08107512a422a89320c289008fbfc45c4e3ab8f11858f49eccb85

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require 'albacore/albacoretask'
require 'albacore/config/cscconfig'
require 'albacore/support/supportlinux'

class CSC
  include Albacore::Task
  include Albacore::RunCommand
  include Configuration::CSC
  include SupportsLinuxEnvironment

  attr_accessor :output, :target, :optimize, :debug, :doc
  attr_array :compile, :references, :resources, :define

  def initialize
    @optimize = false
    super()
    update_attributes csc.to_hash
  end

  def execute
    params = []
    params << @references.map{|r| format_reference(r)} unless @references.nil?
    params << @resources.map{|r| format_resource(r)} unless @resources.nil?
    params << "\"/out:#{@output}\"" unless @output.nil?
    params << "/target:#{@target}" unless @target.nil?
    params << "/optimize+" if @optimize
    params << get_debug_param unless @debug.nil?
    params << "/doc:#{@doc}" unless @doc.nil?
    params << get_define_params unless @define.nil?
    params << @compile.map{|f| format_path(f)} unless @compile.nil?

    result = run_command "CSC", params
    
    failure_message = 'CSC Failed. See Build Log For Detail'
    fail_with_message failure_message if !result
  end

  def get_define_params
    symbols = @define.join(";")
    "/define:#{symbols}"
  end

  def get_debug_param
    case @debug
      when true
        "/debug"
      when :full
        "/debug:full"
      when :pdbonly
        "/debug:pdbonly"
    end
  end

  def format_resource(resource)
    "/res:#{resource}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.2.2 lib/albacore/csc.rb