mirror of
https://github.com/sbt/sbt.git
synced 2026-09-04 16:54:29 +02:00
sjsonnew serializes a File as a (uri, Long) pair whose Long is a SHA-256 of the file's contents, and the read direction discards it. A report names each artifact once per configuration it resolved in, and the projects of a build largely share their dependencies, so writing the caches re-reads the whole downloaded classpath many times over: on a 302-module monorepo, 755 GB of jars and about 11 minutes of CPU for bytes no reader looks at. Staleness comes from LibraryManagement.fileUptodate instead, which checks File.exists and the modification time against UpdateReport.stamps. UpdateReportPersistence.CacheCodec extends the LibraryManagementCodec trait and overrides the inherited fileStringLongIso so the pair carries 0. That member is virtual, so the override also reaches the Vector[(Artifact, File)] nested inside the generated ModuleReportFormat, which a locally-scoped JsonFormat[File] could not. The inputs store keeps the stock codec, so Tracked.inputChanged still hashes contents for invalidation. The JSON shape is unchanged, so caches stay readable in both directions. Co-authored-by: Claude Opus 5 <[email protected]>