Class: Albacore::Build::Config

Inherits:
Object
  • Object
show all
Extended by:
ConfigDSL
Includes:
CmdConfig, Logging
Defined in:
lib/albacore/task_types/build.rb

Overview

The configuration class for xbuild and msbuild. MSDN docs at: msdn.microsoft.com/en-us/library/vstudio/ms164311.aspx

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConfigDSL

attr_path, attr_path_accessor

Methods included from Logging

#debug, #err, #error, #fatal, #info, #puts, #trace, #warn

Methods included from CmdConfig

#add_parameter, #parameters

Constructor Details

#initializeConfig

Returns a new instance of Config.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/albacore/task_types/build.rb', line 40

def initialize
  @parameters = Set.new

  w = lambda { |e| CrossPlatformCmd.which(e) ? e : nil }

  @exe = w.call( "xbuild" )  ||
         w.call( "msbuild" ) ||
         heuristic_executable

  debug { "build using '#{@exe}'" }
  set_logging (ENV['DEBUG'] ?
                (ENV['VERBOSE'] ?
                  'detailed' :
                  'normal') :
                'minimal')
end

Instance Attribute Details

#propertiesObject

any properties you want to set



38
39
40
# File 'lib/albacore/task_types/build.rb', line 38

def properties
  @properties
end

#targetObject (readonly)

this is the target of the compilation with MsBuild/XBuild



35
36
37
# File 'lib/albacore/task_types/build.rb', line 35

def target
  @target
end

Instance Method Details

#be_quietObject

Set logging verbosity to quiet



139
140
141
# File 'lib/albacore/task_types/build.rb', line 139

def be_quiet
  logging = "quiet"
end

#clp(param) ⇒ Object

Pass the parameters that you specify to the console logger, which displays build information in the console window. You can specify the following parameters:

  • PerformanceSummary. Show the time that’s spent in tasks, targets and projects.

  • Summary. Show the error and warning summary at the end.

  • NoSummary. Don’t show the error and warning summary at the end.

  • ErrorsOnly. Show only errors.

  • WarningsOnly. Show only warnings.

  • NoItemAndPropertyList. Don’t show the list of items and properties that would appear at the start of each project build if the verbosity level is set to diagnostic.

  • ShowCommandLine. Show TaskCommandLineEvent messages.

  • ShowTimestamp. Show the timestamp as a prefix to any message.

  • ShowEventId. Show the event ID for each started event, finished event, and message.

  • ForceNoAlign. Don’t align the text to the size of the console buffer.

  • DisableConsoleColor. Use the default console colors for all logging messages.

  • DisableMPLogging. Disable the multiprocessor logging style of output when running in non-multiprocessor mode.

  • EnableMPLogging. Enable the multiprocessor logging style even when running in non-multiprocessor mode. This logging style is on by default.

  • Verbosity. Override the /verbosity setting for this logger.



134
135
136
# File 'lib/albacore/task_types/build.rb', line 134

def clp param
  update_array_prop "consoleloggerparameters", method(:make_clp), :clp, param
end

#nologoObject

Don’t display the startup banner or the copyright message.



144
145
146
# File 'lib/albacore/task_types/build.rb', line 144

def 
  @parameters.add "/nologo"
end

#prop(k, v) ⇒ Object

Allows you to add properties to MsBuild; example:

b.prop ‘WarningLevel’, 2 b.prop ‘BuildVersion’, ‘3.5.0’

From MSDN:

“Set or override the specified project-level properties, where name is the property name and value is the property value. Specify each property separately, or use a semicolon or comma to separate multiple properties, as the following example shows: /property:WarningLevel=2;OutputDir=binDebug”

The properties will be automatically converted to the correct syntax



88
89
90
91
92
93
# File 'lib/albacore/task_types/build.rb', line 88

def prop k, v
  @properties ||= Hash.new
  @parameters.delete "/property:#{make_props}" if @properties.any?
  @properties[k] = v
  @parameters.add "/property:#{make_props}"
end