Skip to content

Commit

Permalink
Merge pull request #1463 from Friendseeker/consistent-dummy-jar-backport
Browse files Browse the repository at this point in the history
[1.x] Backport dummy output jar handling for Consistent Analysis Format
  • Loading branch information
eed3si9n authored Oct 16, 2024
2 parents be2aa98 + c890098 commit f358b72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ object Analysis {
}

lazy val dummyOutputPath: Path = Paths.get("/tmp/dummy")
lazy val dummyOutputJarPath: Path = Paths.get("/tmp/dummy/output.jar")
}

private class MAnalysis(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Compat._
class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) {
import ConsistentAnalysisFormat._

private[this] final val VERSION = 1100028
private[this] final val VERSION = 1100029
private[this] final val readMapper = mappers.getReadMapper
private[this] final val writeMapper = mappers.getWriteMapper

Expand All @@ -40,6 +40,7 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) {
writeStamps(out, analysis0.stamps)
writeAPIs(out, analysis0.apis, setup.storeApis())
writeSourceInfos(out, analysis0.infos)
// we do not read or write the Compilations
out.int(VERSION)
out.end()
}
Expand All @@ -51,9 +52,11 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) {
val stamps = readStamps(in)
val apis = readAPIs(in, setup.storeApis())
val infos = readSourceInfos(in)
// we do not read or write the Compilations
val compilations = Compilations.of(Nil)
readVersion(in)
in.end()
(Analysis.Empty.copy(stamps, apis, relations, infos, Compilations.of(Nil)), setup)
(Analysis.Empty.copy(stamps, apis, relations, infos, compilations), setup)
}

@inline
Expand Down Expand Up @@ -294,6 +297,13 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) {
out.byte(setup.order.ordinal().toByte)
out.bool(setup.storeApis())
out.writeArray("extra", setup.extra, 2) { t => out.string(t.get1); out.string(t.get2) }
val singleOutput = setup.output().getSingleOutputAsPath()
val outputPath = singleOutput match {
case o if o.isPresent() && o.get().getFileName().toString().endsWith(".jar") =>
Analysis.dummyOutputJarPath
case _ => Analysis.dummyOutputPath
}
out.string(outputPath.toString())
}
}

Expand All @@ -308,8 +318,9 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) {
val compileOrder = CompileOrder.values()(in.byte().toInt)
val skipApiStoring = in.bool()
val extra = in.readArray(2) { InterfaceUtil.t2(in.string() -> in.string()) }
val outputPath = in.string()
readMapper.mapMiniSetup(MiniSetup.of(
CompileOutput(Analysis.dummyOutputPath),
CompileOutput(Paths.get(outputPath)),
MiniOptions.of(classpathHash, scalacOptions, javacOptions),
compilerVersion,
compileOrder,
Expand Down

0 comments on commit f358b72

Please sign in to comment.