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

SdkAssemblyResolver improvements #2797

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
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
39 changes: 21 additions & 18 deletions src/app/Fake.Runtime/SdkAssemblyResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,28 @@ type SdkAssemblyResolver(logLevel: Trace.VerboseLevel) =
if this.LogLevel.PrintVerbose then
Trace.tracefn "Trying to resolve runtime version from network.."

let sdkSet = this.SdkVersionRaws |> Set.ofList

try
let sdkVersionReleases =
ProductCollection.GetAsync()
|> Async.AwaitTask
|> Async.RunSynchronously
|> List.ofSeq
|> List.filter (fun product ->
this.SdkVersionRaws
|> List.exists (fun raws -> product.ProductVersion.Equals raws))

sdkVersionReleases
|> List.collect (fun rel ->
rel.GetReleasesAsync()
|> Async.AwaitTask
|> Async.RunSynchronously
|> List.ofSeq)
task {
let! productCollection = ProductCollection.GetAsync()

let sdkVersionReleases =
productCollection
|> Seq.filter (fun product -> sdkSet |> Set.exists (fun raws -> product.ProductVersion.Equals raws))

let! releases =
sdkVersionReleases
|> Seq.map (fun rel -> rel.GetReleasesAsync())
|> System.Threading.Tasks.Task.WhenAll

return releases |> Seq.collect (fun sdks -> sdks |> Seq.toList)
xperiandri marked this conversation as resolved.
Show resolved Hide resolved
}
|> Async.AwaitTask
|> Async.RunSynchronously
|> Seq.toList
|> Some

with ex ->
Trace.traceError $"Could not get SDK runtime version from network due to: {ex.Message}"
None
Expand Down Expand Up @@ -192,9 +197,7 @@ type SdkAssemblyResolver(logLevel: Trace.VerboseLevel) =
|> Option.orElseWith (this.TryResolveSdkRuntimeVersionFromCache)

let sdkRelease (release: ProductRelease) =
release.Sdks
|> List.ofSeq
|> List.exists (fun sdk -> sdk.Version.Equals(version))
release.Sdks |> Seq.exists (fun sdk -> sdk.Version.Equals(version))

match net60releases with
| None -> []
Expand Down
Loading