Skip to content
Permalink
Browse files
fix(gradle): Avoid crash for missing managerData (#11727)
  • Loading branch information
zharinov committed Sep 14, 2021
1 parent 45d1aee commit 522d23e2c525ed498977da8fe4916398458fccea
Showing with 19 additions and 14 deletions.
  1. +19 −14 lib/manager/gradle/shallow/extract.ts
@@ -98,20 +98,25 @@ export async function extractAllPackageFiles(
}

elevateFileReplacePositionField(extractedDeps).forEach((dep) => {
const key = dep.managerData.packageFile;
const pkgFile: PackageFile = packageFilesByName[key];
const { deps } = pkgFile;
deps.push({
...dep,
registryUrls: [
...new Set([
...defaultRegistryUrls,
...(dep.registryUrls || []),
...registryUrls,
]),
],
});
packageFilesByName[key] = pkgFile;
const key = dep.managerData?.packageFile;
// istanbul ignore else
if (key) {
const pkgFile: PackageFile = packageFilesByName[key];
const { deps } = pkgFile;
deps.push({
...dep,
registryUrls: [
...new Set([
...defaultRegistryUrls,
...(dep.registryUrls || []),
...registryUrls,
]),
],
});
packageFilesByName[key] = pkgFile;
} else {
logger.warn({ dep }, `Failed to process Gradle dependency`);
}
});

return Object.values(packageFilesByName);

0 comments on commit 522d23e

Please sign in to comment.