From 19254ca0a4bc2e6e53edd2fa2ae08295807b6d04 Mon Sep 17 00:00:00 2001 From: Johannes Feichtner <Churro@users.noreply.github.com> Date: Wed, 6 Jul 2022 22:33:56 +0200 Subject: [PATCH] fix(gradle): remove default maven central registry (#16430) --- .../gradle/__snapshots__/extract.spec.ts.snap | 1 - lib/modules/manager/gradle/extract.spec.ts | 50 +++++-------------- lib/modules/manager/gradle/extract.ts | 8 +-- 3 files changed, 15 insertions(+), 44 deletions(-) diff --git a/lib/modules/manager/gradle/__snapshots__/extract.spec.ts.snap b/lib/modules/manager/gradle/__snapshots__/extract.spec.ts.snap index 36342d7b6a..374573315d 100644 --- a/lib/modules/manager/gradle/__snapshots__/extract.spec.ts.snap +++ b/lib/modules/manager/gradle/__snapshots__/extract.spec.ts.snap @@ -15,7 +15,6 @@ Array [ "packageFile": "gradle.properties", }, "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", "https://example.com", ], }, diff --git a/lib/modules/manager/gradle/extract.spec.ts b/lib/modules/manager/gradle/extract.spec.ts index 10d4840385..a29c444844 100644 --- a/lib/modules/manager/gradle/extract.spec.ts +++ b/lib/modules/manager/gradle/extract.spec.ts @@ -90,7 +90,7 @@ describe('modules/manager/gradle/extract', () => { { depName: 'foo:bar', currentValue: '1.2.3', - registryUrls: ['https://repo.maven.apache.org/maven2'], + registryUrls: [], skipReason: 'contains-variable', managerData: { packageFile: 'build.gradle', @@ -121,10 +121,7 @@ describe('modules/manager/gradle/extract', () => { { depName: 'foo:bar', currentValue: '1.2.3', - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://example.com', - ], + registryUrls: ['https://example.com'], }, ], }, @@ -197,8 +194,8 @@ describe('modules/manager/gradle/extract', () => { depType: 'plugin', registryUrls: [ 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', 'https://example.com', + 'https://plugins.gradle.org/m2/', ], }, { @@ -352,10 +349,7 @@ describe('modules/manager/gradle/extract', () => { fileReplacePosition: 21, packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], }, { depName: 'org.danilopianini.publish-on-central', @@ -367,10 +361,7 @@ describe('modules/manager/gradle/extract', () => { fileReplacePosition: 82, packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], }, { depName: 'org.ajoberstar.grgit', @@ -381,10 +372,7 @@ describe('modules/manager/gradle/extract', () => { managerData: { packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], skipReason: 'unknown-version', }, ], @@ -474,10 +462,7 @@ describe('modules/manager/gradle/extract', () => { fileReplacePosition: 661, packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], }, { depName: 'org.jetbrains.kotlin.plugin.serialization', @@ -489,10 +474,7 @@ describe('modules/manager/gradle/extract', () => { fileReplacePosition: 21, packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], }, { depName: 'org.danilopianini.multi-jvm-test-plugin', @@ -505,10 +487,7 @@ describe('modules/manager/gradle/extract', () => { fileReplacePosition: 822, packageFile: 'gradle/libs.versions.toml', }, - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], }, ], }, @@ -560,17 +539,14 @@ describe('modules/manager/gradle/extract', () => { packageFile: 'gradle/libs.versions.toml', }, fileReplacePosition: 30, - registryUrls: ['https://repo.maven.apache.org/maven2'], + registryUrls: [], }, { depType: 'plugin', depName: 'io.gitlab.arturbosch.detekt', packageName: 'io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin', - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://plugins.gradle.org/m2/', - ], + registryUrls: ['https://plugins.gradle.org/m2/'], currentValue: '1.18.1', managerData: { fileReplacePosition: 30, @@ -608,7 +584,7 @@ describe('modules/manager/gradle/extract', () => { packageFile: 'gradle/libs.versions.toml', }, fileReplacePosition: 124, - registryUrls: ['https://repo.maven.apache.org/maven2'], + registryUrls: [], }, { depName: 'mocha-junit:mocha-junit', @@ -619,7 +595,7 @@ describe('modules/manager/gradle/extract', () => { packageFile: 'gradle/libs.versions.toml', }, fileReplacePosition: 82, - registryUrls: ['https://repo.maven.apache.org/maven2'], + registryUrls: [], }, ], }, diff --git a/lib/modules/manager/gradle/extract.ts b/lib/modules/manager/gradle/extract.ts index 0ebb251937..bb31acf21f 100644 --- a/lib/modules/manager/gradle/extract.ts +++ b/lib/modules/manager/gradle/extract.ts @@ -1,7 +1,7 @@ import upath from 'upath'; import { logger } from '../../../logger'; import { readLocalFile } from '../../../util/fs'; -import { MavenDatasource, defaultRegistryUrls } from '../../datasource/maven'; +import { MavenDatasource } from '../../datasource/maven'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import { parseCatalog } from './extract/catalog'; import { parseGradle, parseProps } from './parser'; @@ -110,11 +110,7 @@ export async function extractAllPackageFiles( } dep.registryUrls = [ - ...new Set([ - ...defaultRegistryUrls, - ...(dep.registryUrls ?? []), - ...registryUrls, - ]), + ...new Set([...registryUrls, ...(dep.registryUrls ?? [])]), ]; const depAlreadyInPkgFile = pkgFile.deps.some( -- GitLab