feat: add scope to pom properties (#1779)

* feat: add scope to pom properties

Signed-off-by: James Neate <jamesmneate@gmail.com>

* fix: fixed conflict with schema bump

Signed-off-by: James Neate <jamesmneate@gmail.com>

---------

Signed-off-by: James Neate <jamesmneate@gmail.com>
This commit is contained in:
James Neate 2023-06-01 13:22:29 +01:00 committed by GitHub
parent 5842fc2a64
commit c69cdd9f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1916 additions and 11 deletions

View file

@ -6,5 +6,5 @@ const (
// JSONSchemaVersion is the current schema version output by the JSON encoder
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
JSONSchemaVersion = "8.0.0"
JSONSchemaVersion = "8.0.1"
)

File diff suppressed because it is too large Load diff

View file

@ -69,6 +69,7 @@ func newPackageFromPom(pom gopom.Project, dep gopom.Dependency, locations ...fil
m := pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{
GroupID: resolveProperty(pom, dep.GroupID),
Scope: resolveProperty(pom, dep.Scope),
},
}

View file

@ -39,7 +39,10 @@ func Test_parserPomXML(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "junit"},
PomProperties: &pkg.PomProperties{
GroupID: "junit",
Scope: "test",
},
},
},
},
@ -83,7 +86,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.junit.jupiter"},
PomProperties: &pkg.PomProperties{
GroupID: "org.junit.jupiter",
Scope: "test",
},
},
},
{
@ -94,7 +100,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.assertj"},
PomProperties: &pkg.PomProperties{
GroupID: "org.assertj",
Scope: "test",
},
},
},
{
@ -105,7 +114,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "commons-io"},
PomProperties: &pkg.PomProperties{
GroupID: "commons-io",
Scope: "test",
},
},
},
{
@ -116,7 +128,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.mockito"},
PomProperties: &pkg.PomProperties{
GroupID: "org.mockito",
Scope: "test",
},
},
},
{
@ -127,7 +142,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.graalvm.js"},
PomProperties: &pkg.PomProperties{
GroupID: "org.graalvm.js",
Scope: "test",
},
},
},
{
@ -138,7 +156,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.graalvm.js"},
PomProperties: &pkg.PomProperties{
GroupID: "org.graalvm.js",
Scope: "test",
},
},
},
{
@ -149,7 +170,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.apache.commons"},
PomProperties: &pkg.PomProperties{
GroupID: "org.apache.commons",
Scope: "test",
},
},
},
{
@ -160,7 +184,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.openjdk.jmh"},
PomProperties: &pkg.PomProperties{
GroupID: "org.openjdk.jmh",
Scope: "test",
},
},
},
{
@ -171,7 +198,10 @@ func Test_parseCommonsTextPomXMLProject(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
PomProperties: &pkg.PomProperties{GroupID: "org.openjdk.jmh"},
PomProperties: &pkg.PomProperties{
GroupID: "org.openjdk.jmh",
Scope: "test",
},
},
},
},

View file

@ -32,6 +32,7 @@ type PomProperties struct {
GroupID string `mapstructure:"groupId" json:"groupId" cyclonedx:"groupID"`
ArtifactID string `mapstructure:"artifactId" json:"artifactId" cyclonedx:"artifactID"`
Version string `mapstructure:"version" json:"version"`
Scope string `mapstructure:"scope" json:"scope,omitempty"`
Extra map[string]string `mapstructure:",remain" json:"extraFields,omitempty"`
}