Sha256: bff31164c857f770dbf23325c82e458485dcf680ec1e23395b7cb88cc3a202bb

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

module Physique
  class CompileConfig
    attr_writer :configuration, # Build configuration (Release, Debug, etc.)
                :logging        # MSBuild Logging level (normal, verbose, etc.)

    def initialize
      @targets = []
    end

    def add_target(val)
      @targets << val
    end

    def opts
      @targets = %w(Clean Build Rebuild) if @targets.blank?

      Map.new({
        configuration: @configuration,
        logging: @logging,
        targets: @targets
      }).apply(
        configuration: 'Release',
        logging: 'normal'
      )
    end
  end

  class BuildTasksBuilder < TasksBuilder
    def build_tasks
      add_version_task
      add_compile_tasks
    end

    private

    def add_version_task
      require 'albacore/tasks/versionizer'
      Albacore::Tasks::Versionizer.new :versionizer
    end

    def add_compile_tasks
      block = lambda &method(:configure_build)

      task = build_task :compile => [ :restore ], &block.curry.(%w(Clean Rebuild))
      task.add_description 'Builds the solution'

      namespace :compile do
        solution.compile.targets.each do |t|
          task = build_task t.downcase, &block.curry.(t)
          task.add_description "Builds the solution using the #{t} target"
        end
      end
    end

    def configure_build(target, config)
      config.sln = solution.file
      config.prop 'Configuration', solution.compile.configuration
      config.logging = solution.compile.logging
      config.target = target
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
physique-0.2.2 lib/physique/task_builders/build.rb