>From 8ff95a02a321d730e2c3171b18ddb55f3a554d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Thu, 2 May 2024 19:06:11 +0200 Subject: [PATCH] Make the Compilation mode recognize non-legacy Kotlin/Gradle errors The Compilation mode recognizes Kotlin/Gradle errors but only in the old format. The new format, which has been in wide use for about a year, is not supported. This patch adds support for the new format. * etc/compilation.txt: (symbols): Add a non-legacy Kotlin/Gradle warning and error. * lisp/progmodes/compile.el: (compilation-error-regexp-alist-alist): Rename 'gradle-kotlin' to 'gradle-kotlin-legacy' and add 'grade-kotlin' that matches errors and warnings outputted by non-legacy Kotlin/Gradle. --- etc/compilation.txt | 13 +++++++++++-- lisp/progmodes/compile.el | 20 +++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/etc/compilation.txt b/etc/compilation.txt index 05f0829864c..e4e361ecfc7 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -186,13 +186,22 @@ Warning near line 10 file arrayclash.f: Module contains no executable Nonportable usage near line 31 col 9 file assign.f: mixed default and explicit -* Gradle with kotlin-gradle-plugin +* Gradle with Kotlin plugin -symbol: gradle-kotlin +symbol: grade-kotlin + +e: file:///src/Test.kt:267:5 foo: bar +w: file:///src/Test.kt:267:5 foo: bar + + +* Gradle with Kotlin plugin (legacy) + +symbol: gradle-kotlin-legacy e: /src/Test.kt: (34, 15): foo: bar w: /src/Test.kt: (34, 15): foo: bar + * Gradle Android resource linking symbol: gradle-android diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b18eb81fee1..76a89bea4fc 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -258,10 +258,24 @@ compilation-error-regexp-alist-alist "\\(^Warning .*\\)? line[ \n]\\([0-9]+\\)[ \n]\\(?:col \\([0-9]+\\)[ \n]\\)?file \\([^ :;\n]+\\)" 4 2 3 (1)) - ;; Gradle with kotlin-gradle-plugin (see - ;; GradleStyleMessagerRenderer.kt in kotlin sources, see - ;; https://youtrack.jetbrains.com/issue/KT-34683). (gradle-kotlin + ,(rx bol + (| (group "w") ; 1: warning + (group (in "iv")) ; 2: info + "e") ; error + ": " + "file://" + (group ; 3: file + (? (in "A-Za-z") ":") + (+ (not (in "\n:")))) + ":" + (group (+ digit)) ; 4: line + ":" + (group (+ digit)) ; 5: column + " ") + 3 4 5 (1 . 2)) + + (gradle-kotlin-legacy ,(rx bol (| (group "w") ; 1: warning (group (in "iv")) ; 2: info -- 2.39.3 (Apple Git-146)