ihji / sbt-antlr4

Antlr4 plugin for sbt 1.1+ and 0.13.x
57 stars 35 forks source link

incompatibility with sbt 1.1.0: A named attribute key must start with a lowercase letter #18

Closed mpollmeier closed 6 years ago

mpollmeier commented 6 years ago

full stacktrace:

java.lang.IllegalArgumentException: requirement failed: A named attribute key must start with a lowercase letter: Build dependency required for parsing grammars, scoped to plugin
[error]         at scala.Predef$.require(Predef.scala:277)
[error]         at sbt.internal.util.AttributeKey$$anon$1.<init>(Attributes.scala:102)
[error]         at sbt.internal.util.AttributeKey$.make(Attributes.scala:98)
[error]         at sbt.internal.util.AttributeKey$.apply(Attributes.scala:87)
[error]         at sbt.internal.util.AttributeKey$.apply(Attributes.scala:76)
[error]         at sbt.SettingKey$.apply(Structure.scala:673)
[error]         at com.simplytyped.Antlr4Plugin$.<init>(Antlr4Plugin.scala:22)
[error]         at com.simplytyped.Antlr4Plugin$.<clinit>(Antlr4Plugin.scala)

The error doesn't quite make sense to me, since the SettingKey antlr4BuildDependency does start with a lowercase letter. Any ideas?

jaa127 commented 6 years ago

This can be fixed with following patch, but I haven't had time to check that this is correct way to fix this.

diff --git a/src/main/scala/com/simplytyped/Antlr4Plugin.scala b/src/main/scala/com/simplytyped/Antlr4Plugin.scala
index 7dd2772..a028ed8 100644
--- a/src/main/scala/com/simplytyped/Antlr4Plugin.scala
+++ b/src/main/scala/com/simplytyped/Antlr4Plugin.scala
@@ -9,17 +9,17 @@ import scala.sys.process.Process
 object Antlr4Plugin extends AutoPlugin {
   object autoImport {
     val Antlr4 = config("antlr4")
-    val antlr4Version = SettingKey[String]("Version of antlr4")
-    val antlr4Generate = TaskKey[Seq[File]]("Generate classes from antlr4 grammars")
-    val antlr4RuntimeDependency = SettingKey[ModuleID]("Library dependency for antlr4 runtime")
-    val antlr4Dependency = SettingKey[ModuleID]("Build dependency required for parsing grammars")
-    val antlr4PackageName = SettingKey[Option[String]]("Name of the package for generated classes")
-    val antlr4GenListener = SettingKey[Boolean]("Generate listener")
-    val antlr4GenVisitor = SettingKey[Boolean]("Generate visitor")
+    val antlr4Version = settingKey[String]("Version of antlr4")
+    val antlr4Generate = taskKey[Seq[File]]("Generate classes from antlr4 grammars")
+    val antlr4RuntimeDependency = settingKey[ModuleID]("Library dependency for antlr4 runtime")
+    val antlr4Dependency = settingKey[ModuleID]("Build dependency required for parsing grammars")
+    val antlr4PackageName = settingKey[Option[String]]("Name of the package for generated classes")
+    val antlr4GenListener = settingKey[Boolean]("Generate listener")
+    val antlr4GenVisitor = settingKey[Boolean]("Generate visitor")
   }
   import autoImport._

-  private val antlr4BuildDependency = SettingKey[ModuleID]("Build dependency required for parsing grammars, scoped to plugin")
+  private val antlr4BuildDependency = settingKey[ModuleID]("Build dependency required for parsing grammars, scoped to plugin")

   def antlr4GeneratorTask : Def.Initialize[Task[Seq[File]]] = Def.task {
     val targetBaseDir = (javaSource in Antlr4).value
mpollmeier commented 6 years ago

thank you both!