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

Add an option to resolve SDK runtime version from a cache file #2630

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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
]
},
"fake-cli": {
"version": "5.21.0-alpha003",
"version": "5.21.0-alpha004",
"commands": [
"fake"
]
}
}
}
}
31 changes: 30 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ nuget Mono.Cecil prerelease
nuget System.Reactive.Compatibility
nuget Suave
nuget Newtonsoft.Json
nuget Octokit //"
nuget System.Net.Http
nuget Octokit
nuget Microsoft.Deployment.DotNet.Releases //"

open System.Reflection
open System
Expand All @@ -49,6 +51,8 @@ open Fake.Windows
open Fake.DotNet
open Fake.DotNet.Testing
open Fake.Core.TargetOperators
open System.Net.Http
open Microsoft.Deployment.DotNet.Releases

// ****************************************************************************************************
// ------------------------------------------- Definitions -------------------------------------------
Expand Down Expand Up @@ -1308,6 +1312,30 @@ for runtime in "current" :: "portable" :: runtimes do
| None -> "_DotNetPackage" ?=> rawTargetName |> ignore
prev <- Some rawTargetName

Target.create "CacheDotNetReleases" (fun _ ->
let sdkVersionReleases =
ProductCollection.GetAsync()
|> Async.AwaitTask
|> Async.RunSynchronously
|> List.ofSeq
|> List.find (fun product -> product.ProductVersion.Equals("6.0"))

let client = new HttpClient()
try
let response =
sdkVersionReleases.ReleasesJson
|> client.GetAsync
|> Async.AwaitTask
|> Async.RunSynchronously

response.Content.ReadAsStringAsync()
|> Async.AwaitTask
|> Async.RunSynchronously
|> Fake.IO.File.writeString false "src/app/Fake.Runtime/cachedDotnetSdkReleases.json"
with e ->
failwith "Could not update DotNet releases file."
)

// ****************************************************************************************************
// --------------------------------------- Targets Dependencies ---------------------------------------
// ****************************************************************************************************
Expand All @@ -1327,6 +1355,7 @@ for runtime in "current" :: "portable" :: runtimes do
?=> "UnskipAndRevertAssemblyInfo"
==> "DotNetPackage"
"_StartDnc"
==> "CacheDotNetReleases"
==> "_DotNetPackage"
"_DotNetPackage"
==> "DotNetPackage"
Expand Down
Loading