I’m writing a plugin for grade and something got me thinking:
Can we assume that configuration phase is run from single thread and therefore there is no need to use synchronization.
I’m aware that the run phase is definitely multi-threaded. It seems reasonable that configuration is performed by single thread,. If thread safety is not guaranteed then why is that exactly ?
Yes. This isn’t really a properly documented guarantee, but there is loads of code out there that works under the presumption that configuration happens single-threaded that this would be an enormous breaking change. So yeah, you can safely assume that configuration doesn’t need to be guarded against concurrent execution. The one exception to this is composite builds, in which some configuration of included builds can happen in parallel. That’s a unique situation, and most folks don’t need to deal with cross-build configuration logic in that case anyhow.