diffplug / diffplug/spotless

Enabling Parrot Parser for Groovy Eclipse

未关闭
#975 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Java
星标
5.6k
派生
559
平均合并
1 天 14 小时
30 天内合并 PR
43

描述

Since spotless depends on groovy-eclipse for groovy parsing/formatting, and since groovy-eclipse doesn't enable the parrot parser by default, Spotless fails when configured for groovy code that utilizes Groovy 3+ syntax.

After experiencing some pain with spotless + groovy, I stumbled upon #246 which led me to dig into groovy-eclipse. Turns out groovy-eclipse leaves the new antlr4 based Parrot Parser [disabled by default](https://github.com/groovy/groovy-eclipse/wiki/4.2.0-Release-Notes#support-for-new-versions-of-groovy), which means any newer Groovy 3 syntax that contains, for example, Java lambdas, blows up.

I can manually add `-Dgroovy.antlr4=true` to my Gradle execution and that gets it working for me locally, but there should be some way to configure this right within build.gradle? I'm trying to find a solution that is more amenable to a team environment.

In the past I've modified JavaExec tasks and the like to include forked JVM options. But there seems to be no way to do that for SpotlessTask.

Am I missing something obvious here?

贡献指南

打开贡献指南

调研方向

首先追踪 SpotlessTask 以及 build.gradle 中描述的 Gradle 配置,然后使用 Groovy 3+ 语法和 -Dgroovy.antlr4=true 选项重现故障。当团队可以通过 build.gradle 启用 Parrot Parser,而无需为每次 Gradle 执行手动添加 JVM 选项时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
groovy, java
领域
build-system, tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。