-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for dotnet based projects #1088
Changes from all commits
6c937c5
ec0d532
263e855
151ac49
1600748
b6b09fa
100d887
3742dd3
4f81749
f21b478
06819da
b64e989
d1f5037
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4463,7 +4463,7 @@ export function createPHPBom(path, options) { | |
cwd: basePath, | ||
encoding: "utf-8", | ||
}); | ||
if (result.status !== 0 || result.error) { | ||
if (result.status !== 0 || result.error) { | ||
console.error("Error running composer:"); | ||
console.log(result.error, result.stderr); | ||
options.failOnError && process.exit(1); | ||
|
@@ -4822,6 +4822,7 @@ export async function createCsharpBom(path, options) { | |
} | ||
} else if (pkgConfigFiles.length) { | ||
manifestFiles = manifestFiles.concat(pkgConfigFiles); | ||
const parentDependsOn = new Set(); | ||
// packages.config parsing | ||
for (const f of pkgConfigFiles) { | ||
if (DEBUG_MODE) { | ||
|
@@ -4833,9 +4834,29 @@ export async function createCsharpBom(path, options) { | |
pkgData = pkgData.slice(1); | ||
} | ||
const dlist = parseCsPkgData(pkgData); | ||
const deps = dlist; | ||
if (dlist?.length) { | ||
pkgList = pkgList.concat(dlist); | ||
} | ||
} | ||
if (parentDependsOn.size) { | ||
const depenciesSet = new Set(); | ||
const prefix = parentComponent["bom-ref"].split("/")[0]; | ||
parentDependsOn.forEach((dependsOn) => { | ||
if(dependsOn.name && dependsOn.version){ | ||
//console.log("prefix: ",prefix); | ||
const dependcy = `${prefix}/${dependsOn.name}@${dependsOn.version}`; | ||
depenciesSet.add(dependcy); | ||
} | ||
} | ||
); | ||
|
||
if(depenciesSet != null && depenciesSet.size > 0){ | ||
dependencies.splice(0, 0, { | ||
ref: parentComponent["bom-ref"], | ||
dependsOn: Array.from(depenciesSet), | ||
}); | ||
} | ||
} | ||
} | ||
if (paketLockFiles.length) { | ||
|
@@ -4857,7 +4878,7 @@ export async function createCsharpBom(path, options) { | |
} | ||
} | ||
} | ||
if (!pkgList.length && csProjFiles.length) { | ||
if ( !pkgList.length && csProjFiles.length) { | ||
manifestFiles = manifestFiles.concat(csProjFiles); | ||
// .csproj parsing | ||
for (const f of csProjFiles) { | ||
|
@@ -4873,12 +4894,16 @@ export async function createCsharpBom(path, options) { | |
if (dlist?.length) { | ||
pkgList = pkgList.concat(dlist); | ||
} | ||
if(DEBUG_MODE){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran the lint. For some reason on my machine its producing error for directory name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you share the error? @setchy any ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Os error 123, the filename , directory name or volume label syntax is incorrect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a strange error. Could you contribute a test repo to add to the repotests? I will take care of the linting errors. |
||
console.log(`pkgList List Size :: ${pkgList.length}`); | ||
} | ||
} | ||
|
||
if (pkgList.length) { | ||
console.log( | ||
`Found ${pkgList.length} components by parsing the ${csProjFiles.length} csproj files. The resulting SBOM will be incomplete.`, | ||
); | ||
options.failOnError && process.exit(1); | ||
// console.log( | ||
durga-pasupuleti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// `Found ${pkgList.length} components by parsing the ${csProjFiles.length} csproj files. The resulting SBOM will be incomplete.`, | ||
// ); | ||
//options.failOnError && process.exit(1); | ||
} | ||
} | ||
if (pkgList.length) { | ||
|
@@ -4902,7 +4927,8 @@ export async function createCsharpBom(path, options) { | |
} | ||
if (FETCH_LICENSE) { | ||
const retMap = await getNugetMetadata(pkgList, dependencies); | ||
if (retMap.dependencies?.length) { | ||
|
||
if (retMap.dependencies?.length > 0) { | ||
dependencies = mergeDependencies( | ||
dependencies, | ||
retMap.dependencies, | ||
|
@@ -5015,10 +5041,10 @@ export function mergeDependencies( | |
provides: Array.from(provides_map[akey]).sort(), | ||
}); | ||
} else { | ||
retlist.push({ | ||
ref: akey, | ||
dependsOn: Array.from(deps_map[akey]).sort(), | ||
}); | ||
retlist.push({ | ||
ref: akey, | ||
dependsOn: Array.from(deps_map[akey]).sort(), | ||
}); | ||
} | ||
} | ||
return retlist; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Net.Http.WebRequest" /> | ||
<Reference Include="System.Numerics" /> | ||
</ItemGroup> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If prefix is just
pkg:nuget
we can directly used that in 4723.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this without this its not able to create the dependencies. I checked multiple times for this.