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 PackageReference metadata #217

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 11 additions & 1 deletion src/Ionide.ProjInfo/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ module SdkDiscovery =
|> Seq.toArray

p.WaitForExit()

if p.ExitCode = 0 then
output
elif failOnError then
let output = output |> String.concat "\n"
let output =
output
|> String.concat "\n"

failwith $"`{binaryFullPath.FullName} {args}` failed with exit code %i{p.ExitCode}. Output: %s{output}"
else
// for the legacy VS flow, whose behaviour is harder to test, we maintain compatibility with how proj-info
Expand Down Expand Up @@ -760,10 +764,16 @@ module ProjectLoader =
let version = p.GetMetadataValue "NuGetPackageVersion"
let fullPath = p.GetMetadataValue "FullPath"

let metadata =
p.Metadata
|> Seq.map (fun md -> md.Name, md.EvaluatedValue)
|> readOnlyDict

{
Name = name
Version = version
FullPath = fullPath
Metadata = metadata
}
)

Expand Down
12 changes: 10 additions & 2 deletions src/Ionide.ProjInfo/Types.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Ionide.ProjInfo

open System
open System.Collections.Generic

module Types =

Expand Down Expand Up @@ -38,9 +39,16 @@ module Types =
type Property = { Name: string; Value: string }

type PackageReference = {
/// Name of the NuGet package, e.g. "FSharp.Core".
Name: string
/// Version of the NuGet package, e.g. "8.0.400".
Version: string
/// Path to the DLL on disk whose import is implied by this PackageReference.
/// This is likely somewhere within the local NuGet cache.
///
/// E.g. "/Users/user/.nuget/packages/fsharp.core/6.0.1/lib/netstandard2.1/FSharp.Core.dll".
FullPath: string
Metadata: IReadOnlyDictionary<string, string>
}

type ProjectOutputType =
Expand Down Expand Up @@ -69,11 +77,11 @@ module Types =
Properties: Property list
CustomProperties: Property list
} with

/// ResolvedTargetPath is the path to the primary reference assembly for this project.
/// For projects that produce ReferenceAssemblies, this is the path to the reference assembly.
/// For other projects, this is the same as TargetPath.
member x.ResolvedTargetPath =
defaultArg x.TargetRefPath x.TargetPath
member x.ResolvedTargetPath = defaultArg x.TargetRefPath x.TargetPath

/// Represents a `<Compile>` node within an fsproj file.
type CompileItem = {
Expand Down
Loading