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

feat: sharedVariableName #33111

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export interface RenovateConfig
statusCheckNames?: Record<StatusCheckKey, string | null>;
env?: UserEnv;
logLevelRemap?: LogLevelRemap[];
sharedVariableName?: string;
}

const CustomDatasourceFormats = ['json', 'plain', 'yaml', 'html'] as const;
Expand Down
16 changes: 8 additions & 8 deletions lib/modules/manager/cocoapods/extract.ts
rarkins marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export function parseLine(line: string): ParsedLine {
const depName = result.subspec
? `${result.spec}/${result.subspec}`
: result.spec;
const groupName = result.spec;
const specName = result.spec;
rarkins marked this conversation as resolved.
Show resolved Hide resolved
if (depName) {
result.depName = depName;
}
if (groupName) {
result.groupName = groupName;
if (specName) {
result.specName = specName;
}
delete result.spec;
delete result.subspec;
Expand Down Expand Up @@ -96,7 +96,7 @@ export async function extractPackageFile(
const parsedLine = parseLine(line);
const {
depName,
groupName,
specName,
currentValue,
git,
tag,
Expand All @@ -112,14 +112,14 @@ export async function extractPackageFile(
const managerData = { lineNumber };
let dep: PackageDependency = {
depName,
groupName,
sharedVariableName: specName,
skipReason: 'unspecified-version',
};

if (currentValue) {
dep = {
depName,
groupName,
sharedVariableName: specName,
datasource: PodDatasource.id,
currentValue,
managerData,
Expand All @@ -131,14 +131,14 @@ export async function extractPackageFile(
} else {
dep = {
depName,
groupName,
sharedVariableName: specName,
skipReason: 'git-dependency',
};
}
} else if (path) {
dep = {
depName,
groupName,
sharedVariableName: specName,
skipReason: 'path-dependency',
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/cocoapods/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ParsedLine {
depName?: string;
groupName?: string;
specName?: string;
spec?: string;
subspec?: string;
currentValue?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ exports[`modules/manager/gradle/parser calculations parses fixture from "gradle"
{
"currentValue": "1.5.2.RELEASE",
"depName": "org.springframework.boot:spring-boot-gradle-plugin",
"groupName": "springBootVersion",
"managerData": {
"fileReplacePosition": 53,
"packageFile": "build.gradle",
},
"sharedVariableName": "springBootVersion",
},
{
"currentValue": "1.2.3",
Expand Down
46 changes: 23 additions & 23 deletions lib/modules/manager/gradle/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,27 @@ describe('modules/manager/gradle/extract', () => {
{
depName: 'javax.cache:cache-api',
currentValue: '1.1.0',
groupName: 'Libraries.jCache',
sharedVariableName: 'Libraries.jCache',
},
{
depName: 'com.android.tools.build:gradle',
currentValue: '4.1.2',
groupName: 'Libraries.Android.Tools.version',
sharedVariableName: 'Libraries.Android.Tools.version',
},
{
depName: 'androidx.test:core',
currentValue: '1.3.0-rc01',
groupName: 'Libraries.Test.version',
sharedVariableName: 'Libraries.Test.version',
},
{
depName: 'androidx.test.espresso:espresso-core',
currentValue: '3.3.0-rc01',
groupName: 'Libraries.Test.Espresso.version',
sharedVariableName: 'Libraries.Test.Espresso.version',
},
{
depName: 'androidx.test:core-ktx',
currentValue: '1.3.0-rc01',
groupName: 'Libraries.Test.version',
sharedVariableName: 'Libraries.Test.version',
},
],
},
Expand All @@ -218,7 +218,7 @@ describe('modules/manager/gradle/extract', () => {
{
depName: 'org.jetbrains.kotlin:kotlin-stdlib',
currentValue: '1.8.10',
groupName: 'GradleDeps.Kotlin.version',
sharedVariableName: 'GradleDeps.Kotlin.version',
},
],
},
Expand All @@ -228,12 +228,12 @@ describe('modules/manager/gradle/extract', () => {
{
depName: 'com.fasterxml.jackson.core:jackson-annotations',
currentValue: '2.9.10',
groupName: 'Versions.jackson',
sharedVariableName: 'Versions.jackson',
},
{
depName: 'io.reactivex.rxjava2:rxjava',
currentValue: '1.2.3',
groupName: 'Versions.rxjava',
sharedVariableName: 'Versions.rxjava',
},
],
},
Expand Down Expand Up @@ -513,7 +513,7 @@ describe('modules/manager/gradle/extract', () => {
deps: [
{
depName: 'io.gitlab.arturbosch.detekt:detekt-formatting',
groupName: 'detekt',
sharedVariableName: 'detekt',
currentValue: '1.17.0',
managerData: {
fileReplacePosition: 21,
Expand All @@ -522,7 +522,7 @@ describe('modules/manager/gradle/extract', () => {
},
{
depName: 'io.kotest:kotest-assertions-core-jvm',
groupName: 'kotest',
sharedVariableName: 'kotest',
currentValue: '4.6.0',
managerData: {
fileReplacePosition: 51,
Expand All @@ -531,7 +531,7 @@ describe('modules/manager/gradle/extract', () => {
},
{
depName: 'io.kotest:kotest-runner-junit5',
groupName: 'kotest',
sharedVariableName: 'kotest',
currentValue: '4.6.0',
managerData: {
fileReplacePosition: 51,
Expand Down Expand Up @@ -655,7 +655,7 @@ describe('modules/manager/gradle/extract', () => {
},
{
depName: 'com.squareup.retrofit2:retrofit',
groupName: 'retro.fit',
sharedVariableName: 'retro.fit',
currentValue: '2.8.2',
managerData: {
fileReplacePosition: 42,
Expand Down Expand Up @@ -765,7 +765,7 @@ describe('modules/manager/gradle/extract', () => {
deps: [
{
depName: 'io.gitlab.arturbosch.detekt:detekt-formatting',
groupName: 'detekt',
sharedVariableName: 'detekt',
currentValue: '1.18.1',
managerData: {
fileReplacePosition: 21,
Expand All @@ -784,7 +784,7 @@ describe('modules/manager/gradle/extract', () => {
fileReplacePosition: 21,
packageFile: 'gradle/libs.versions.toml',
},
groupName: 'detekt',
sharedVariableName: 'detekt',
fileReplacePosition: 21,
},
],
Expand All @@ -808,7 +808,7 @@ describe('modules/manager/gradle/extract', () => {
deps: [
{
depName: 'junit:junit',
groupName: 'junit',
sharedVariableName: 'junit',
currentValue: '1.4.9',
managerData: {
fileReplacePosition: 124,
Expand All @@ -818,7 +818,7 @@ describe('modules/manager/gradle/extract', () => {
},
{
depName: 'mocha-junit:mocha-junit',
groupName: 'mocha.junit.reporter',
sharedVariableName: 'mocha.junit.reporter',
currentValue: '2.0.2',
managerData: {
fileReplacePosition: 82,
Expand Down Expand Up @@ -1020,7 +1020,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:lucene-core',
depType: 'dependencies',
fileReplacePosition: 22,
groupName: 'org.apache.lucene:*',
sharedVariableName: 'org.apache.lucene:*',
lockedVersion: '1.2.3',
managerData: {
fileReplacePosition: 22,
Expand All @@ -1031,7 +1031,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:lucene-codecs',
depType: 'dependencies',
fileReplacePosition: 22,
groupName: 'org.apache.lucene:*',
sharedVariableName: 'org.apache.lucene:*',
lockedVersion: '1.2.3',
managerData: {
fileReplacePosition: 22,
Expand Down Expand Up @@ -1128,7 +1128,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:a.c',
currentValue: '2',
lockedVersion: '1',
groupName: 'org.apache.lucene:a.*',
sharedVariableName: 'org.apache.lucene:a.*',
fileReplacePosition: 65,
depType: 'dependencies',
},
Expand All @@ -1140,7 +1140,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:a.d',
currentValue: '2',
lockedVersion: '1',
groupName: 'org.apache.lucene:a.*',
sharedVariableName: 'org.apache.lucene:a.*',
fileReplacePosition: 65,
depType: 'dependencies',
},
Expand All @@ -1152,7 +1152,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:d',
currentValue: '3',
lockedVersion: '1',
groupName: 'org.apache.lucene:*',
sharedVariableName: 'org.apache.lucene:*',
fileReplacePosition: 39,
depType: 'dependencies',
},
Expand All @@ -1164,7 +1164,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.lucene:e.f',
currentValue: '3',
lockedVersion: '1',
groupName: 'org.apache.lucene:*',
sharedVariableName: 'org.apache.lucene:*',
fileReplacePosition: 39,
depType: 'dependencies',
},
Expand All @@ -1176,7 +1176,7 @@ describe('modules/manager/gradle/extract', () => {
depName: 'org.apache.foo-bar:a',
currentValue: '5',
lockedVersion: '1',
groupName: 'org.apache.foo*:*',
sharedVariableName: 'org.apache.foo*:*',
fileReplacePosition: 113,
depType: 'dependencies',
},
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/manager/gradle/extract/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ function extractDependency({
versionSubContent: string;
}): PackageDependency<GradleManagerData> {
if (is.string(descriptor)) {
const [groupName, name, currentValue] = descriptor.split(':');
const [group, name, currentValue] = descriptor.split(':');
if (!currentValue) {
return {
depName,
skipReason: 'unspecified-version',
};
}
return {
depName: `${groupName}:${name}`,
depName: `${group}:${name}`,
currentValue,
managerData: {
fileReplacePosition:
Expand Down Expand Up @@ -236,7 +236,7 @@ function extractDependency({
}

if (isVersionPointer(descriptor.version)) {
dependency.groupName = normalizeAlias(descriptor.version.ref);
dependency.sharedVariableName = normalizeAlias(descriptor.version.ref);
}

return dependency;
Expand Down Expand Up @@ -298,7 +298,7 @@ export function parseCatalog(
dependency.skipReason = skipReason;
}
if (isVersionPointer(version) && dependency.commitMessageTopic) {
dependency.groupName = normalizeAlias(version.ref);
dependency.sharedVariableName = normalizeAlias(version.ref);
delete dependency.commitMessageTopic;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function parseGcv(
currentValue: propVerAndPos.version,
lockedVersion: lockVersionAndDepType.version,
depType: lockVersionAndDepType.depType,
groupName: propDepGlob,
sharedVariableName: propDepGlob,
} satisfies PackageDependency<GradleManagerData>;
extractedDeps.push(newDep);
// Remove from the lockfile map so the same lib will not be included in more generic globs later
Expand Down
Loading
Loading