Skip to content

Commit 03e8771

Browse files
authored
Merge pull request #9698 from dotnet/merges/master-to-release/dev16.8
Merge master to release/dev16.8
2 parents 1b78b1c + 16d9f11 commit 03e8771

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

src/fsharp/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ module internal Utilities =
209209
let succeeded, stdOut, stdErr =
210210
if not (isRunningOnCoreClr) then
211211
// The Desktop build uses "msbuild" to build
212-
executeBuild msbuildExePath (arguments "") workingDir
212+
executeBuild msbuildExePath (arguments "-v:quiet") workingDir
213213
else
214214
// The coreclr uses "dotnet msbuild" to build
215-
executeBuild dotnetHostPath (arguments "msbuild") workingDir
215+
executeBuild dotnetHostPath (arguments "msbuild -v:quiet") workingDir
216216

217217
let outputFile = projectPath + ".resolvedReferences.paths"
218218
let resultOutFile = if succeeded && File.Exists(outputFile) then Some outputFile else None

src/fsharp/fsi/fsi.fs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,16 @@ type internal FsiInteractionProcessor
22902290
| EndOfFile -> istate,defaultArg lastResult (Completed None) (* drop nextAction on EOF *)
22912291
| CtrlC -> istate,CtrlC (* drop nextAction on CtrlC *)
22922292

2293+
/// Execute a single parsed interaction which may contain multiple items to be executed
2294+
/// independently
2295+
let executeParsedInteractions (ctok, tcConfig, istate, action, errorLogger: ErrorLogger, lastResult:option<FsiInteractionStepStatus>, cancellationToken: CancellationToken) =
2296+
let istate, completed = execParsedInteractions (ctok, tcConfig, istate, action, errorLogger, lastResult, cancellationToken)
2297+
match completed with
2298+
| Completed _ ->
2299+
let istate = fsiDynamicCompiler.CommitDependencyManagerText(ctok, istate, lexResourceManager, errorLogger)
2300+
istate, completed
2301+
| _ -> istate, completed
2302+
22932303
/// Execute a single parsed interaction on the parser/execute thread.
22942304
let mainThreadProcessAction ctok action istate =
22952305
try
@@ -2314,7 +2324,7 @@ type internal FsiInteractionProcessor
23142324

23152325
let mainThreadProcessParsedInteractions ctok errorLogger (action, istate) cancellationToken =
23162326
istate |> mainThreadProcessAction ctok (fun ctok tcConfig istate ->
2317-
execParsedInteractions (ctok, tcConfig, istate, action, errorLogger, None, cancellationToken))
2327+
executeParsedInteractions (ctok, tcConfig, istate, action, errorLogger, None, cancellationToken))
23182328

23192329
let parseExpression (tokenizer:LexFilter.LexFilter) =
23202330
reusingLexbufForParsing tokenizer.LexBuffer (fun () ->

src/fsharp/fsi/fsi.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<TargetExt>.exe</TargetExt>
1111
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
1212
<AllowCrossTargeting>true</AllowCrossTargeting>
13-
<OtherFlags>$(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
13+
<OtherFlags>--warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
1414
<Win32Resource>fsi.res</Win32Resource>
1515
<NGenBinary>true</NGenBinary>
1616
</PropertyGroup>

tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,39 @@ printfn ""%A"" result
168168

169169
[<Test>]
170170
member __.``Eval script with package manager invalid key``() =
171-
use script = new FSharpScript()
171+
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
172172
let result, _errors = script.Eval(@"#r ""nugt:FSharp.Data""")
173173
match result with
174174
| Ok(_) -> Assert.Fail("expected a failure")
175175
| Error(ex) -> Assert.IsInstanceOf<FsiCompilationException>(ex)
176176

177+
[<Test>]
178+
member __.``Eval script with invalid PackageName should fail immediately``() =
179+
use output = new RedirectConsoleOutput()
180+
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
181+
let mutable found = 0
182+
let outp = System.Collections.Generic.List<string>()
183+
output.OutputProduced.Add(
184+
fun line ->
185+
if line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package") then
186+
found <- found + 1
187+
outp.Add(line))
188+
let _result, _errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """)
189+
Assert.True( (found = 1), "Expected to see output contains 'error NU1101:' and 'FSharp.Really.Not.A.Package'")
190+
191+
[<Test>]
192+
member __.``Eval script with invalid PackageName should fail immediately and resolve one time only``() =
193+
use output = new RedirectConsoleOutput()
194+
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
195+
let mutable foundResolve = 0
196+
output.OutputProduced.Add (fun line -> if line.Contains("Microsoft (R) Build Engine version") then foundResolve <- foundResolve + 1)
197+
let _result, _errors =
198+
script.Eval("""
199+
#r "nuget:FSharp.Really.Not.A.Package"
200+
#r "nuget:FSharp.Really.Not.Another.Package"
201+
""")
202+
Assert.True( (foundResolve = 1), (sprintf "Expected to see 'Microsoft (R) Build Engine version' only once actually resolved %d times" foundResolve))
203+
177204
[<Test>]
178205
member __.``ML - use assembly with ref dependencies``() =
179206
let code = @"

0 commit comments

Comments
 (0)