Skip to content

Scalac classpath cache should invalidate modified jars #10295

Closed
@smarter

Description

@smarter

Since Scala 2.12, classpath entries are cached unless -YdisableFlatCpCaching is passed to scalac, this can have very surprising results like breaking this sbt test that uses unmanagedJars: https://github.com/sbt/sbt/tree/0.13/sbt/src/sbt-test/source-dependencies/binary (you can copy this folder somewhere, set scalacOptions to 2.12.2 and verify that launching sbt, doing use/compile, removing dep/A.scala, and doing use/compile again compiles even though the dependency does not exist and the jar has been updated, adding scalacOptions += "-YdisableFlatCpCaching" fixes that.

I think the scalac cache in https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/classpath/ZipAndJarFileLookupFactory.scala should be more intelligent and invalidate modified jars.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions