Skip to content

Commit

Permalink
feat(manager/gradle): add support for dep matching in lists that are …
Browse files Browse the repository at this point in the history
…nested in Groovy maps (#28517)
  • Loading branch information
Churro authored Apr 19, 2024
1 parent dfbb054 commit b4189c8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/modules/manager/gradle/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,15 @@ describe('modules/manager/gradle/parser', () => {
it('map with interpolated dependency strings', () => {
const input = codeBlock`
def slfj4Version = "2.0.0"
def lifecycle_version = "2.5.1"
libraries = [
jcl: "org.slf4j:jcl-over-slf4j:\${slfj4Version}",
releaseCoroutines: "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.26.1-eap13"
api: "org.slf4j:slf4j-api:$slfj4Version",
lifecycle: [
"androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version",
"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
]
]
foo = [ group: "org.slf4j", name: "slf4j-ext", version: slfj4Version ]
`;
Expand All @@ -182,6 +187,16 @@ describe('modules/manager/gradle/parser', () => {
groupName: 'slfj4Version',
currentValue: '2.0.0',
},
{
depName: 'androidx.lifecycle:lifecycle-runtime-ktx',
groupName: 'lifecycle_version',
currentValue: '2.5.1',
},
{
depName: 'androidx.lifecycle:lifecycle-viewmodel-ktx',
groupName: 'lifecycle_version',
currentValue: '2.5.1',
},
{
depName: 'org.slf4j:slf4j-ext',
groupName: 'slfj4Version',
Expand Down
7 changes: 6 additions & 1 deletion lib/modules/manager/gradle/parser/assignments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
storeInTokenMap,
storeVarToken,
} from './common';
import { qGroovyMapNotationDependencies } from './dependencies';
import {
qDependencyStrings,
qGroovyMapNotationDependencies,
} from './dependencies';
import { handleAssignment } from './handlers';

// foo = "1.2.3"
Expand Down Expand Up @@ -79,6 +82,8 @@ const qGroovySingleMapOfVarAssignment = q.alt(
.join(qValueMatcher)
.handler((ctx) => storeInTokenMap(ctx, 'valToken'))
.handler(handleAssignment),
// ["foo:bar:1.2.3", "foo:baz:$qux"]
qDependencyStrings,
);

const qGroovyMapOfExpr = (
Expand Down

0 comments on commit b4189c8

Please sign in to comment.