Commit Graph

11969 Commits

Author SHA1 Message Date
Ethan Atkins a12bccf4a3 Use java to implement XMain classloaders
These classloaders which are created if sbt is launched with a legacy
launcher (or one that doesn't follow the current classloading hierarchy
convention), were implemented in scala, but that meant that they were
not parallel capable. I fix that by moving the implementations to java.
I also move the static method that creates a MetaBuildLoader into the
java class.
2019-09-27 13:23:42 -07:00
Ethan Atkins 8fd10bfb5f Make all test and run classloaders parallel capable
A number of users were reporting issues with deadlocking when using
1.3.2: https://github.com/sbt/sbt/issues/5116. This seems to be because
most of the sbt created classloaders were not actually parallel capable.
In order for a classloader to be registered as a parallel capable, ALL
of the parent classes except for object in the class hierarchy must be
registered as a parallel capable:
https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#registerAsParallelCapable--.
If a classloader is not registered as parallel capable, then a global
lock will be used internally for classloading and this can lead to deadlock.

It is impossible to register a scala 2 classloader as parallel capable
so I ported all of the classloaders to java.

This commit updates the java-serialization scripted test. Prior to the
port, the new version of the test would more or less always deadlock.
After this change, I haven't been able to reproduce a deadlock.

This had no significant performance impact when I reran
https://github.com/eatkins/scala-build-watch-performance
2019-09-27 13:23:42 -07:00
Eugene Yokota 563bcb93aa Throw error if you run sbt from /
Fixes #1458

Running sbt from `/` results to sbt getting stuck trying to load the directories recursively, and eventually erroring with a java.lang.OutOfMemoryError (after freezing for a long time) even on an Alpine container.

To prevent it, this adds a check to see if the absolute path is `/` or not.

