class Albacore::Build::Config
The configuration class for xbuild and msbuild. MSDN docs at: msdn.microsoft.com/en-us/library/vstudio/ms164311.aspx
Attributes
any properties you want to set
this is the target of the compilation with MsBuild/XBuild
Public Class Methods
# File lib/albacore/task_types/build.rb, line 40 def initialize @parameters = Set.new w = lambda { |e| CrossPlatformCmd.which(e) ? e : nil } @files = [] @exe = w.call( "msbuild" ) || w.call( "xbuild" ) || heuristic_executable debug { "build using '#{@exe}'" } set_logging (ENV['DEBUG'] ? (ENV['VERBOSE'] ? 'detailed' : 'normal') : 'minimal') end
Public Instance Methods
Set logging verbosity to quiet
# File lib/albacore/task_types/build.rb, line 142 def be_quiet logging = "quiet" end
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.
# File lib/albacore/task_types/build.rb, line 137 def clp param update_array_prop "consoleloggerparameters", method(:make_clp), :clp, param end
Don't display the startup banner or the copyright message.
# File lib/albacore/task_types/build.rb, line 147 def nologo @parameters.add "/nologo" end
# File lib/albacore/task_types/build.rb, line 151 def params_for_file file update_file file @parameters end
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
# File lib/albacore/task_types/build.rb, line 92 def prop k, v @properties ||= Hash.new @parameters.delete "/property:#{make_props}" if @properties.any? @properties[k] = v @parameters.add "/property:#{make_props}" end
Private Instance Methods
# File lib/albacore/task_types/build.rb, line 200 def heuristic_executable return nil unless ::Rake::Win32.windows? require 'win32/registry' trace 'build tasktype finding msbuild.exe' msb = "msbuild_not_found" versions = Albacore.find_msbuild_versions if versions.any? msb = versions[versions.keys.max] end CrossPlatformCmd.which(msb) ? msb : nil end
# File lib/albacore/task_types/build.rb, line 196 def make_clp @clp.join(';') end
# File lib/albacore/task_types/build.rb, line 190 def make_props @properties.collect { |k, v| "#{k}=#{v}" }.join(';') end
# File lib/albacore/task_types/build.rb, line 186 def make_target @targets.join(';') end
# File lib/albacore/task_types/build.rb, line 157 def set_logging mode modes = %w{quiet minimal normal detailed diagnostic}.collect{ |m| "/verbosity:#{m}" } @parameters.subtract modes @parameters.add "/verbosity:#{mode}" end
# File lib/albacore/task_types/build.rb, line 163 def update_array_prop prop_name, callable_prop_val, field_sym, value field = :"@#{field_sym}" # @targets ||= [] instance_variable_set field, [] unless instance_variable_defined? field # parameters.delete "/target:#{make_target}" if @targets.any? @parameters.delete "/#{prop_name}:#{callable_prop_val.call}" if instance_variable_get(field).any? if value.respond_to? 'each' value.each { |v| instance_variable_get(field) << v } else instance_variable_get(field) << value end instance_variable_get(field).uniq! # @parameters.add "/target:#{make_target}" @parameters.add "/#{prop_name}:#{callable_prop_val.call}" end
There can be only one
# File lib/albacore/task_types/build.rb, line 181 def update_file val @parameters.delete_if { |param| File.file? param } @parameters.add ::Albacore::Paths.normalise_slashes val end