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

Fix #2521: Enable TreatWarningsAsErrors (breaking?) #2527

Draft
wants to merge 1 commit into
base: fable3
Choose a base branch
from
Draft
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
12 changes: 8 additions & 4 deletions src/Fable.Cli/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,15 @@ let getSourcesFromFsproj (projFile: string) =
| globResults -> globResults
| path -> [ path ])

let private isUsefulOption (opt : string) =
let private isUsefulOption isProjectRef (opt : string) =
[ "--define"
"--nowarn"
"--warnon"
// "--warnaserror" // Disable for now to prevent unexpected errors, see #2288
// Disable --warnaserror in project refs to prevent unexpected errors, see #2288
// NOTE: Because Fable collects all sources in a single project, using warnaserror
// in the main project will turn warnings in project refs (and packages) to errors as well
if not isProjectRef then
"--warnaserror"
// "--langversion" // See getBasicCompilerArgs
]
|> List.exists opt.StartsWith
Expand Down Expand Up @@ -327,7 +331,7 @@ let fullCrack (opts: CrackerOptions): CrackedFsproj =
let dllName = getDllName line
dllRefs.Add(dllName, line)
src, otherOpts
elif isUsefulOption line then
elif isUsefulOption false line then
src, line::otherOpts
elif line.StartsWith("-") then
src, otherOpts
Expand Down Expand Up @@ -360,7 +364,7 @@ let easyCrack (opts: CrackerOptions) dllRefs (projFile: string): CrackedFsproj =
let sourceFiles, otherOpts =
(projOpts.OtherOptions, ([], []))
||> Array.foldBack (fun line (src, otherOpts) ->
if isUsefulOption line then
if isUsefulOption true line then
src, line::otherOpts
elif line.StartsWith("-") then
src, otherOpts
Expand Down