mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
fix: add support for Dart SDK package dependencies (#1891)
Signed-off-by: Stephane Rufer <1128559+rufman@users.noreply.github.com>
This commit is contained in:
parent
25ce245c03
commit
7943c73d3f
@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"sort"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/anchore/syft/internal/log"
|
||||
"github.com/anchore/syft/syft/artifact"
|
||||
@ -38,6 +38,23 @@ type pubspecLockDescription struct {
|
||||
ResolvedRef string `yaml:"resolved-ref" mapstructure:"resolved-ref"`
|
||||
}
|
||||
|
||||
func (p *pubspecLockDescription) UnmarshalYAML(value *yaml.Node) error {
|
||||
type pld pubspecLockDescription
|
||||
var p2 pld
|
||||
|
||||
if value.Decode(&p.Name) == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := value.Decode(&p2); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*p = pubspecLockDescription(p2)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func parsePubspecLock(_ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
|
||||
var pkgs []pkg.Package
|
||||
|
||||
|
||||
@ -79,6 +79,19 @@ func TestParsePubspecLock(t *testing.T) {
|
||||
Version: "1.6.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "flutter",
|
||||
Version: "0.0.0",
|
||||
PURL: "pkg:pub/flutter@0.0.0",
|
||||
Locations: fixtureLocationSet,
|
||||
Language: pkg.Dart,
|
||||
Type: pkg.DartPubPkg,
|
||||
MetadataType: pkg.DartPubMetadataType,
|
||||
Metadata: pkg.DartPubMetadata{
|
||||
Name: "flutter",
|
||||
Version: "0.0.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "key_binder",
|
||||
Version: "1.11.20",
|
||||
|
||||
@ -36,6 +36,11 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
key_binder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user