Skip to content
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

fix(gradle): Avoid crash for missing managerData #11727

Merged
merged 10 commits into from Sep 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 19 additions & 14 deletions lib/manager/gradle/shallow/extract.ts
Expand Up @@ -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);
Expand Down