Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix zinc binary dependencies (#1904)
Fix #1901 Zinc uses a `MappedFileConverter`, it will converter `jdk` internal classes like `/module/java.base/java.lang.String` associated with a dummpy `rt.jar`. https://github.com/sbt/zinc/blob/57d03412abe3810be5762a8c8e8c55cbf622ed03/internal/zinc-core/src/main/scala/sbt/internal/inc/MappedVirtualFile.scala#L56 ```scala def toVirtualFile(path: Path): VirtualFile = { rootPaths2.find { case (_, rootPath) => path.startsWith(rootPath) } match { case Some((key, rootPath)) => MappedVirtualFile(s"$${$key}/${rootPath.relativize(path)}".replace('\\', '/'), rootPaths) case _ => def isCtSym = path.getFileSystem .provider() .getScheme == "jar" && path.getFileSystem.toString.endsWith("ct.sym") def isJrt = path.getFileSystem.provider().getScheme == "jrt" if (isJrt || path.getFileName.toString == "rt.jar" || isCtSym) DummyVirtualFile("rt.jar", path) else if (allowMachinePath) MappedVirtualFile(s"$path".replace('\\', '/'), rootPaths) else sys.error(s"$path cannot be mapped using the root paths $rootPaths") } } ``` And later the `Incremental` will exclude such binary dependencies. https://github.com/sbt/zinc/blob/57d03412abe3810be5762a8c8e8c55cbf622ed03/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala#L783 ```scala // dependency is some other binary on the classpath. // exclude dependency tracking with rt.jar, for example java.lang.String -> rt.jar. if (!vf.id.endsWith("rt.jar")) { externalLibraryDependency( vf, onBinaryName, sourceFile, context ) } ``` This commit implements the exclusion, when reading the `Incremental` analysis file. Pull request: #1904
- Loading branch information