Created
February 5, 2016 19:55
-
-
Save sam/8a4739329f2a9a476487 to your computer and use it in GitHub Desktop.
Caching compilation results errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compile(): List[CompiledScript] = { | |
val outputCache = directory / ".cache" | |
if(!outputCache.exists()) outputCache.mkdirs() | |
val engine: IMain = new ScriptEngineManager().getEngineByName("scala").asInstanceOf[IMain] | |
engine.settings.usejavacp.value = true | |
// TODO: This breaks things. No idea why. | |
// engine.settings.outdir.value = outputCache.getCanonicalPath | |
directory.listFiles().toList collect { | |
case file @ FileExtension("scala") => using(new FileReader(file))(engine.compile) | |
} | |
} | |
/* | |
I get the following error when calling foreach eval() on the results: | |
[info] <console>:14: error: not found: value engine | |
[info] }.asInstanceOf[Object]; def getEngine: javax.script.ScriptEngine = engine } | |
That source isn't in my own code. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment