Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add ability to define custom MSBuild loggers #352

Merged
merged 2 commits into from

2 participants

Max Malook Steffen Forkmann
Max Malook

It's needed for example to integrate the build log in AppVeyor.

Further with this change we could refactor the logger registration, so that TeamCityLogger is used only if buildServer is actually TeamCity.

Steffen Forkmann
Owner

OK. Thanks

Steffen Forkmann forki merged commit 8efc306 into from
Max Malook mexx deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 9, 2014
  1. Max Malook

    correct typos

    mexx authored
  2. Max Malook
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 13 deletions.
  1. +20 −12 src/app/FakeLib/MSBuildHelper.fs
  2. +1 −1  src/app/FakeLib/MsBuildLogger.fs
32 src/app/FakeLib/MSBuildHelper.fs
View
@@ -134,6 +134,15 @@ let getAllParameters targets maxcpu nodeReuse tools verbosity fileLoggers proper
if isUnix then [ targets; tools; verbosity ] @ fileLoggers @ properties
else [ targets; maxcpu; nodeReuse; tools; verbosity ] @ fileLoggers @ properties
+let private serializeArgs args =
+ args
+ |> Seq.map (function
+ | None -> ""
+ | Some(k, v) ->
+ "/" + k + (if isNullOrEmpty v then ""
+ else ":" + v))
+ |> separated " "
+
/// [omit]
let serializeMSBuildParams (p : MSBuildParams) =
let verbosityName v =
@@ -215,14 +224,8 @@ let serializeMSBuildParams (p : MSBuildParams) =
|> sprintf "%s;")
|> String.concat "")))
- let allParameters = getAllParameters targets maxcpu nodeReuse tools verbosity fileLoggers properties
- allParameters
- |> Seq.map (function
- | None -> ""
- | Some(k, v) ->
- "/" + k + (if isNullOrEmpty v then ""
- else ":" + v))
- |> separated " "
+ getAllParameters targets maxcpu nodeReuse tools verbosity fileLoggers properties
+ |> serializeArgs
/// [omit]
let TeamCityLoggerName = typedefof<Fake.MsBuildLogger.TeamCityLogger>.FullName
@@ -230,12 +233,12 @@ let TeamCityLoggerName = typedefof<Fake.MsBuildLogger.TeamCityLogger>.FullName
/// [omit]
let ErrorLoggerName = typedefof<Fake.MsBuildLogger.ErrorLogger>.FullName
-let private errorLoggerParam =
+/// Defines the loggers to use for MSBuild task
+let mutable MSBuildLoggers =
let pathToLogger = typedefof<MSBuildParams>.Assembly.Location
[ TeamCityLoggerName; ErrorLoggerName ]
- |> List.map (fun a -> sprintf "/logger:%s,\"%s\"" a pathToLogger)
- |> fun lst -> String.Join(" ", lst)
-
+ |> List.map (fun a -> sprintf "%s,\"%s\"" a pathToLogger)
+
/// Runs a MSBuild project
/// ## Parameters
/// - `setParams` - A function that overwrites the default MsBuildParams
@@ -263,6 +266,11 @@ let build setParams project =
MSBuildDefaults
|> setParams
|> serializeMSBuildParams
+
+ let errorLoggerParam =
+ MSBuildLoggers
+ |> List.map (fun a -> Some ("logger", a))
+ |> serializeArgs
let args = toParam project + " " + args + " " + errorLoggerParam
tracefn "Building project: %s\n %s %s" project msBuildExe args
2  src/app/FakeLib/MsBuildLogger.fs
View
@@ -16,7 +16,7 @@ type MSBuildLogger() =
let mutable Verbosity = LoggerVerbosity.Normal
let mutable Parameters = ""
- /// Abstract fucntion which registers a event listener.
+ /// Abstract function which registers an event listener.
abstract RegisterEvents : IEventSource -> unit
override t.RegisterEvents e = ()
Something went wrong with that request. Please try again.