From 6d66c0fe9d7b5ffbc99c154163e966428a8c04c6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 14 Dec 2024 18:00:34 +0400 Subject: [PATCH] Added library deduplication in IneritFrom. --- internal/manifest/manifest.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/manifest/manifest.go b/internal/manifest/manifest.go index 90a7169..01830ce 100755 --- a/internal/manifest/manifest.go +++ b/internal/manifest/manifest.go @@ -180,7 +180,19 @@ func (m *Manifest) InheritFrom(parent *Manifest) error { m.JavaVersion.MajorVersion = parent.JavaVersion.MajorVersion } - m.Libraries = append(m.Libraries, parent.Libraries...) +merge_libs: + for _, plib := range parent.Libraries { + plname := strings.Split(plib.Name, ":") + for _, lib := range m.Libraries { + lname := strings.Split(lib.Name, ":") + if len(plname) == len(lname) { + if lname[0]+":"+lname[1] == plname[0]+":"+plname[1] { + continue merge_libs + } + } + } + m.Libraries = append(m.Libraries, plib) + } if m.Logging.Client.Argument == "" { m.Logging.Client.Argument = parent.Logging.Client.Argument