Skip to content

Commit

Permalink
Remove ExecutionContext passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Oct 12, 2024
1 parent 3bd4fbb commit 2290dee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ package sbt.internal.inc.consistent
* additional information regarding copyright ownership.
*/

import java.io.{ File, FileInputStream, FileOutputStream }
import java.util.Optional
import sbt.io.{ IO, Using }
import xsbti.compile.analysis.ReadWriteMappers
import xsbti.compile.{ AnalysisContents, AnalysisStore => XAnalysisStore }

import java.io.{ File, FileInputStream, FileOutputStream }
import java.util.Optional
import scala.util.control.Exception.allCatch
import xsbti.compile.analysis.ReadWriteMappers

import scala.concurrent.ExecutionContext

object ConsistentFileAnalysisStore {
def text(
file: File,
mappers: ReadWriteMappers,
sort: Boolean = true,
ec: ExecutionContext = ExecutionContext.global,
parallelism: Int = Runtime.getRuntime.availableProcessors()
): XAnalysisStore =
new AStore(
file,
new ConsistentAnalysisFormat(mappers, sort),
SerializerFactory.text,
ec,
parallelism
)

Expand All @@ -59,22 +55,19 @@ object ConsistentFileAnalysisStore {
file: File,
mappers: ReadWriteMappers,
sort: Boolean,
ec: ExecutionContext = ExecutionContext.global,
parallelism: Int = Runtime.getRuntime.availableProcessors()
): XAnalysisStore =
new AStore(
file,
new ConsistentAnalysisFormat(mappers, sort),
SerializerFactory.binary,
ec,
parallelism
)

private final class AStore[S <: Serializer, D <: Deserializer](
file: File,
format: ConsistentAnalysisFormat,
sf: SerializerFactory[S, D],
ec: ExecutionContext = ExecutionContext.global,
parallelism: Int = Runtime.getRuntime.availableProcessors()
) extends XAnalysisStore {

Expand All @@ -85,7 +78,7 @@ object ConsistentFileAnalysisStore {
if (!file.getParentFile.exists()) file.getParentFile.mkdirs()
val fout = new FileOutputStream(tmpAnalysisFile)
try {
val gout = new ParallelGzipOutputStream(fout, ec, parallelism)
val gout = new ParallelGzipOutputStream(fout, parallelism)
val ser = sf.serializerFor(gout)
format.write(ser, analysis, setup)
gout.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ object MixedAnalyzingCompiler {
useConsistent = false,
mappers = ReadWriteMappers.getEmptyMappers(),
sort = true,
ec = ExecutionContext.global,
parallelism = Runtime.getRuntime.availableProcessors(),
)

Expand All @@ -517,7 +516,6 @@ object MixedAnalyzingCompiler {
useConsistent: Boolean,
mappers: ReadWriteMappers,
sort: Boolean,
ec: ExecutionContext,
parallelism: Int,
): AnalysisStore = {
val fileStore = (useTextAnalysis, useConsistent) match {
Expand All @@ -528,7 +526,6 @@ object MixedAnalyzingCompiler {
file = analysisFile.toFile,
mappers = mappers,
sort = sort,
ec = ec,
parallelism = parallelism,
)
case (true, false) =>
Expand All @@ -538,7 +535,6 @@ object MixedAnalyzingCompiler {
file = analysisFile.toFile,
mappers = mappers,
sort = sort,
ec = ec,
parallelism = parallelism,
)
}
Expand Down

0 comments on commit 2290dee

Please sign in to comment.