mirror of https://github.com/sbt/sbt.git
In order to speed up the start up time of the test and run tasks, I'm introducing a ClassLoaderCache that can be used to avoid reloading the classes in the project dependencies (which includes the scala library). I made the api as minimal as possible so that we can iterate on the implementation without breaking binary compatibility. This feature will be gated on a feature flag, so I'm not concerned with the cache class loaders being useable in every user configuration. Over time, I hope that the CachedClassLoaders will be a drop in replacement for the existing one-off class loaders*. The LayeredClassLoader was adapted from the NativeCopyLoader. The main difference is that the NativeCopyLoader extracts named shared libraries into the task temp directory to ensure that the ephemeral libraries are deleted after each task run. This is a problem if we are caching the ClassLoader so for LayeredClassLoader I track the native libraries that are extracted by the loader and I delete them either when the loader is explicitly closed or in a shutdown hook. * This of course means that we both must layer the class loaders appropriately so that the project code is in a layer above the cached loaders and we must correctly invalidate the cache when the project, or its dependencies are updated. |
||
|---|---|---|
| .. | ||
| src | ||
| NOTICE | ||