Skip to content

Commit

Permalink
Track workspaces for transitive dependencies for uv monorepos
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 20, 2025
1 parent e6b6d67 commit 5646093
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/repotests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,6 @@ jobs:
- name: repotests bionomia
run: |
bin/cdxgen.js -r -t ruby repotests/bionomia -o bomresults/bom-bionomia.json --fail-on-error
CDXGEN_DEBUG_MODE=debug bin/cdxgen.js -r -t ruby3.3.6 repotests/bionomia -o bomresults/bom-bionomia-deep.json --deep --fail-on-error
CDXGEN_DEBUG_MODE=debug bin/cdxgen.js -r -p -t ruby3.3.6 repotests/bionomia -o bomresults/bom-bionomia-research.json --profile research --fail-on-error
shell: bash
- name: repotests bazel-examples
run: |
Expand Down
15 changes: 15 additions & 0 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4647,6 +4647,7 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
const dependenciesList = [];
const depsMap = {};
const existingPkgMap = {};
const pkgBomRefMap = {};
let directDepsKeys = {};
let groupDepsKeys = {};
let parentComponent;
Expand Down Expand Up @@ -4901,6 +4902,7 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
}
// This would help the lookup
existingPkgMap[pkg.name.toLowerCase()] = pkg["bom-ref"];
pkgBomRefMap[pkg["bom-ref"]] = pkg;
pkgList.push(pkg);
if (!depsMap[pkg["bom-ref"]]) {
depsMap[pkg["bom-ref"]] = new Set();
Expand All @@ -4922,6 +4924,19 @@ export async function parsePyLockData(lockData, lockFile, pyProjectFile) {
const nameStr =
apkgDep.name || apkgDep.split(/(==|<=|~=|>=)/)[0].split(" ")[0];
depsMap[pkg["bom-ref"]].add(existingPkgMap[nameStr] || nameStr);
// Propagate the workspace properties to the child components
if (
existingPkgMap[nameStr] &&
pkgBomRefMap[existingPkgMap[nameStr]]
) {
const dependentPkg = pkgBomRefMap[existingPkgMap[nameStr]];
dependentPkg.properties = dependentPkg.properties || [];
for (const pprop of pkg.properties) {
if (pprop.name.startsWith("internal:workspace")) {
dependentPkg.properties.push(pprop);
}
}
}
}
} else if (Object.keys(apkg.dependencies).length) {
for (const apkgDep of Object.keys(apkg.dependencies)) {
Expand Down
2 changes: 1 addition & 1 deletion types/lib/helpers/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5646093

Please sign in to comment.