Skip to content

Commit

Permalink
Fix writesToOutputDir
Browse files Browse the repository at this point in the history
outputDirectory.isInstanceOf[JarArchive] was always false because
`outputDirectory`'s type is java.nio.file.Path which never be an
insntace of `JarArchive`.
  • Loading branch information
tanishiking committed Oct 19, 2023
1 parent 053e644 commit 567d486
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ExtractSemanticDB private (phaseMode: ExtractSemanticDB.PhaseMode) extends
val outputDir =
ExtractSemanticDB.semanticdbPath(
unit.source,
ExtractSemanticDB.outputDirectory(using unitCtx),
ExtractSemanticDB.semanticdbOutDir(using unitCtx),
sourceRoot
)
(outputDir, ws.map(_.toSemanticDiagnostic))
Expand All @@ -86,7 +86,7 @@ class ExtractSemanticDB private (phaseMode: ExtractSemanticDB.PhaseMode) extends
val outputDir =
ExtractSemanticDB.semanticdbPath(
unit.source,
ExtractSemanticDB.outputDirectory(using unitCtx),
ExtractSemanticDB.semanticdbOutDir(using unitCtx),
sourceRoot
)
val extractor = ExtractSemanticDB.Extractor()
Expand Down Expand Up @@ -128,8 +128,13 @@ object ExtractSemanticDB:
.filterNot(_.isEmpty)
.map(Paths.get(_))

private def outputDirectory(using Context): Path =
semanticdbTarget.getOrElse(ctx.settings.outputDir.value.jpath)
/** Destination for generated classfiles */
private def outputDirectory(using Context): AbstractFile =
ctx.settings.outputDir.value

/** Output directory for SemanticDB files */
private def semanticdbOutDir(using Context): Path =
semanticdbTarget.getOrElse(outputDirectory.jpath)

private def absolutePath(path: Path): Path = path.toAbsolutePath.normalize

Expand Down

0 comments on commit 567d486

Please sign in to comment.