sbt, the interactive build tool
Go to file
Ethan Atkins 03bf539ce9 Add new ClassLoaderCache implementation
This commit adds a new ClassLoaderCache that builds on the
ClassLoaderCache that is present in zinc (and can be used to build an
instance of the zinc ClassLoaderCache to preserve compatibility). It
differs from the zinc classloader cache that it does not use direct
SoftReferences to classloaders. Instead, we create a wrapper loader
that can't load any classes and just delegates to its parent. This
allows us to add a thread that reaps the soft reference to the wrapper
loader. Crucially, we add a custom SoftReference class that has a strong
reference to the underlying classloader. This allows us to call close on
the strong reference.

The one issue with this approach is that we can't
rescue the jvm from crashing with an OOM: metaspace because the jvm
doesn't give us a chance to close and dereference the underlying
classloaders before it crashes. It WILL collect classloaders under
normal memory pressure, just not metaspace pressure. To fix this, I
check if the MaxMetaspaceSize is set via an MxBean and, if it is, we
fill the cache with regular soft references. We are going to change the
bash script to not set -XX:MaxMetaspaceSize by default so most builds
should probably end up correctly closing the classloaders after this
change. But we should break existing builds that set MaxMetaspaceSize
but don't crash.

As part of this commit, I audited all of the places where we were
instantiating ClassLoaderCache instances and instead pass in the
state's ClassLoaderCache instance. This reduces the total number of
classloaders created.
2019-05-28 09:53:35 -07:00
.github Fix CONTRIBUTING and link to it 2018-09-04 23:25:42 -04:00
core-macros/src/main/scala/sbt/internal/util/appmacro Add support for managed task inputs 2019-05-02 14:33:29 -07:00
internal Add support for managed task inputs 2019-05-02 14:33:29 -07:00
launch Adds sbt.boot.lock sysprop to opt-out 2018-02-08 13:02:39 +00:00
licenses move remaining pieces of sbt subproject to sbt_pending and fix notices 2010-09-21 21:55:50 -04:00
main Add new ClassLoaderCache implementation 2019-05-28 09:53:35 -07:00
main-actions/src Bump io 2019-05-02 14:33:01 -07:00
main-command/src Add new ClassLoaderCache implementation 2019-05-28 09:53:35 -07:00
main-settings/src Allow calling TaskKey.previous in input tasks 2019-04-25 15:58:01 -07:00
notes Implement sequential[B](tasks: Seq[Initialize[Task[B]]]) and remove useless comment outs 2018-09-19 20:54:18 -04:00
project Reduce concurrency of scalafmtCheck 2019-05-17 14:51:07 -04:00
protocol/src/main apply formatting 2019-04-20 03:23:54 -04:00
run Properly close a number of classloaders 2019-05-02 14:38:33 -07:00
sbt/src Reproduce Twirl regression 2019-05-25 14:10:14 -04:00
scripted-plugin/src/main/scala/sbt -Xfatal-warnings in most subprojects 2018-09-18 11:47:55 -04:00
scripted-sbt-old/src/main/scala/sbt/test Update header 2018-09-14 04:53:36 -04:00
scripted-sbt-redux Fix ScalaTest issue with ScalaLibrary classloader 2019-05-17 14:24:55 -04:00
src/main/conscript 1.2.0 2018-07-30 00:56:36 -04:00
tasks apply formatting 2019-04-20 03:23:54 -04:00
tasks-standard apply formatting 2019-04-20 03:23:54 -04:00
testing Catch NoClassDefFoundErrors in tests 2019-05-28 09:53:35 -07:00
vscode-sbt-scala Bump node modules for security fixes 2019-02-22 10:51:54 -05:00
zinc-lm-integration/src Add new ClassLoaderCache implementation 2019-05-28 09:53:35 -07:00
.appveyor.yml Run more scripted tests on windows 2019-05-11 22:01:49 -07:00
.gitattributes remove gittatributes, assume core.autocrlf=false 2018-06-26 17:38:05 +03:00
.gitignore adding a fatjar release (aka sbt-big) to the build 2018-11-07 08:37:49 +00:00
.java-version Configure JVM 1.8 in .java-version 2016-10-07 08:48:23 -05:00
.sbtopts Use .sbtopts to increase the RAM 2018-06-25 19:40:15 -04:00
.scalafmt.conf workaround Scalafmt regex 2019-04-20 14:18:10 -04:00
.travis.yml always reresolve sbt artifacts when using Coursier 2019-04-27 14:31:13 -04:00
CONTRIBUTING.md fix branch name in CONTRIBUTING 2018-09-10 16:18:40 +02:00
LICENSE Apache License 2.0 2018-09-14 03:38:58 -04:00
NOTICE Apache License 2.0 2018-09-14 03:38:58 -04:00
PROFILING.md fix typo 2018-07-08 22:18:57 +09:00
README.md Add Travis build status badge and latest version badge #4621 2019-04-19 06:36:46 -07:00
SUPPORT.md Split support into SUPPORT.md 2018-04-25 14:55:09 +01:00
build.sbt Add scripted watchTriggers 2019-05-28 09:53:35 -07:00
reset.sh 1.0.3-SNAPSHOT 2017-09-16 15:52:58 -04:00
sbt-allsources.sh Bump underlying modules to latest 2017-03-23 12:41:24 -04:00
server.md setting query is "sbt/setting" 2017-10-03 01:45:06 -04:00

README.md

Build Status Latest version Gitter Chat

sbt

sbt is a build tool for Scala, Java, and more.

For general documentation, see http://www.scala-sbt.org/.

sbt 1.x

This is the 1.x series of sbt. The source code of sbt is split across several Github repositories, including this one.

  • sbt/io hosts sbt.io module.
  • sbt/util hosts a collection of internally used modules.
  • sbt/librarymanagement hosts sbt.librarymanagement module that wraps Ivy.
  • sbt/zinc hosts Zinc, an incremental compiler for Scala.
  • sbt/sbt, this repository hosts modules that implements the build tool.
  • Setup: Describes getting started with the latest binary release.
  • FAQ: Explains how to get help and more.
  • sbt/sbt-zero-seven: hosts sbt 0.7.7 and earlier versions

Issues and Pull Requests

Please read CONTRIBUTING carefully before opening a GitHub Issue.

The short version: try searching or asking on StackOverflow.

license

See LICENSE.