Skip to content

Commit

Permalink
fix(manager/gradle): handle dot as optional when parsing plugins in K…
Browse files Browse the repository at this point in the history
…otlin DSL (#21362)
  • Loading branch information
Churro authored Apr 5, 2023
1 parent b923c87 commit f0b74b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/modules/manager/gradle/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ describe('modules/manager/gradle/parser', () => {
${''} | ${'id(["foo.bar"]) version "1.2.3"'} | ${null}
${''} | ${'id("foo", "bar") version "1.2.3"'} | ${null}
${''} | ${'id "foo".version("1.2.3")'} | ${null}
${''} | ${'id("foo.bar") version("1.2.3")'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id("foo.bar") version "1.2.3"'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3' }}
${''} | ${'id "foo.bar" version "$baz"'} | ${{ depName: 'foo.bar', skipReason: 'unknown-version', currentValue: 'baz' }}
${'baz = "1.2.3"'} | ${'id "foo.bar" version "$baz"'} | ${{ depName: 'foo.bar', packageName: 'foo.bar:foo.bar.gradle.plugin', currentValue: '1.2.3', groupName: 'baz' }}
Expand Down
5 changes: 3 additions & 2 deletions lib/modules/manager/gradle/parser/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const qVersion = qValueMatcher.handler((ctx) =>
storeInTokenMap(ctx, 'version')
);

// kotlin("jvm") version "1.3.71"
export const qPlugins = q
.sym(regEx(/^(?:id|kotlin)$/), storeVarToken)
.handler((ctx) => storeInTokenMap(ctx, 'methodName'))
Expand All @@ -24,6 +23,7 @@ export const qPlugins = q
.handler((ctx: Ctx) => storeInTokenMap(ctx, 'pluginName'))
.sym('version')
.join(qVersion),
// kotlin("jvm") version "1.3.71"
q
.tree({
type: 'wrapped-tree',
Expand All @@ -37,8 +37,9 @@ export const qPlugins = q
// id("foo.bar") version "1.2.3"
q.sym<Ctx>('version').join(qVersion),
// id("foo.bar").version("1.2.3")
// id("foo.bar") version("1.2.3")
q
.op<Ctx>('.')
.opt(q.op<Ctx>('.'))
.sym('version')
.tree({
maxDepth: 1,
Expand Down

0 comments on commit f0b74b8

Please sign in to comment.