Documentation
¶
Index ¶
- Variables
- func GetInclude(pr PackageReference) string
- func GetVersion(pr PackageReference, properties map[string]string) string
- func IsDevDependency(pr PackageReference) bool
- func ParseNuGetCsproj(pathToCsproj string) ([]lockfile.PackageDetails, error)
- func ParseNuGetLock(pathToLockfile string) ([]lockfile.PackageDetails, error)
- type Import
- type ItemGroup
- type NuGetCsprojExtractor
- type NuGetLockExtractor
- type NuGetLockPackage
- type NuGetLockfile
- type NugetCsProj
- type NugetCsprojMatcher
- type PackageReference
- type ParsedCsProj
- type Property
- type PropertyGroup
- type PropsFile
Constants ¶
This section is empty.
Variables ¶
var NuGetExtractor = NuGetLockExtractor{ lockfile.WithMatcher{Matchers: []lockfile.Matcher{&NugetCsprojMatcher{}}}, }
Functions ¶
func GetInclude ¶
func GetInclude(pr PackageReference) string
GetInclude returns the Include value from a PackageReference
func GetVersion ¶
func GetVersion(pr PackageReference, properties map[string]string) string
GetVersion returns the Version value from a PackageReference with property substitution applied
func IsDevDependency ¶
func IsDevDependency(pr PackageReference) bool
IsDevDependency checks if a PackageReference is a dev dependency (PrivateAssets="all")
func ParseNuGetCsproj ¶
func ParseNuGetCsproj(pathToCsproj string) ([]lockfile.PackageDetails, error)
func ParseNuGetLock ¶
func ParseNuGetLock(pathToLockfile string) ([]lockfile.PackageDetails, error)
Types ¶
type ItemGroup ¶
type ItemGroup struct {
XMLName xml.Name `xml:"ItemGroup"`
PackageReferences []PackageReference `xml:"PackageReference"`
}
func (*ItemGroup) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler to capture line and column positions for each PackageReference. This custom unmarshaler is necessary because the standard xml.Unmarshal doesn't provide file position information. By manually iterating through XML tokens and calling decoder.InputPos(), we can record where each PackageReference appears in the file.
type NuGetCsprojExtractor ¶
type NuGetCsprojExtractor struct{}
func (NuGetCsprojExtractor) Extract ¶
func (e NuGetCsprojExtractor) Extract(f lockfile.DepFile) ([]lockfile.PackageDetails, error)
func (NuGetCsprojExtractor) IsOfficiallySupported ¶
func (e NuGetCsprojExtractor) IsOfficiallySupported() bool
func (NuGetCsprojExtractor) PackageManager ¶
func (e NuGetCsprojExtractor) PackageManager() models.PackageManager
func (NuGetCsprojExtractor) ShouldExtract ¶
func (e NuGetCsprojExtractor) ShouldExtract(path string) bool
type NuGetLockExtractor ¶
type NuGetLockExtractor struct {
lockfile.WithMatcher
}
func (NuGetLockExtractor) Extract ¶
func (e NuGetLockExtractor) Extract(f lockfile.DepFile) ([]lockfile.PackageDetails, error)
func (NuGetLockExtractor) IsOfficiallySupported ¶
func (e NuGetLockExtractor) IsOfficiallySupported() bool
func (NuGetLockExtractor) PackageManager ¶
func (e NuGetLockExtractor) PackageManager() models.PackageManager
func (NuGetLockExtractor) ShouldExtract ¶
func (e NuGetLockExtractor) ShouldExtract(path string) bool
type NuGetLockPackage ¶
type NuGetLockfile ¶
type NuGetLockfile struct {
Version int `json:"version"`
Dependencies map[string]map[string]NuGetLockPackage `json:"dependencies"`
}
NuGetLockfile contains the required dependency information as defined in https://github.com/NuGet/NuGet.Client/blob/6.5.0.136/src/NuGet.Core/NuGet.ProjectModel/ProjectLockFile/PackagesLockFileFormat.cs
type NugetCsProj ¶
type NugetCsProj struct {
XMLName xml.Name `xml:"Project"`
ItemGroups []ItemGroup `xml:"ItemGroup"`
PropertyGroups []PropertyGroup `xml:"PropertyGroup"`
Imports []Import `xml:"Import"`
}
type NugetCsprojMatcher ¶
type NugetCsprojMatcher struct{}
func (NugetCsprojMatcher) GetSourceFile ¶
func (NugetCsprojMatcher) Match ¶
func (m NugetCsprojMatcher) Match(sourceFile lockfile.DepFile, packages []lockfile.PackageDetails) error
type PackageReference ¶
type PackageReference struct {
XMLName xml.Name `xml:"PackageReference"`
IncludeAttr *string `xml:"Include,attr"`
Include *string `xml:"Include"`
VersionAttr *string `xml:"Version,attr"`
Version *string `xml:"Version"`
PrivateAssetsAttr *string `xml:"PrivateAssets,attr"`
PrivateAssets *string `xml:"PrivateAssets"`
models.FilePosition
}
type ParsedCsProj ¶
type ParsedCsProj struct {
PackagesByName map[string]PackageReference
PropertiesByName map[string]string
}
func ParseNugetCsProj ¶
func ParseNugetCsProj(content []byte, csprojPath string) (*ParsedCsProj, error)
ParseNugetCsProj parses a .csproj file and returns a map of package references by package name. This is shared logic used by both the extractor and matcher.