Add a compiler option to write .sig files to disk#8175
Merged
retronym merged 1 commit intoscala:2.12.xfrom Jul 5, 2019
Merged
Conversation
Member
Author
|
/cc @stuhood |
retronym
commented
Jun 24, 2019
src/compiler/scala/tools/nsc/backend/jvm/ClassfileWriters.scala
Outdated
Show resolved
Hide resolved
854b83e to
193c102
Compare
retronym
commented
Jun 24, 2019
| sigWriter match { | ||
| case Some((writer, dest)) => | ||
| writer.close() | ||
| reporter.info(NoPosition, "[sig files written]", force = false) |
Member
Author
There was a problem hiding this comment.
This output will show up under -verbose. Once you see that, downstream compilation could be started.
Member
There was a problem hiding this comment.
Should we clean up -verbose? The output is still full of
[loaded class file /Users/luc/scala/scala-2.13.0/lib/scala-library.jar(scala/Function2$mcJJI$sp.class) in 0ms]
which seems unnecessary.
Member
Author
There was a problem hiding this comment.
I don't think that stops a tool turning it on to experiment with this PR, so I'd be inclined to leave it for now.
8027722 to
758964b
Compare
fe7f871 to
8aa828a
Compare
Refactor `ClassfileWriters` to share code with this new output
type.
Take advantage of this in PipelineMain.
```
$ tail sandbox/{test,client}.scala
==> sandbox/test.scala <==
package p1.p2
case class Test()
==> sandbox/client.scala <==
package p3
class Client {
new p1.p2.Test()
}
$ qscalac -Youtline -Ypickle-java -Ypickle-write /tmp/out -Ystop-after:pickler -d /tmp/out sandbox/test.scala
$ find /tmp/out
/tmp/out
/tmp/out/p1
/tmp/out/p1/p2
/tmp/out/p1/p2/Test.sig
$ qscalac -cp /tmp/out -d /tmp/out sandbox/client.scala
$ find /tmp/out
/tmp/out
/tmp/out/p3
/tmp/out/p3/Client.class
/tmp/out/p1
/tmp/out/p1/p2
/tmp/out/p1/p2/Test.sig
```
8aa828a to
3ee75e0
Compare
lrytz
approved these changes
Jul 4, 2019
| private def writeSigFile(sym: Symbol, pickle: PickleBuffer): Unit = { | ||
| sigWriter.foreach { writer => | ||
| val binaryName = sym.javaBinaryNameString | ||
| val binaryClassName = if (sym.isModule) binaryName.stripSuffix(nme.MODULE_SUFFIX_STRING) else binaryName |
Member
There was a problem hiding this comment.
Ah, the signature is on the mirror class normally as well. 👍
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
ClassfileWritersto share code with this new outputtype.
Take advantage of this in PipelineMain.