Skip to content

Commit

Permalink
dotnet dependency tree was getting lost without the type (#847)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Jan 29, 2024
1 parent 2c508b7 commit d61eb69
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4141,14 +4141,11 @@ export const createRubyBom = async (path, options) => {
* @param path to the project
* @param options Parse options from the cli
*/
export const createCsharpBom = async (
path,
options,
parentComponent = undefined
) => {
export const createCsharpBom = async (path, options) => {
let manifestFiles = [];
let pkgData = undefined;
let dependencies = [];
const parentComponent = createDefaultParentComponent(path, "nuget", options);
let csProjFiles = getAllFiles(
path,
(options.multiProject ? "**/" : "") + "*.csproj",
Expand Down Expand Up @@ -4213,7 +4210,7 @@ export const createCsharpBom = async (
pkgList = pkgList.concat(dlist);
}
if (deps && deps.length) {
dependencies = dependencies.concat(deps);
dependencies = mergeDependencies(dependencies, deps, parentComponent);
}
}
} else if (pkgLockFiles.length) {
Expand All @@ -4233,14 +4230,7 @@ export const createCsharpBom = async (
pkgList = pkgList.concat(dlist);
}
if (deps && deps.length) {
dependencies = dependencies.concat(deps);
}
if (!parentComponent) {
parentComponent = createDefaultParentComponent(
path,
options.type,
options
);
dependencies = mergeDependencies(dependencies, deps, parentComponent);
}
// Keep track of the direct dependencies so that we can construct one complete
// list after processing all lock files
Expand Down Expand Up @@ -4304,15 +4294,11 @@ export const createCsharpBom = async (
pkgList = pkgList.concat(dlist);
}
if (deps && deps.length) {
dependencies = dependencies.concat(deps);
dependencies = mergeDependencies(dependencies, deps, parentComponent);
}
}
}
if (!parentComponent) {
parentComponent = createDefaultParentComponent(path, options.type, options);
}
if (pkgList.length) {
dependencies = mergeDependencies(dependencies, [], parentComponent);
pkgList = trimComponents(pkgList);
// Perform deep analysis using dosai
if (options.deep) {
Expand All @@ -4336,7 +4322,6 @@ export const createCsharpBom = async (
if (retMap.dependencies && retMap.dependencies.length) {
dependencies = dependencies.concat(retMap.dependencies);
}
dependencies = mergeDependencies(dependencies, [], parentComponent);
pkgList = trimComponents(pkgList);
}
return buildBomNSData(options, pkgList, "nuget", {
Expand Down Expand Up @@ -4636,7 +4621,7 @@ export const createMultiXBom = async (pathList, options) => {
parentSubComponents.push(bomData.parentComponent);
}
}
bomData = await createCsharpBom(path, options, parentComponent);
bomData = await createCsharpBom(path, options);
if (
bomData &&
bomData.bomJson &&
Expand Down

0 comments on commit d61eb69

Please sign in to comment.