Skip to content

Commit

Permalink
let's see if it works this time :)
Browse files Browse the repository at this point in the history
  • Loading branch information
yazeedobaid committed Nov 15, 2021
1 parent 5ac9221 commit b6c87a8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 43 deletions.
5 changes: 4 additions & 1 deletion src/app/Fake.DotNet.Cli/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ module DotNet =
DryRun: bool
/// Do not update path variable
NoPath: bool
/// Command working directory
WorkingDirectory: string
}

/// Parameter default values.
Expand All @@ -243,6 +245,7 @@ module DotNet =
DebugSymbols = false
DryRun = false
NoPath = true
WorkingDirectory = "."
}

/// The a list of well-known versions to install
Expand Down Expand Up @@ -940,7 +943,7 @@ module DotNet =
match checkVersion with
| Some version ->
let passVersion = if fromGlobalJson then None else Some version
withGlobalJson "." passVersion (fun () ->
withGlobalJson param.WorkingDirectory passVersion (fun () ->
dotnetInstallations
|> Seq.tryFind (fun dotnet ->
try
Expand Down
103 changes: 61 additions & 42 deletions src/test/Fake.Core.IntegrationTests/Fake.DotNet.sdkAssemblyResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,72 @@ open Fake.Core.IntegrationTests.TestHelpers
let tests =
testList
"Fake.DotNet.sdkAssemblyResolverTests" [
// testCase "Runner run script with NETStandard2.0 SDK assemblies" <| fun _ ->
// let result =
// handleAndFormat <| fun _ ->
// fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-netstandard20"
//
// let stdOut =
// String.Join("\n", result.Messages).Trim()
//
// let expectedNetStandardPathPortion =
// ".nuget"
// </> "packages"
// </> "netstandard.library"
// </> "2.0.0"
//
// (sprintf "stdout should contain '%s', but was: '%s'" expectedNetStandardPathPortion stdOut)
// |> Expect.isTrue (stdOut.Contains expectedNetStandardPathPortion)
//
// testCase "Runner run script with 6.0.100-preview.3.21202.5 SDK version assemblies" <| fun _ ->
// let result =
// handleAndFormat <| fun _ ->
// fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-net60-preview"
//
// let stdOut =
// String.Join("\n", result.Messages).Trim()
//
// let expectedNet6PathPortion = "packs"</>"Microsoft.NETCore.App.Ref"</>"6.0.0-preview.3.21201.4"</>"ref"</>"net6.0"
//
// (sprintf "stdout should contain path like '%s', but was: '%s'" expectedNet6PathPortion stdOut)
// |> Expect.isTrue (stdOut.Contains expectedNet6PathPortion)

testCase "Runner run script with 6.0.100 SDK version assemblies" <| fun _ ->
DotNet.install (fun option ->
{ option with
ForceInstall = true
Channel = DotNet.CliChannel.Version 6 0
Version = DotNet.CliVersion.Version "6.0.100" })
|> ignore

testCase "Runner run script with NETStandard2.0 SDK assemblies" <| fun _ ->
let result =
handleAndFormat <| fun _ ->
fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-net60"
fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-netstandard20"

let stdOut =
String.Join("\n", result.Messages).Trim()

let expectedNet6PathPortion = "packs"</>"Microsoft.NETCore.App.Ref"</>"6.0.0"</>"ref"</>"net6.0"
let expectedNetStandardPathPortion =
".nuget"
</> "packages"
</> "netstandard.library"
</> "2.0.0"

(sprintf "stdout should contain '%s', but was: '%s'" expectedNetStandardPathPortion stdOut)
|> Expect.isTrue (stdOut.Contains expectedNetStandardPathPortion)

testCase "Runner run script with 6.0.100-preview.3.21202.5 SDK version assemblies" <| fun _ ->
try
DotNet.install (fun option ->
{ option with
ForceInstall = true
WorkingDirectory = scenarioTempPath "core-reference-assemblies-net60"
Channel = DotNet.CliChannel.Version 6 0
Version = DotNet.CliVersion.Version "6.0.100-preview.3.21202.5" })
|> ignore
let result =
handleAndFormat <| fun _ ->
fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-net60-preview"

let stdOut =
String.Join("\n", result.Messages).Trim()

let expectedNet6PathPortion = "packs"</>"Microsoft.NETCore.App.Ref"</>"6.0.0-preview.3.21201.4"</>"ref"</>"net6.0"

(sprintf "stdout should contain path like '%s', but was: '%s'" expectedNet6PathPortion stdOut)
|> Expect.isTrue (stdOut.Contains expectedNet6PathPortion)
finally
ignore ""
// clean up after the test run
Directory.delete DotNet.defaultUserInstallDir

testCase "Runner run script with 6.0.100 SDK version assemblies" <| fun _ ->
try
DotNet.install (fun option ->
{ option with
ForceInstall = true
WorkingDirectory = scenarioTempPath "core-reference-assemblies-net60"
Channel = DotNet.CliChannel.Version 6 0
Version = DotNet.CliVersion.Version "6.0.100" })
|> ignore

let result =
handleAndFormat <| fun _ ->
fakeRunAndCheck Ctx.Verbose "reference-assemblies.fsx" "reference-assemblies.fsx" "core-reference-assemblies-net60"

let stdOut =
String.Join("\n", result.Messages).Trim()

let expectedNet6PathPortion = "packs"</>"Microsoft.NETCore.App.Ref"</>"6.0.0"</>"ref"</>"net6.0"

(sprintf "stdout should contain path like '%s', but was: '%s'" expectedNet6PathPortion stdOut)
|> Expect.isTrue (stdOut.Contains expectedNet6PathPortion)
finally
ignore ""
// clean up after the test run
Directory.delete DotNet.defaultUserInstallDir

(sprintf "stdout should contain path like '%s', but was: '%s'" expectedNet6PathPortion stdOut)
|> Expect.isTrue (stdOut.Contains expectedNet6PathPortion)
]

0 comments on commit b6c87a8

Please sign in to comment.