Skip to content

Simplify output directory handling #4744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 30, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Jun 29, 2018

Store the outputDir setting as an AbstractFile instead of a String, this
way we can use a virtual output directory in the REPL just by changing
the setting instead of having to subclass GenBCode.

@smarter smarter requested a review from allanrenucci June 29, 2018 22:16
@@ -37,7 +37,7 @@ private[repl] class Rendering(compiler: ReplCompiler,
new java.net.URLClassLoader(compilerClasspath.toArray, classOf[ReplDriver].getClassLoader)
}

myClassLoader = new AbstractFileClassLoader(compiler.directory, parent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiler is now unused

@@ -42,12 +42,8 @@ class GenBCode extends Phase {
private[this] var myOutput: AbstractFile = _

protected def outputDir(implicit ctx: Context): AbstractFile = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be private now?

if (!isJar && !path.isDirectory)
fail(s"'$arg' does not exist or is not a directory or .jar file", args)
else {
val output = if (isJar) JarArchive.create(path) else new PlainDirectory(path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will now hold on to an open jar during the whole compiler run instead of just backend. We didn't even open the jar before if we stopped before backend

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an empty open jar, so not a big deal I think (it cannot be deleted on Windows while it's open, but who cares?)

@smarter smarter force-pushed the directory-setting branch 3 times, most recently from d092765 to 8949f6c Compare June 29, 2018 23:14
Store the outputDir setting as an AbstractFile instead of a String, this
way we can use a virtual output directory just by changing the setting
instead of having to subclass GenBCode.
@smarter smarter force-pushed the directory-setting branch from 8949f6c to 818dbbd Compare June 29, 2018 23:19
Also stop extending DottyTest because I don't understand the weird way
it handles context. We'll need to clean up all that stuff some day.
@smarter smarter merged commit 32933a5 into scala:master Jun 30, 2018
@Blaisorblade Blaisorblade deleted the directory-setting branch July 2, 2018 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants