Skip to content

Commit

Permalink
fix RuleCompiler initialization by propertly setting classpath and ou…
Browse files Browse the repository at this point in the history
…tputDir
  • Loading branch information
rvacaru committed Aug 11, 2022
1 parent 3e41d76 commit 8dff964
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import dotty.tools.dotc.util.SourceFile
import dotty.tools.dotc.reporting.StoreReporter
import dotty.tools.dotc.interactive.InteractiveDriver
import dotty.tools.io.AbstractFile as DottyAbstractFile
import dotty.tools.io.VirtualDirectory as DottyVirtualDirectory

import scala.reflect.io.VirtualDirectory
import scala.reflect.io.AbstractFile
Expand All @@ -21,21 +22,15 @@ class RuleCompiler(
classpath: String,
target: AbstractFile = new VirtualDirectory("(memory)", None)
) {
// we are not configuring any settings!
// private val settings = new Settings()
// settings.deprecation.value = true // enable detailed deprecation warnings
// settings.unchecked.value = true // enable detailed unchecked warnings
// settings.outputDirs.setSingleOutput(target)
// settings.classpath.value = classpath
private val settings = "-unchecked" :: "-deprecation" :: Nil
private val driver = new InteractiveDriver(settings.distinct)
private val settings = "-unchecked" :: "-deprecation" :: "-classpath" :: classpath :: Nil
private val driver = new InteractiveDriver(settings)
private val reporter: StoreReporter = new StoreReporter()
private var ctx: FreshContext = driver.currentCtx.fresh

private val dottyVirtualDirectory = new DottyVirtualDirectory(target.name, None)

ctx = ctx
.setReporter(reporter)
.setSetting(ctx.settings.outputDir, DottyAbstractFile.getFile(target.path))
.setSetting(ctx.settings.classpath, classpath)
.setSetting(ctx.settings.outputDir, dottyVirtualDirectory)

private val compiler: Compiler = new Compiler()
private val classLoader: AbstractFileClassLoader =
Expand Down

0 comments on commit 8dff964

Please sign in to comment.