aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options
diff options
context:
space:
mode:
authorJack Koenig2020-08-12 21:17:14 -0700
committerGitHub2020-08-13 04:17:14 +0000
commit39f510a9081d09d94d56eb89ceb97a678993fda1 (patch)
tree02dcadb37c768d5763f6eae87b84b5aeeead6df1 /src/main/scala/firrtl/options
parente1d3a0c64a48b4c9999ad59f15922db7c155c361 (diff)
Remove LegacyAnnotation and [most] MoultingYaml (#1833)
* Remove LegacyAnnotation and MoultingYaml It has been deprecated since 1.1 * Remove all uses of ConvertLegacyAnnotations Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/scala/firrtl/options')
-rw-r--r--src/main/scala/firrtl/options/Stage.scala3
-rw-r--r--src/main/scala/firrtl/options/phases/AddDefaults.scala2
-rw-r--r--src/main/scala/firrtl/options/phases/Checks.scala2
-rw-r--r--src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala6
-rw-r--r--src/main/scala/firrtl/options/phases/GetIncludes.scala18
-rw-r--r--src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala1
6 files changed, 7 insertions, 25 deletions
diff --git a/src/main/scala/firrtl/options/Stage.scala b/src/main/scala/firrtl/options/Stage.scala
index 2b7bb9d6..aa4809dd 100644
--- a/src/main/scala/firrtl/options/Stage.scala
+++ b/src/main/scala/firrtl/options/Stage.scala
@@ -32,8 +32,7 @@ abstract class Stage extends Phase {
*/
final def transform(annotations: AnnotationSeq): AnnotationSeq = {
val annotationsx =
- Seq( new phases.GetIncludes,
- new phases.ConvertLegacyAnnotations )
+ Seq(new phases.GetIncludes)
.map(phases.DeletedWrapper(_))
.foldLeft(annotations)((a, p) => p.transform(a))
diff --git a/src/main/scala/firrtl/options/phases/AddDefaults.scala b/src/main/scala/firrtl/options/phases/AddDefaults.scala
index 9777aff0..ab342b1e 100644
--- a/src/main/scala/firrtl/options/phases/AddDefaults.scala
+++ b/src/main/scala/firrtl/options/phases/AddDefaults.scala
@@ -12,7 +12,7 @@ import firrtl.options.{Dependency, Phase, TargetDirAnnotation}
*/
class AddDefaults extends Phase {
- override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations])
+ override def prerequisites = Seq(Dependency[GetIncludes])
override def optionalPrerequisiteOf = Seq.empty
diff --git a/src/main/scala/firrtl/options/phases/Checks.scala b/src/main/scala/firrtl/options/phases/Checks.scala
index 7dce7bbe..9e671aa5 100644
--- a/src/main/scala/firrtl/options/phases/Checks.scala
+++ b/src/main/scala/firrtl/options/phases/Checks.scala
@@ -12,7 +12,7 @@ import firrtl.options.Dependency
*/
class Checks extends Phase {
- override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations], Dependency[AddDefaults])
+ override def prerequisites = Seq(Dependency[GetIncludes], Dependency[AddDefaults])
override def optionalPrerequisiteOf = Seq.empty
diff --git a/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala b/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala
index 559b5d28..d75acbb2 100644
--- a/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala
+++ b/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala
@@ -3,10 +3,9 @@
package firrtl.options.phases
import firrtl.AnnotationSeq
-import firrtl.annotations.LegacyAnnotation
import firrtl.options.{Dependency, Phase}
-/** Convert any [[firrtl.annotations.LegacyAnnotation LegacyAnnotation]]s to non-legacy variants */
+@deprecated("LegacyAnnotation has been removed, this is a no-op", "FIRRTL 1.4")
class ConvertLegacyAnnotations extends Phase {
override def prerequisites = Seq(Dependency[GetIncludes])
@@ -15,6 +14,5 @@ class ConvertLegacyAnnotations extends Phase {
override def invalidates(a: Phase) = false
- def transform(annotations: AnnotationSeq): AnnotationSeq = LegacyAnnotation.convertLegacyAnnos(annotations)
-
+ def transform(annotations: AnnotationSeq): AnnotationSeq = annotations
}
diff --git a/src/main/scala/firrtl/options/phases/GetIncludes.scala b/src/main/scala/firrtl/options/phases/GetIncludes.scala
index a0b15173..b9320585 100644
--- a/src/main/scala/firrtl/options/phases/GetIncludes.scala
+++ b/src/main/scala/firrtl/options/phases/GetIncludes.scala
@@ -2,11 +2,8 @@
package firrtl.options.phases
-import net.jcazevedo.moultingyaml._
-
import firrtl.AnnotationSeq
-import firrtl.annotations.{AnnotationFileNotFoundException, JsonProtocol, LegacyAnnotation}
-import firrtl.annotations.AnnotationYamlProtocol._
+import firrtl.annotations.{AnnotationFileNotFoundException, JsonProtocol}
import firrtl.options.{InputAnnotationFileAnnotation, Phase, StageUtils}
import firrtl.FileUtils
@@ -31,18 +28,7 @@ class GetIncludes extends Phase {
private def readAnnotationsFromFile(filename: String): AnnotationSeq = {
val file = new File(filename).getCanonicalFile
if (!file.exists) { throw new AnnotationFileNotFoundException(file) }
- JsonProtocol.deserializeTry(file).recoverWith { case jsonException =>
- // Try old protocol if new one fails
- Try {
- val yaml = FileUtils.getText(file).parseYaml
- val result = yaml.convertTo[List[LegacyAnnotation]]
- val msg = s"$file is a YAML file!\n" + (" "*9) + "YAML Annotation files are deprecated! Use JSON"
- StageUtils.dramaticWarning(msg)
- result
- }.orElse { // Propagate original JsonProtocol exception if YAML also fails
- Failure(jsonException)
- }
- }.get
+ JsonProtocol.deserialize(file)
}
/** Recursively read all [[Annotation]]s from any [[InputAnnotationFileAnnotation]]s while making sure that each file is
diff --git a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
index ccd08fa4..7ee385b1 100644
--- a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
+++ b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
@@ -17,7 +17,6 @@ class WriteOutputAnnotations extends Phase {
override def prerequisites =
Seq( Dependency[GetIncludes],
- Dependency[ConvertLegacyAnnotations],
Dependency[AddDefaults],
Dependency[Checks] )