Skip to content

Commit

Permalink
Duplicate properties (#1403)
Browse files Browse the repository at this point in the history
* Don't consider the project's name a profile

Signed-off-by: Roland Asmann <roland.asmann@gmail.com>

* Merging of properties was not correctly handled

Signed-off-by: Roland Asmann <roland.asmann@gmail.com>

---------

Signed-off-by: Roland Asmann <roland.asmann@gmail.com>
  • Loading branch information
malice00 authored Oct 2, 2024
1 parent 6aa3175 commit 873abe7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 12 additions & 16 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5473,19 +5473,20 @@ export function trimComponents(components) {
} else {
const existingComponent = keyCache[key];
// We need to retain any properties that differ
const compProps = existingComponent.properties || [];
const compPropsMap = {};
for (const aprop of compProps) {
compPropsMap[aprop.name] = aprop.value;
}
if (comp.properties) {
for (const newprop of comp.properties) {
if (
!compPropsMap[newprop.name] ||
(newprop.value && compPropsMap[newprop.name] !== newprop.value)
) {
compProps.push(newprop);
if (existingComponent.properties) {
for (const newprop of comp.properties) {
if (
!existingComponent.properties.find(
(prop) =>
prop.name === newprop.name && prop.value === newprop.value,
)
) {
existingComponent.properties.push(newprop);
}
}
} else {
existingComponent.properties = comp.properties;
}
}
// If the component is required in any of the child projects, then make it required
Expand All @@ -5494,11 +5495,6 @@ export function trimComponents(components) {
comp?.scope === "required"
) {
existingComponent.scope = "required";
keyCache[key] = existingComponent;
}
if (compProps.length) {
existingComponent.properties = compProps;
keyCache[key] = existingComponent;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,7 @@ export async function parseGradleDep(
last_bomref = last_project_bomref;
stack = [first_bomref];
}
if (rline.includes(" - ")) {
if (rline.includes(" - ") && !rline.startsWith("Project ':")) {
profileName = rline.split(" - ")[0];
if (profileName.toLowerCase().includes("test")) {
scope = "optional";
Expand Down

0 comments on commit 873abe7

Please sign in to comment.