Added library deduplication in IneritFrom.

This commit is contained in:
Alexander Andreev 2024-12-14 18:00:34 +04:00
parent a7cf5b0ec8
commit 6d66c0fe9d
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -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