sbt, the interactive build tool
Go to file
Ethan Atkins c77a26e832 Update clean task to use globs
The clean task is unreasonably slow because it does a lot of redundant
io. In this commit, I update clean to be implemented using globs. This
allows us to (optionally) route io through the file system cache. There
is a significant performance improvement to this change. Currently,
running clean on the sbt project takes O(6 seconds) on my machine. After
this change, it takes O(1 second).

To implement this, I added a new setting cleanKeepGlobs to replace
cleanKeepFiles. I don't think that cleanKeepFiles returning Seq[File] is
a big deal for performance because, by default, it just contains the
history file so there isn't much benefit to accessing a single file
through the cache. The reason I added the setting was more for
consistency and to help push people towards globs in their own task
implementations.

Part of the performance improvement comes from inverting the problem.
Before we would walk the file system tree from the base and recursively
delete leafs and nodes in a depth first traversal. Now we collect all of
the files that we are interested in deleting in advance. We then sort
the results lexically by path name and then perform the deletions in
that order. Because children will always comes first in this scheme,
this will generally allow us to delete a directory.

There is an edge case that if files are created in a subdirectory after
we've created the list to delete, but before the subdirectory is
deleted, then that subdirectory will not be deleted. In general, this
will tend to impact target/streams because writes occur to
target/streams during traversal. I don't think this really matters for
most users. If the target directory is being concurrently modified with
clean, then the user is doing something wrong.

To ensure legacy compatibility, I re-implement cleanKeepFiles to return
no files. Any plugin that was appending files to the cleanKeepFiles task
with `+=` or `++=` will continue working as before because I explicitly
add those files to the list to delete. I updated the actions/clean-keep
scripted test to use both cleanKeepFiles and cleanKeepGlobs to ensure
both tasks are correctly used.

Bonus: add debug logging of all deleted files
2019-03-22 07:53:41 -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 dsl for collecting globs 2019-03-22 07:53:41 -07:00
internal Unseal Parser 2019-03-15 11:11:25 -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 Update clean task to use globs 2019-03-22 07:53:41 -07:00
main-actions/src Avoid NPE on Run.<init> 2019-02-22 10:26:10 +10:00
main-command/src Add dsl for collecting globs 2019-03-22 07:53:41 -07:00
main-settings/src Add dsl for collecting globs 2019-03-22 07:53:41 -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 Stop using ---/pair in SbtLauncherPlugin 2019-03-22 07:53:41 -07:00
protocol/src/main [sbt-server] LSP completions support 2018-10-11 13:34:40 +01:00
run Use layered ClassLoaders in run and test tasks 2019-01-30 08:55:22 -08:00
sbt/src Update clean task to use globs 2019-03-22 07:53:41 -07: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 Allow sbt scripted tests to run in parallel 2019-01-31 17:43:14 -08:00
src/main/conscript 1.2.0 2018-07-30 00:56:36 -04:00
tasks open up ExecuteProgress, and adds a few keys 2019-03-19 00:42:46 -04:00
tasks-standard Lint Transform.scala 2019-01-31 10:53:07 -08:00
testing Rename some layering related fields/classes 2019-01-30 08:55:22 -08:00
vscode-sbt-scala Bump node modules for security fixes 2019-02-22 10:51:54 -05:00
.appveyor.yml improve Windows build 2018-02-07 18:16:21 -05: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 Improve code clarity with danglingParentheses = true 2018-04-24 16:09:49 +01:00
.travis.yml Add scripted tests for classloader-cache 2019-01-30 08:55:22 -08: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 update README. s/1.0.x/1.x/ 2018-02-13 10:00:50 +09:00
SUPPORT.md Split support into SUPPORT.md 2018-04-25 14:55:09 +01:00
build.sbt use tag when available 2019-03-22 02:28:14 -04: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

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.