Does the scala compiler have some inherent lock?

Gradle 6.1, sbt/zinc compiler 1.3.1
In our multi-module projects, there are some modules that use scala. These projects severely increase compilation times, even beyond what you typically expect from scala.

It feels like even if different projects compileScala or testCompileScala, they are actually not executing in parallel at all.

For example, looking at the following build scan , we can see that flink-mesos took >1m to compile. If I build this module separately, it takes 12s . That’s hardly explainable by the few parallel tasks in the first instance.

Instead it seems as if flink-mesos actually only started to compile for real after flink-streaming-scala finished. Even more specifically, the analysis phase might run in parallel, but the actual compilation does not.

My questions: is there some inherent lock in the zinc compiler? If so, is there any way around it (tried with and without forking, but same results)? Or could we at least model it through build services such these blocked tasks take a task slot?

I found a lock in ZincScalaCompilerFactory that is needed to create the bridge jar, but afaik, it should only block processing once and then pass through quickly.