diff options
| author | Jack Koenig | 2017-11-15 14:19:40 -0800 |
|---|---|---|
| committer | Adam Izraelevitz | 2017-12-29 11:44:24 -0800 |
| commit | cfae691ae172633845e279c27be3d70ff5e50cfe (patch) | |
| tree | a202806126493ae21471874d7dd6f3c50ca49915 /src | |
| parent | b5a3c2e9c2b6336d4a4ee896e05b5cf2cd45c9f3 (diff) | |
Remove option --force-append-anno-file, make default
The logic around this option was unintuitive and led to silently dropped
annotations.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/Driver.scala | 22 | ||||
| -rw-r--r-- | src/main/scala/firrtl/ExecutionOptionsManager.scala | 8 | ||||
| -rw-r--r-- | src/test/scala/firrtlTests/DriverSpec.scala | 2 |
3 files changed, 12 insertions, 20 deletions
diff --git a/src/main/scala/firrtl/Driver.scala b/src/main/scala/firrtl/Driver.scala index acc7603b..66123d77 100644 --- a/src/main/scala/firrtl/Driver.scala +++ b/src/main/scala/firrtl/Driver.scala @@ -95,23 +95,15 @@ object Driver { * update the firrtlOptions with new annotations if it does */ def loadAnnotations(optionsManager: ExecutionOptionsManager with HasFirrtlOptions): Unit = { - /* - If firrtlAnnotations in the firrtlOptions are nonEmpty then these will be the annotations - used by firrtl. - To use the file annotations make sure that the annotations in the firrtlOptions are empty - The annotation file if needed is found via - s"$targetDirName/$topName.anno" or s"$annotationFileNameOverride.anno" - */ + def firrtlConfig = optionsManager.firrtlOptions - if (firrtlConfig.annotations.isEmpty || firrtlConfig.forceAppendAnnoFile) { - val annotationFileName = firrtlConfig.getAnnotationFileName(optionsManager) - val annotationFile = new File(annotationFileName) - if (annotationFile.exists) { - val annotationsYaml = io.Source.fromFile(annotationFile).getLines().mkString("\n").parseYaml - val annotationArray = annotationsYaml.convertTo[Array[Annotation]] - optionsManager.firrtlOptions = firrtlConfig.copy(annotations = firrtlConfig.annotations ++ annotationArray) - } + val annotationFileName = firrtlConfig.getAnnotationFileName(optionsManager) + val annotationFile = new File(annotationFileName) + if (annotationFile.exists) { + val annotationsYaml = io.Source.fromFile(annotationFile).getLines().mkString("\n").parseYaml + val annotationArray = annotationsYaml.convertTo[Array[Annotation]] + optionsManager.firrtlOptions = firrtlConfig.copy(annotations = firrtlConfig.annotations ++ annotationArray) } if(firrtlConfig.annotations.nonEmpty) { diff --git a/src/main/scala/firrtl/ExecutionOptionsManager.scala b/src/main/scala/firrtl/ExecutionOptionsManager.scala index c6a94766..8bbb8dcd 100644 --- a/src/main/scala/firrtl/ExecutionOptionsManager.scala +++ b/src/main/scala/firrtl/ExecutionOptionsManager.scala @@ -179,7 +179,6 @@ case class FirrtlExecutionOptions( annotations: List[Annotation] = List.empty, annotationFileNameOverride: String = "", outputAnnotationFileName: String = "", - forceAppendAnnoFile: Boolean = false, emitOneFilePerModule: Boolean = false, dontCheckCombLoops: Boolean = false, noDCE: Boolean = false) @@ -319,10 +318,11 @@ trait HasFirrtlOptions { parser.opt[Unit]("force-append-anno-file") .abbr("ffaaf") + .hidden() .foreach { _ => - firrtlOptions = firrtlOptions.copy(forceAppendAnnoFile = true) - }.text { - "use this to force appending annotation file to annotations being passed in through optionsManager" + val msg = "force-append-anno-file is deprecated and will soon be removed\n" + + (" "*9) + "(It does not do anything anymore)" + Driver.dramaticWarning(msg) } parser.opt[String]("output-annotation-file") diff --git a/src/test/scala/firrtlTests/DriverSpec.scala b/src/test/scala/firrtlTests/DriverSpec.scala index 190b2b42..b589f69a 100644 --- a/src/test/scala/firrtlTests/DriverSpec.scala +++ b/src/test/scala/firrtlTests/DriverSpec.scala @@ -173,7 +173,7 @@ class DriverSpec extends FreeSpec with Matchers with BackendCompilationUtilities val annoFile = new File(targetDir, "annotations.anno") optionsManager.parse( - Array("--infer-rw", "circuit", "-faf", annoFile.toString, "-ffaaf") + Array("--infer-rw", "circuit", "-faf", annoFile.toString) ) should be (true) copyResourceToFile("/annotations/SampleAnnotations.anno", annoFile) |
