diff options
| author | chick | 2019-08-01 09:21:52 -0700 |
|---|---|---|
| committer | chick | 2019-08-01 10:52:22 -0700 |
| commit | 54e67889f10b39323fb729808b8cd22b4c832910 (patch) | |
| tree | 4b5916fe8e6cee619ab5dfc3549bfb625b5b8214 /src/main/scala/firrtl/options/phases/GetIncludes.scala | |
| parent | 86d2470d8294a4dba37d33ba021558ba33da4d65 (diff) | |
Followup to PR #1142
Fixes a threading bug in where lazy reading of file
caused a problem for multithreaded access to the that was read.
Changes all uses of io.Source to use new API
getText
getLines
getTextResource
getLinesResouce
Make style to only import FileUtils and not its methods
So code is more explicit as e.g. FileUtils.getText()
Diffstat (limited to 'src/main/scala/firrtl/options/phases/GetIncludes.scala')
| -rw-r--r-- | src/main/scala/firrtl/options/phases/GetIncludes.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/options/phases/GetIncludes.scala b/src/main/scala/firrtl/options/phases/GetIncludes.scala index 9e198c61..cb9bb840 100644 --- a/src/main/scala/firrtl/options/phases/GetIncludes.scala +++ b/src/main/scala/firrtl/options/phases/GetIncludes.scala @@ -8,6 +8,7 @@ import firrtl.AnnotationSeq import firrtl.annotations.{AnnotationFileNotFoundException, JsonProtocol, LegacyAnnotation} import firrtl.annotations.AnnotationYamlProtocol._ import firrtl.options.{InputAnnotationFileAnnotation, Phase, StageUtils} +import firrtl.FileUtils import java.io.File @@ -27,7 +28,7 @@ class GetIncludes extends Phase { JsonProtocol.deserializeTry(file).recoverWith { case jsonException => // Try old protocol if new one fails Try { - val yaml = io.Source.fromFile(file).getLines().mkString("\n").parseYaml + 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) |
