Commit Graph

7545 Commits

Author SHA1 Message Date
eugene yokota fa84bd2bbc
Merge pull request #5159 from eatkins/1.3.x-scripted-parser-backport
[1.3.x] scripted parser backport
2019-10-07 21:01:39 +02:00
eugene yokota 95e3c5c335
Merge pull request #5160 from eatkins/1.3.x-safe-clean-backport
[1.3.x] clean race condition backport
2019-10-07 20:55:43 +02:00
eugene yokota 32c2ca87d4
Merge pull request #5161 from eatkins/1.3.x-classes-bak-backport
1.3.x classes bak backport
2019-10-07 20:54:30 +02:00
Eugene Yokota 735a960cda Fixes "Could not create directory ...classes.bak"
Fixes https://github.com/sbt/sbt/issues/1673

There's been report of intermittent "Could not create directory" error related to "classes.bak." retronym identified that all configurations are using the same directory, and that might be the cause of race condition.
This addresses the issue by assigning a unique directory for each configuration.
2019-10-07 09:52:14 -07:00
Jason Zaugg 56bb6705d1 Reproducer for the symptoms described in #1673 2019-10-07 09:52:08 -07:00
Ethan Atkins 80e8897dc4 Clean ivy resolution cache before regular clean
The way clean was implemented, it was running `clean`, `ivyModule` and
`streams` concurrently. This was problematic because clean could blow
away files needed by `ivyModule` and `streams`. To fix this, move the
cleanCachedResolutionCache into a separate task and run that before the
normal clean.

Should fix https://github.com/sbt/sbt/issues/5067.
2019-10-07 09:49:11 -07:00
Ethan Atkins 2dc6f2d2d5 Limit scripted page numbers
The completions were generating page numbers that didn't make sense if
there were a small number of scripted tests. For example, suppose that
there were only two tests defined, it would generate *1of3 *2of3 and
*3of3 completions even though there weren't even three tests.
2019-10-07 09:46:45 -07:00
Ethan Atkins 851aef1d00 Fix scripted parser crash
In a local progress, I was able to induce a crash in tab completions
because the group key did not exist in pairMap.
2019-10-07 09:46:41 -07:00
Ethan Atkins 40a8119b41
Merge pull request #5149 from eatkins/parallel-backport
[1.3.x] backport parallel classloaders
2019-10-03 12:53:44 -07:00
Ethan Atkins 114c092697 Revert "mark dependency-management/default-resolvers pending"
This reverts commit b47ed4e62a.
2019-10-03 12:09:49 -07:00
Ethan Atkins d03e043e91 Bump travis java 8 version 2019-10-03 11:23:04 -07:00
Ethan Atkins 0b3b8a366c 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-10-03 11:22:51 -07:00
Ethan Atkins 22982a7cfd 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-10-03 11:19:39 -07:00
eugene yokota f6991357f1
Merge pull request #5130 from eatkins/1.3.x-scalarun-classloader-close-backport
[1.3.x] Close classloader in ScalaRun.run
2019-09-24 21:04:33 -04:00
eugene yokota b6e1178f9b
Merge pull request #5129 from eatkins/1.3.x-progress-improvements-backport
[1.3.x] progress improvements backport
2019-09-24 18:36:59 -04:00
Ethan Atkins c9ca0ac03e 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 15:31:45 -07:00
Ethan Atkins 05372760c2 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 13:35:15 -07:00
Ethan Atkins 09c63e0804 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 13:35:08 -07:00
eugene yokota 3ba6fecc15
Merge pull request #5111 from eatkins/1.3.x-meta-build-backport
[1.3.x] meta build backport
2019-09-21 17:36:25 -04:00
Ethan Atkins bff3b354f6 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 12:26:57 -07:00
eugene yokota 3ca185fe30
Merge pull request #5106 from eed3si9n/wip/1.3.1
[1.3.x] clear banner + bump IO
2019-09-19 21:19:48 -04:00
Eugene Yokota 634a11ab4d io 1.3.1 2019-09-19 18:10:47 -04:00
Eugene Yokota 13a047dafe clear banner 2019-09-19 18:09:57 -04:00
eugene yokota 613e5b61cf
Merge pull request #5101 from eed3si9n/bport/meta_resolvers
[1.3.x] add includePluginResolvers
2019-09-19 14:25:42 -04:00
eugene yokota 581dad2505
Merge pull request #5103 from eed3si9n/bport/appveyor
[1.3.x] Drop Visual Studio 2015 testing
2019-09-19 13:43:45 -04:00
Eugene Yokota be9ff19a91 Drop Visual Studio 2015 testing 2019-09-19 13:41:36 -04:00
eugene yokota 52f0646c4f
Merge pull request #5100 from eatkins/1.3.x-stream-locks-backport
[1.3.x] stream locks backport
2019-09-19 13:37:56 -04:00
Eugene Yokota e40b53272f add includePluginResolvers
Fixes #5070

This adds a new setting called `includePluginResolvers` (default `false`).
When set to `true`, it the project will include resolvers from the metabuild.

