bloop
package bloop
- Alphabetic
- Public
- Protected
Package Members
Type Members
- final class BloopClassFileManager extends ClassFileManager
- final class BloopClasspathEntryLookup extends PerClasspathEntryLookup
- abstract class CompileBackgroundTasks extends AnyRef
- case class CompileInputs(scalaInstance: ScalaInstance, compilerCache: CompilerCache, sources: Array[AbsolutePath], classpath: Array[AbsolutePath], uniqueInputs: UniqueCompileInputs, out: CompileOutPaths, baseDirectory: AbsolutePath, scalacOptions: Array[String], javacOptions: Array[String], javacBin: Option[AbsolutePath], compileOrder: CompileOrder, classpathOptions: ClasspathOptions, previousResult: PreviousResult, previousCompilerResult: Result, reporter: ZincReporter, logger: ObservedLogger[Logger], dependentResults: Map[File, PreviousResult], cancelPromise: Promise[Unit], tracer: BraveTracer, ioScheduler: Scheduler, ioExecutor: Executor, invalidatedClassFilesInDependentProjects: Set[File], generatedClassFilePathsInDependentProjects: Map[String, File]) extends Product with Serializable
- case class CompileOutPaths(out: AbsolutePath, analysisOut: AbsolutePath, genericClassesDir: AbsolutePath, externalClassesDir: AbsolutePath, internalReadOnlyClassesDir: AbsolutePath) extends Product with Serializable
- case class CompileProducts(readOnlyClassesDir: Path, newClassesDir: Path, resultForDependentCompilationsInSameRun: PreviousResult, resultForFutureCompilationRuns: PreviousResult, invalidatedCompileProducts: Set[File], generatedRelativeClassFilePaths: Map[String, File]) extends Product with Serializable
Collects the products generated during the compilation of a project.
Collects the products generated during the compilation of a project.
It has two previous results. The first is to be used by the projects that depend on this compilation and are being compiled during this run. This result is used because it contains class file locations referring to both classes directories and because these two classes directories will be in the dependency classpath of dependent compilations.
The latter previous result is used for future client compilations. Future compilations will not see the
readOnlyClassesDir
andnewClassesDir
in this abstraction, but instead see an aggregated read-only classes directory.newClassesDir
will become this read-only classes directory by the time of that compilation because all compilation products (class files, semanticdb files, sjsir files, tasty files, nir files, etc) in the currentreadOnlyClassesDir
that are not innewClassesDir
will be copied over. Therefore,the result that is used for compilation will have all class file references rebased tonewClassesDir
.We use different previous results because we want to remove the cost of copying class files from
readOnlyClassesDir
tonewClassesDir
before starting dependent compilations. This scheme allows us to be fast and perform as much IO work in the background as possible. - final class CompilerCache extends AnyRef
- sealed trait ComponentLock extends GlobalLock
- sealed trait JavaSignal extends AnyRef
Signals the Zinc internals whether Java compilation should be attempted or not.
Signals the Zinc internals whether Java compilation should be attempted or not.
This signal is completed by Bloop when all the Scala compilations of dependent projects have been successful. If they haven't, then the java signal will be
FailFastCompilation
with the list of the projects that failed.The reason why we need a java signal is because pipelining may start the compilation of dependent projects earlier than the compilation of the dependent projects have compiled. This is okay for dependent Scala projects because they can be compiled against the public interfaces extracted from the Scala pickles, but it's not okay for the java compilation because Java code may have dependencies on Scala code, and for Javac to compile successfully it needs to read the Scala code public APIs from class files (which means the dependent projects need to have finished successfully).
- case class PartialCompileProducts(readOnlyClassesDir: AbsolutePath, newClassesDir: AbsolutePath) extends Product with Serializable
Collects the partial compile products generated after typechecking but before the end of compilation of a project.
- final class ScalaInstance extends xsbti.compile.ScalaInstance
- class ScalaInstanceTopLoader extends ClassLoader
The parent classloader of the Scala compiler.
The parent classloader of the Scala compiler. It was originally copied and pasted from https://github.com/lampepfl/dotty/blob/ea65338e06142f41f0e68b23250c8e22b0ba8837/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala#L586-L627
To understand why a custom parent classloader is needed for the compiler, let us describe some alternatives that wouldn't work.
-
new URLClassLoader(urls)
: The compiler contains sbt phases that callback to sbt using thexsbti.*
interfaces. Ifurls
does not contain the sbt interfaces we'll get aClassNotFoundException
in the compiler when we try to use them, ifurls
does contain the interfaces we'll get aClassCastException
or aLinkageError
because if the same class is loaded by two different classloaders, they are considered distinct by the JVM.-
new URLClassLoader(urls, bloopLoader)
: Because of the JVM delegation model, this means that we will only load a class fromurls
if it's not present in the parentbloopLoader
, but Bloop uses its own version of the scala library which is not the one we need to run the compiler.Our solution is to implement an URLClassLoader whose parent is
new ScalaInstanceTopLoader(bloopClassLoader, bootClassLoader)
. We overrideloadClass
to load thexsbti.*
interfaces from thebloopClassLoader
and the JDK classes from the bootClassLoader. - case class UniqueCompileInputs(sources: Vector[HashedSource], classpath: Vector[FileHash], options: Vector[String], scalaJars: Vector[String], originProjectPath: String) extends CacheHashCode with Product with Serializable
Value Members
- object BloopClassFileManager
- object BloopClasspathEntryLookup
- object BloopComponentsLock extends ComponentLock
- object CompileBackgroundTasks
- object CompileOutPaths extends Serializable
- object Compiler
- object CompilerCache
- object DependencyResolution
- object ExpressionCompilerCacheLock extends ComponentLock
- object JavaSignal
- object ScalaInstance
- object SemanticDBCacheLock extends ComponentLock
- object UniqueCompileInputs extends Serializable