Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MSBuild /nowarn command line option #1840

Merged
merged 3 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/app/Fake.DotNet.MSBuild/MSBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ type MSBuildParams =
Verbosity : MSBuildVerbosity option
NoConsoleLogger : bool
WarnAsError: string list option
NoWarn: string list option
/// corresponds to the msbuild option '/fl'
FileLoggers : MSBuildFileLoggerConfig list option
/// corresponds to the msbuild option '/bl'
Expand All @@ -219,6 +220,7 @@ type MSBuildParams =
Verbosity = None
NoConsoleLogger = false
WarnAsError = None
NoWarn = None
RestorePackagesFlag = false
FileLoggers = None
BinaryLoggers = None
Expand Down Expand Up @@ -294,9 +296,9 @@ module MSBuild =


/// [omit]
let internal getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError fileLoggers binaryLoggers distributedFileLoggers properties =
if Environment.isUnix then [ targets; tools; verbosity; noconsolelogger; warnAsError ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
else [ targets; maxcpu; noLogo; nodeReuse; tools; verbosity; noconsolelogger; warnAsError ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
let internal getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError nowarn fileLoggers binaryLoggers distributedFileLoggers properties =
if Environment.isUnix then [ targets; tools; verbosity; noconsolelogger; warnAsError; nowarn ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
else [ targets; maxcpu; noLogo; nodeReuse; tools; verbosity; noconsolelogger; warnAsError; nowarn ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties

let private serializeArgs args =
args
Expand Down Expand Up @@ -364,6 +366,11 @@ module MSBuild =
| None -> None
| Some w -> Some("warnaserror", w |> String.concat ";")

let nowarn =
match p.NoWarn with
| None -> None
| Some w -> Some("nowarn", w |> String.concat ";")

let fileLoggers =
let serializeLogger fl =
let logParams param =
Expand Down Expand Up @@ -433,7 +440,7 @@ module MSBuild =
dfls
|> List.map(fun (cl, fl) -> Some("dl", createLoggerString cl fl))

getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError fileLoggers binaryLoggers distributedFileLoggers properties
getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError nowarn fileLoggers binaryLoggers distributedFileLoggers properties
|> serializeArgs

#if !NO_MSBUILD_AVAILABLE
Expand Down
15 changes: 11 additions & 4 deletions src/legacy/FakeLib/MSBuildHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ type MSBuildParams =
Verbosity : MSBuildVerbosity option
NoConsoleLogger : bool
WarnAsError: string list option
NoWarn: string list option
/// corresponds to the msbuild option '/fl'
FileLoggers : MSBuildFileLoggerConfig list option
/// corresponds to the msbuild option '/bl'
Expand All @@ -274,16 +275,17 @@ let mutable MSBuildDefaults =
Verbosity = None
NoConsoleLogger = false
WarnAsError = None
NoWarn = None
RestorePackagesFlag = false
FileLoggers = None
BinaryLoggers = None
DistributedLoggers = None }

/// [omit]
[<System.Obsolete("Use Fake.DotNet.MSBuild instead")>]
let getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError fileLoggers binaryLoggers distributedFileLoggers properties =
if isUnix then [ targets; tools; verbosity; noconsolelogger; warnAsError ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
else [ targets; maxcpu; noLogo; nodeReuse; tools; verbosity; noconsolelogger; warnAsError ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
let getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError nowarn fileLoggers binaryLoggers distributedFileLoggers properties =
if isUnix then [ targets; tools; verbosity; noconsolelogger; warnAsError; nowarn ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties
else [ targets; maxcpu; noLogo; nodeReuse; tools; verbosity; noconsolelogger; warnAsError; nowarn ] @ fileLoggers @ binaryLoggers @ distributedFileLoggers @ properties

let private serializeArgs args =
args
Expand Down Expand Up @@ -348,6 +350,11 @@ let serializeMSBuildParams (p : MSBuildParams) =
| None -> None
| Some w -> Some("warnaserror", w |> String.concat ";")

let nowarn =
match p.NoWarn with
| None -> None
| Some w -> Some("nowarn", w |> String.concat ";")

let fileLoggers =
let serializeLogger fl =
let logParams param =
Expand Down Expand Up @@ -417,7 +424,7 @@ let serializeMSBuildParams (p : MSBuildParams) =
dfls
|> List.map(fun (cl, fl) -> Some("dl", createLoggerString cl fl))

getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError fileLoggers binaryLoggers distributedFileLoggers properties
getAllParameters targets maxcpu noLogo nodeReuse tools verbosity noconsolelogger warnAsError nowarn fileLoggers binaryLoggers distributedFileLoggers properties
|> serializeArgs

/// [omit]
Expand Down