This allows the build user to declare a resolver in one place (`project/plugins.sbt`) that gets applied to both the metabuild as well as all the subprojects. The scenario comes up when someone distributes a software on their own repo. Ref #4103
2019-09-19 13:13:43 -04:00
eugene yokota 43e8eced71
Merge pull request #5099 from eatkins/1.3.x-zombie-classloaders-backport
[1.3.x] zombie classloaders backport
2019-09-19 13:10:10 -04:00
Ethan Atkins 84f9148bce Add per file stream locks
We have seen failures in scripted to create the output file for streams
and it has also been reported in https://github.com/sbt/sbt/issues/5067.
I believe this may caused by the same stream output being initialized by
multiple tasks. To fix this, I add locking on a per-file basis. There
was (and is) additional synchronization on the Streams _instance_, but
the per-file locks are stored in the Streams companion object so the
locking should be honored no matter which Streams instance calls make.

I also skip the call to IO.touch if the file already exists. I believe
that this is the common case and since IO.touch was being called with
setModified = false, it should be fine to skip the touch when the file
exists.

Prior to this change, I was able to induce the issue in #5067 in roughly
1/50 of calls to `scripted actions/cross-multiproject`. I wasn't able to
reproduce after this change.
2019-09-19 08:43:03 -07:00
Ethan Atkins fb0888dada 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-19 08:38:59 -07:00
Ethan Atkins 8674e18981 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-19 08:38:50 -07:00
Ethan Atkins bc373d5f26 Add 1.3.0 to mima 2019-09-19 08:38:46 -07:00
eugene yokota 2d4cc650f5
Merge pull request #5090 from eatkins/1.3.x-build-sources-backport
[1.3.x] build sources backport
2019-09-17 14:08:13 -04:00
Ethan Atkins 4df049ed0c Monitor meta build sources
We want to recursively monitor the project meta build, but we also want
to avoid listing directories that don't exist. To compromise, I rework
the buildSourceFileInputs to add the nested project directories if they
exist. Because the fileInputs are a setting, this means that adding a
new project directory and *.sbt or *.scala will not immediately trigger
a rebuild, but in most common cases, it will. I added a scripted test
for this.
2019-09-17 09:38:58 -07:00
Ethan Atkins 6aa6fcede3 Monitor project build sources
In sbt 1.3.0, we only monitor build sources in the root project
directory and the root project meta build directory. This commit adds
these inputs for each project.

Fixes https://github.com/sbt/sbt/issues/5061.
2019-09-17 09:38:54 -07:00
Ethan Atkins 204351990c
Merge pull request #5087 from eatkins/1.3.x-supershell-blacklist
[1.3.x] Add consoleQuick and state to skipReportTasks
2019-09-16 18:40:06 -07:00
Ethan Atkins 577070c79f Improve formatting in Continuous 2019-09-15 11:44:11 -07:00
Ethan Atkins 041904f9b6 Skip state in task progress
In the `watch` input task, which is an alternative to `~`, with super
shell, there would be a solitary progress line for `state` in between
builds.
2019-09-15 11:44:11 -07:00
Ethan Atkins f8c40ea5b3 Add consoleQuick to skipReportTasks
This was an oversight that caused consoleQuick to not work with
supershell. We should probably try to figure out a way to allow custom
tasks to black list themselves from super shell reporting.
2019-09-15 11:42:03 -07:00
Ethan Atkins 8a161069dd
Merge pull request #5082 from eatkins/classloader-backport
[1.3.x] Classloader backport
2019-09-14 20:33:13 -07:00
Ethan Atkins 7c03c7f530 Manage classloader in BackgroundJobService
In https://github.com/sbt/sbt/issues/5075 we realized that sbt 1.3.0
introduces a regression where it closes the classloader used to invoke
the main method for in process run before all of its non-daemon threads
have terminated. To fix this and still close the classloader, I add a
method, runInBackgroundWithLoader that provides the background job
services with an optional classloader that it can close after the job
completes.

This cleanly merges and works with 1.3.x as well.
2019-09-14 18:53:03 -07:00
Ethan Atkins 8605fd5b9b Add scripted test for closing classloaders
https://github.com/sbt/sbt/issues/5075 reports that sbt 1.3.0 has a
regression for in process run. In sbt 1.3.0, we close the classloader
that invokes the main method before all of the daemon threads complete.
This adds a scripted test that fails due to this regression.
2019-09-14 18:53:03 -07:00
eugene yokota 28590b76ad
Merge pull request #5077 from eed3si9n/bport/2.12.10
[1.3.x] lm-coursier-shaded 2.0.0-RC3-4 + Scala 2.12.10
2019-09-13 11:44:37 -04:00
xuwei-k 58b0484d80 avoid deprecated /: and :\
use foldLeft and foldRight

https://github.com/scala/scala/blob/v2.13.0/src/library/scala/collection/IterableOnce.scala#L682-L686
2019-09-12 20:53:41 -04:00
Eugene Yokota 02f23b313b Scala 2.12.10 2019-09-12 19:00:37 -04:00
Eugene Yokota 087469c75f lm-coursier-shaded 2.0.0-RC3-4 2019-09-12 19:00:19 -04:00
eugene yokota 011be19445
Merge pull request #5064 from eed3si9n/bport/bugs
[1.3.x] backport some fixes
2019-09-10 11:00:02 -04:00
Ethan Atkins b88be07459 Update deprecation warnings for api changes
During refactoring, these warnings got out of date. I also added
scaladoc to the watchTriggeredMessage key.

Ref: https://github.com/sbt/sbt/issues/5051.
2019-09-10 09:28:38 -04:00
Dmitrii Naumenko 419486e4a5 remove duplicates from allJars when creating ScalaInstance #5052 (#5053)
Fixes #5052
2019-09-10 09:28:11 -04:00