From 1c3b7e0955724bcafef1db87aebef0506d7a42ad Mon Sep 17 00:00:00 2001 From: Johannes Feichtner Date: Wed, 5 Apr 2023 21:23:21 +0200 Subject: [PATCH] fix(gradle/manager): handle dot as optional when parsing plugins in Kotlin DSL --- lib/modules/manager/gradle/parser.spec.ts | 1 + lib/modules/manager/gradle/parser/plugins.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/modules/manager/gradle/parser.spec.ts b/lib/modules/manager/gradle/parser.spec.ts index 99bb0063431c9b..428119e1763fe7 100644 --- a/lib/modules/manager/gradle/parser.spec.ts +++ b/lib/modules/manager/gradle/parser.spec.ts @@ -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' }} diff --git a/lib/modules/manager/gradle/parser/plugins.ts b/lib/modules/manager/gradle/parser/plugins.ts index d644d3d75baa17..a656c2e5e4e790 100644 --- a/lib/modules/manager/gradle/parser/plugins.ts +++ b/lib/modules/manager/gradle/parser/plugins.ts @@ -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')) @@ -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', @@ -37,8 +37,9 @@ export const qPlugins = q // id("foo.bar") version "1.2.3" q.sym('version').join(qVersion), // id("foo.bar").version("1.2.3") + // id("foo.bar") version("1.2.3") q - .op('.') + .opt(q.op('.')) .sym('version') .tree({ maxDepth: 1,