```
/ $ sbt -Dsbt.version=1.4.0-SNAPSHOT
[error] java.lang.IllegalStateException: cannot run sbt from root directory without -Dsbt.rootdir=true; see sbt/sbt#1458
[error] Use 'last' for the full log.
```
2019-09-26 17:11:29 -04:00
eugene yokota 198dab9f39
Update DEVELOPING about nightlies (#5133)
Fixes https://github.com/sbt/sbt/issues/4489
2019-09-25 23:19:58 -04:00
Ignasi Marimon-Clos 7a87a9e02e Indicate `r`etry is the option applied if users just press RETURN (#4748)
The message:

```
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
```

is not explicit about retry being the option used when pressing return.
2019-09-25 21:33:19 -04:00
eugene yokota 23e0f6ebee
Merge pull request #291 from eed3si9n/wip/v
--verbose mode for Windows
2019-09-25 11:20:21 -04:00
eugene yokota dba0e5c82f
Merge pull request #290 from eed3si9n/wip/quote2
Fix equal sign handling for -D
2019-09-25 11:18:05 -04:00
Eugene Yokota 8caa28b57b --verbose mode for Windows 2019-09-25 07:45:16 +01:00
Eugene Yokota 98efb989db Fix equal sign handling for -D
Fixes sbt/sbt#2695
By the time the arguments are passed to a batch script,
it seems like  is parsed away.
for /F did not work since it would not handle double quoted
paths that include whitespaces.
This adds special handling for -D parameters only.
2019-09-25 06:57:07 +01:00
eugene yokota 9fc62e5ef5
Merge pull request #288 from er1c/versions
Add --numeric-version, --script-version, and update --version to print both versions
2019-09-24 21:03:35 -04:00
eugene yokota 0c9ac98b08
Merge pull request #225 from eatkins/divide-by-zero
Divide by zero
2019-09-24 20:54:20 -04:00
Eric Peters 56cdfcaa90 Add --numeric-version, --script-version, and update --version to print both versions 2019-09-24 16:55:57 -07:00
Ethan Atkins 9c2dd05b6a Avoid possible divide by zero
On the off chance that in some configurations the terminal width is set
to zero, avoid an exception by returning 0 for terminal lines. It is
likely that supershell will not work well if terminal width is zero, but
that's better than a potential crash (I think the crash would be in the
progress background thread, so I'm not sure how bad it would be, but
still its good to avoid).
2019-09-24 16:35:03 -07:00
Ethan Atkins 5cfab4c9a9 Cleanup implementation of progress report
It was a bit cleaner to consolidate `extra` and
(previousLines|info).length into prevLength and currentLength.
2019-09-24 16:33:42 -07:00
Ethan Atkins 0e69402660
Merge pull request #5126 from eatkins/fg-run
Close classloader in fgRun/fgRunMain
2019-09-24 15:26:49 -07:00
Ethan Atkins 3a27c7c37d
Merge branch 'develop' into fg-run 2019-09-24 13:50:56 -07:00
Ethan Atkins aac37b4346
Merge pull request #5125 from eatkins/progress-improvements
Progress improvements
2019-09-24 13:34:28 -07:00
Ethan Atkins cfa29bafe7 Close classloader in ScalaRun.run
It is necessary to close the run classloader in order to reuse the
dependency layer in the next run. If the loader needs to survive past
the main method, as is the case with `run` and `runMain`, then the
runWithLoader api should be used instead.

This mostly restores the behavior of classloader closing to 1.3.0 for
the tasks that use ScalaRun except for `run` and `runMain`. But unlike
1.3.0, if the classloader is closed it can still spawn a zombie
classloader.

Fixes #5124.
2019-09-24 12:22:03 -07:00
Ethan Atkins 0b18ccebbd
Merge pull request #223 from eatkins/terminal-width
Take terminal width into account in supershell
2019-09-24 12:03:36 -07:00
Ethan Atkins edd21b0ec8 Filter out dummy tasks from progress
I don't think that dummy tasks really make sense for task progress
because they are evaluated outside of the normal task evaluation. This
came up because I was seeing streams-manager in supershell which didn't
seem useful.
2019-09-24 11:56:42 -07:00
Ethan Atkins f0bec6d9e3 Limit TaskProgress threads
I noticed some flickering in super shell progress lines and realized
that it was because there were multiple progress threads running
concurrently. This is problematic because each thread has a completely
different state so if each thread has an active task, the display will
flicker between the two tasks. I think this is caused primarily by
dynamic tasks. At least the example where I was seeing it was caused by
a dynamic task.
2019-09-24 11:56:40 -07:00
eugene yokota b248d5da60
Merge pull request #289 from jsoref/to_be_replaced
Fix _to_be_replaced
2019-09-24 14:50:38 -04:00
Ethan Atkins 7597cdb19b Take terminal width into account in supershell
Sometimes if the progress lines are wider than the terminal width,
the supershell blank zone can expand indefinitely because be do not move
the cursor far enough up to properly re-fill the blank zone.
2019-09-24 10:59:53 -07:00
Josh Soref f06e7e638e
Set posix +x
Co-Authored-By: Eric Peters <eric@peters.org>
2019-09-24 12:31:18 -04:00
Josh Soref 07814bc576 Fix _to_be_replaced 2019-09-23 18:08:29 -04:00
eugene yokota 7a51eda367
Merge pull request #286 from er1c/man
Update sbt.1 man page options
2019-09-23 12:37:02 -04:00
Eric Peters 7e17407cba Update sbt.1 man page options 2019-09-23 08:30:51 -07:00
eugene yokota ccecf1e412
Merge pull request #5096 from eatkins/background-classloading
Preload a number of classes in the background
2019-09-22 23:58:28 -04:00
eugene yokota e0f7a421b7
Merge pull request #284 from eed3si9n/wip/ci
Remove Travis CI customization
2019-09-22 19:20:03 -04:00
Eugene Yokota 4dc6bb788e check that Linux output doesn't contain any junk 2019-09-22 19:04:03 -04:00
Eugene Yokota 0a09fa62ed SBT_ETC_FILE
Travis CI adds `/etc/sbt/sbtopts` that prevents us from testing the out-of-box behavior. This allows us to override the location.
2019-09-22 18:07:28 -04:00
Eugene Yokota 7636a47c94 Ignore upload cookies 2019-09-22 15:50:31 -04:00
Eugene Yokota 261ddc3c38 Remove appveyor setting 2019-09-22 15:50:18 -04:00
Ethan Atkins d53eabf9a6
Merge pull request #5109 from eatkins/meta-build-sources
Fix checkbuild sources for projects with meta-meta-build
2019-09-21 12:25:59 -07:00
Ethan Atkins bb0fd5c84c Fix checkbuild sources for projects with meta-meta-build
If a project had a meta-meta build (project/project), the build sources
in the project directory were ignored. This was because the projectGlobs
method did not correctly handle recursion. It inadvertently
discarded the accumulator globs and only returned the most recently
generated globs. This commit fixes that and adds a regression test to
the nio/reload scripted test.
2019-09-21 10:44:00 -07:00
eugene yokota 95813bd819
Merge pull request #283 from eed3si9n/wip/vfix
Fix -v getting on all the time
2019-09-20 12:49:00 -04:00
Eugene Yokota 989136debf Fix -v getting on all the time
Fixes https://github.com/sbt/sbt/issues/5108

I messed up in 91b71b39d3 by initializing the variable to 0.
2019-09-20 10:36:16 -04:00
eugene yokota 577cdb856d
Merge pull request #282 from eed3si9n/wip/gc
Drop -XX:+UseParallelGC
2019-09-19 16:15:11 -04:00
Ethan Atkins b03580fd81
Merge branch 'develop' into background-classloading 2019-09-19 12:00:39 -07:00
eugene yokota d07c2b4520
Merge pull request #5102 from eed3si9n/wip/appveyor
Drop Visual Studio 2015 testing
2019-09-19 13:39:39 -04:00
Eugene Yokota ee0310f7d3 Drop Visual Studio 2015 testing 2019-09-19 13:37:11 -04:00
Ethan Atkins d966c40917 Preload a number of classes in the background
I was looking into sbt start up time and in profiling was able to
identify a number of classloading bottlenecks. To speed up
initialization, we can preload those classes in the background. I saw
average speedups of roughly .75 seconds after this change. Also, the `time`
command would consistently report cpu system time very close to 400% and
I have 4 cores on my laptop. With 1.3.0 it would be more like 350%.
2019-09-19 09:41:50 -07:00
eugene yokota 29ea7ee6fc
Merge pull request #5094 from eed3si9n/wip/meta_resolvers
add includePluginResolvers
2019-09-19 12:41:20 -04:00
Ethan Atkins 39c1349164
Merge pull request #5083 from eatkins/zombie-classloaders
Allow classloaders to be used after close
2019-09-19 08:38:03 -07:00
Ethan Atkins c2dc22f7dc Make allowZombieClassLoaders public
For forward binary compatibility in the 1.3.x series, this key needed to
be private[sbt], but we can make it public in 1.4.x.
2019-09-18 19:27:27 -07:00
Ethan Atkins 231d7966d0 Add the ability to resurrect closed classloaders
There have been a number of complaints about the new classloader closing
behavior. It is too aggressive about closing classloaders after test and
run. This commit softens the behavior by allowing a classloader to be
resurrected after close by creating a new zombie classloader that has
the same urls as the original classloader. After this commit, we always
close the classloaders when we are done, but they can still leak
file descriptors if a zombie is created.

To configure the behavior, I add the allowZombieClassLoaders key. If it
is false (which is default), we will warn but still allow them. If it
is true, then we silence the warning. In a later version of sbt, we can
change the semantics to be strict.

I verified after this change that I could add a shutdown hook in `run`
and it would be evaluated so long as I set `bgCopyClasspath := false`.
Otherwise the needed jars were deleted before the hooks could run.

Bonus: delete unused ResourceLoaderImpl class
2019-09-18 19:26:11 -07:00
eugene yokota 6fc614bb46
Merge pull request #222 from eatkins/sbt-bump
Bump sbt version to 1.3.0
2019-09-18 22:14:49 -04:00
eugene yokota 3f20cc1583
Merge pull request #221 from eatkins/lazy-success-event-tag
Load SuccessEventTag lazily
2019-09-18 22:14:28 -04:00
Ethan Atkins 46eaa564d5 Add 1.3.0 to mima 2019-09-18 19:12:48 -07:00
Ethan Atkins 9c445896cf Bump sbt version to 1.3.0 2019-09-18 15:34:30 -07:00