From c0c4bf13fe57e6744a2f40e1a6d5ae564750115c Mon Sep 17 00:00:00 2001 From: DmitriyLewen Date: Thu, 28 Nov 2024 16:37:55 +0600 Subject: [PATCH] refactor: use `RelationshipWorkspace` instead on `Module` field --- pkg/dependency/parser/java/pom/artifact.go | 1 - pkg/dependency/parser/java/pom/parse.go | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/dependency/parser/java/pom/artifact.go b/pkg/dependency/parser/java/pom/artifact.go index 8fc20b236b51..e541aa109976 100644 --- a/pkg/dependency/parser/java/pom/artifact.go +++ b/pkg/dependency/parser/java/pom/artifact.go @@ -32,7 +32,6 @@ type artifact struct { Exclusions map[string]struct{} - Module bool Relationship ftypes.Relationship Locations ftypes.Locations diff --git a/pkg/dependency/parser/java/pom/parse.go b/pkg/dependency/parser/java/pom/parse.go index 48351b8bdf85..946ec097b1e3 100644 --- a/pkg/dependency/parser/java/pom/parse.go +++ b/pkg/dependency/parser/java/pom/parse.go @@ -125,8 +125,7 @@ func (p *Parser) parseRoot(root artifact, uniqModules map[string]struct{}) ([]ft // Prepare a queue for dependencies queue := newArtifactQueue() - // Enqueue root POM - root.Module = false + // Enqueue root/module POM queue.enqueue(root) var ( @@ -143,7 +142,7 @@ func (p *Parser) parseRoot(root artifact, uniqModules map[string]struct{}) ([]ft // Modules should be handled separately so that they can have independent dependencies. // It means multi-module allows for duplicate dependencies. - if art.Module { + if art.Relationship == ftypes.RelationshipWorkspace { if _, ok := uniqModules[art.String()]; ok { continue } @@ -288,7 +287,6 @@ func (p *Parser) parseModule(currentPath, relativePath string) (artifact, error) } moduleArtifact := module.artifact() - moduleArtifact.Module = true moduleArtifact.Relationship = ftypes.RelationshipWorkspace p.cache.put(moduleArtifact, result)