From 7c7de8d404b0e6d5ed0c67b4a7862c62b36e0958 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Mon, 20 Dec 2021 12:08:39 -0800 Subject: [plugin] Internal refactor, remove useBundlePlugin It is always true. The scalacOption to enable it is still supported and prints a warning that the option no longer does anything. --- .../main/scala/chisel3/internal/plugin/BundleComponent.scala | 8 ++------ .../src/main/scala/chisel3/internal/plugin/ChiselPlugin.scala | 10 +++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugin/src/main') diff --git a/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala b/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala index 67d744fc..c3a001fa 100644 --- a/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala +++ b/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala @@ -26,14 +26,10 @@ private[plugin] class BundleComponent(val global: Global, arguments: ChiselPlugi // instead we just check the version and if its an early Scala version, the plugin does nothing val scalaVersion = scala.util.Properties.versionNumberString.split('.') val scalaVersionOk = scalaVersion(0).toInt == 2 && scalaVersion(1).toInt >= 12 - if (scalaVersionOk && arguments.useBundlePlugin) { + if (scalaVersionOk) { unit.body = new MyTypingTransformer(unit).transform(unit.body) } else { - val reason = if (!scalaVersionOk) { - s"invalid Scala version '${scala.util.Properties.versionNumberString}'" - } else { - s"not enabled via '${arguments.useBundlePluginFullOpt}'" - } + val reason = s"invalid Scala version '${scala.util.Properties.versionNumberString}'" // Enable this with scalacOption '-Ylog:chiselbundlephase' global.log(s"Skipping BundleComponent on account of $reason.") } diff --git a/plugin/src/main/scala/chisel3/internal/plugin/ChiselPlugin.scala b/plugin/src/main/scala/chisel3/internal/plugin/ChiselPlugin.scala index 23082329..2282059f 100644 --- a/plugin/src/main/scala/chisel3/internal/plugin/ChiselPlugin.scala +++ b/plugin/src/main/scala/chisel3/internal/plugin/ChiselPlugin.scala @@ -7,14 +7,18 @@ import nsc.Global import nsc.plugins.{Plugin, PluginComponent} import scala.reflect.internal.util.NoPosition -private[plugin] case class ChiselPluginArguments(var useBundlePlugin: Boolean = true) { +private[plugin] case class ChiselPluginArguments() { def useBundlePluginOpt = "useBundlePlugin" - def useBundlePluginFullOpt = s"-P:chiselplugin:$useBundlePluginOpt" + def useBundlePluginFullOpt = s"-P:${ChiselPlugin.name}:$useBundlePluginOpt" +} + +object ChiselPlugin { + val name = "chiselplugin" } // The plugin to be run by the Scala compiler during compilation of Chisel code class ChiselPlugin(val global: Global) extends Plugin { - val name = "chiselplugin" + val name = ChiselPlugin.name val description = "Plugin for Chisel 3 Hardware Description Language" private val arguments = ChiselPluginArguments() val components: List[PluginComponent] = List[PluginComponent]( -- cgit v1.2.3