Commit Graph

7302 Commits

Author SHA1 Message Date
eugene yokota 8413e259e1
Merge pull request #4838 from eatkins/multi-cleanup
Multi cleanup
2019-07-08 07:06:31 -04:00
eugene yokota fd87c34cde
Merge pull request #4836 from eed3si9n/wip/runarg
quote run argument if it contains a whitespace
2019-07-08 07:06:08 -04:00
eugene yokota 0a54d8facc
Merge pull request #4845 from eed3si9n/wip/bumpcoursier
lm-coursier-shaded 2.0.0-RC2-1
2019-07-06 00:36:24 +09:00
Eugene Yokota 83d35c8ed0 lm-coursier-shaded 2.0.0-RC2-1
Fixes #4823
2019-07-04 23:13:46 +09:00
Ethan Atkins 4e2c1858f2 Don't append empty comp.append
In some cases, comp.append could be an empty string. This would happen
if a parser was something like `(token(foo) <~ ;).+ <~ fo.?` because there were
no completions for the `fo` available anchor. The effect of this was
that tab would never complete foo;f to foo;foo, even though that was the
only possible completion. It would, _display_, foo as a possible
completion though.

This came up because the multi parser has a similar parser to that
described above and it broke tab completion to the right of a semi
colon.
2019-06-25 13:45:09 -07:00
Ethan Atkins 60b1ac7ac4 Improve multi parser performance
The multi parser had very poor performance if there were many commands.
Evaluating the expansion of something like "compile;" * 30 could cause
sbt to hang indefinitely. I believe this was due to excessive
backtracking due to the optional `(parser <~ semi.?).?` part of the
parser in the non-leading semicolon case.

I also reworked the implementation so that the multi command now has a
name. This allows us to partition the commands into multi and non-multi
commands more easily in State while still having multi in the command
list. With this change, builds and plugins can exclude the multi parser
if they wish.

Using the partitioned parsers, I removed the high/priority low priority
distinction. Instead, I made it so that the multi command will actually
check if the first command is a named command, like '~'. If it is, it
will pass the raw command argument with the named command stripped out
into the parser for the named command. If that is parseable, then we
directly apply the effect. Otherwise we prefix each multi command to the
state.
2019-06-25 13:45:09 -07:00
Eugene Yokota f0f55c38a5 quote run argument if it contains a whitespace
Fixes #4834
2019-06-24 19:32:55 -04:00
eugene yokota 9cc8913131
Merge pull request #4829 from eed3si9n/wip/crossplugin
add back typesafe-ivy-releases resolver
2019-06-23 20:44:59 -04:00
Eugene Yokota 29d3894b27 add back typesafe-ivy-releases resolver
Fixes #4698
Fixes #4827
2019-06-22 09:45:15 -04:00
eugene yokota eb877757ba
Merge pull request #4811 from eatkins/strict-multi-parser
Strict multi parser
2019-06-21 16:19:24 -04:00
eugene yokota ca8381e057
Merge pull request #4814 from eatkins/session-save
Clear meta build state on session save
2019-06-20 00:08:35 -04:00
eugene yokota 6fec4d350f
Merge pull request #4781 from eatkins/improve-reload-warnings
Improve reload warnings
2019-06-19 19:22:06 -04:00
Ethan Atkins 494755f0f7 Clear meta build state on session save
The `session save` command has the side effect of modifying a "*.sbt"
file so we don't want to warn about changes or automatically reload when
we return to the shell. Setting the hasCheckedMetaBuild attribute key to
false is sufficient to prevent this.

Ref: https://github.com/sbt/sbt/issues/4813
2019-06-19 16:15:00 -07:00
Ethan Atkins 30a16d1e10 Update Continuous to directly use multi parser
It didn't really make sense for Continuous to use the other command
parser and then reparse the results. I was able to slightly simplify
things by using the multi parser directly.
2019-06-19 16:12:45 -07:00
Ethan Atkins ff16d76ad3 Remove matchers from MultiParserSpec
We've been trying to move away from the wordy dsl and stick with bare
assertions.
2019-06-19 16:12:45 -07:00
Ethan Atkins 4c814752fb Support braces in multi command parser
We run into issues if we naively split the command input on ';' and
treat each part as a separate command unless the ';' is inside of a
string because it is also valid to have ';'s inside of braced
expressions, e.g. `set foo := { val x = 1; x + 1 }`. There was no parser
for expressions enclosed in braces. I add one that should parse any
expression wrapped in braces so long as each opening brace is matched by a
closing brace. The parser returns the original expression. This allows
the multi parser to ignore ';' inside of '{...}'.

I had to rework the scripted tests to individually run 'reload' and
'setUpScripted' because the new parser rejects setUpScripted because it
isn't a valid command until reload has run.
2019-06-19 16:12:45 -07:00
Ethan Atkins ccfc3d7bc7 Validate commands in multiparser
It was reported in https://github.com/sbt/sbt/issues/4808 that compared
to 1.2.8, sbt 1.3.0-RC2 will truncate the command args of an input task
that contains semicolons. This is actually intentional, but not
completely robust. For sbt >= 1.3.0, we are making ';' syntactically
meaningful. This means that it always represents a command separator
_unless_ it is inside of a quoted string. To enforce this, the multi parser
will effectively split the input on ';', it will then validate that each
command that it extracted is valid. If not, it throws an exception. If
the input is not a multi command, then parsing fails with a normal
failure.

I removed the multi command from the state's defined commands and reworked
State.combinedParser to explicitly first try multi parsing and fall back
to the regular combined parser if it is a regular command. If the multi
parser throws an uncaught exception, parsing fails even if the regular
parser could have successfully parsed the command. The reason is so that
we do not ever allow the user to evaluate, say 'run a;b'. Otherwise the
behavior would be inconsitent when the user runs 'compile; run a;b'
2019-06-19 16:12:45 -07:00
Ethan Atkins 2fe26403e7 Add test for using switch version in multi command
I noticed that in 1.3.0-RC2, the following commands worked:
  ++2.11.12 ;test
  ;++2.11.12;test
but
  ++2.11.12; test
did not. This issue is fixed in the next commit.
2019-06-19 16:12:45 -07:00
eugene yokota b0bfa63911
Merge pull request #4821 from eed3si9n/wip/source
Fix updateClassifiers
2019-06-19 17:39:35 -04:00
Eugene Yokota 7b10b372f8 Fix updateClassifiers
Fixes #4816

Copied sbt-lm-coursier hacks from 9173406bb3/modules/sbt-lm-coursier/src/main/scala/sbt/hack/Foo.scala.
2019-06-19 12:20:26 -04:00
eugene yokota 57a86e60f6
Merge pull request #4806 from eatkins/incomplete-hash
Don't use Set[Incomplete]
2019-06-14 09:10:39 +02:00
Ethan Atkins 968e83380a Don't use Set[Incomplete]
It's very expensive to compute the hash code of a deeply nested
Incomplete. To prevent a loop, we only want to check for object equality
which we can do with IdentityHashMap
2019-06-13 18:12:54 -07:00
eugene yokota cf9a5f283f
Merge pull request #4805 from eatkins/watch-start-message
Use project watchStartMessage for multi commands
2019-06-14 01:08:38 +02:00
eugene yokota 4badceb159
Merge pull request #4804 from eatkins/missing-case
Add missing match case
2019-06-14 01:06:39 +02:00
eugene yokota 93fbe03c4c
Merge pull request #4803 from eatkins/dependency-layer-thread-safety
Make dependency layer threadsafe
2019-06-14 01:05:56 +02:00
Ethan Atkins 875a25c929 Use project watchStartMessage for multi commands
It didn't make sense to aggregate the watch start command if it was
defined in multiple sources so we previously just fell back to the
default message if multiple commands were being run. This, however,
meant that if you ran, say, ~compile in an aggregate project, it wasn't
possible to customize the start message. There was a message in the
sbt gitter channel where someone found the new message too verbose and
wanted to print something shorter and I realized that this was an
unfortunate restriction. Instead of giving up, we can just use the
project's watchStartMessage as a default. If the watchStartMessage
setting is unset for some reason, we can fall back to the default.

I validated this change manually in the swoval project, which has an
aggregate root project, by running
set ThisBuild / watchStartMessage := { (_, _, _) => None }
and indeed nothing was printed after each task evaluation in '~compile'.
2019-06-11 16:24:22 -07:00
Ethan Atkins 27fc4e57e3 Add missing match case
There was an incomplete pattern match that assumed that the jars in the
scala provider included one with the name  "scala-library.jar". In
practice, I think this is always true, but it's safer to have a fallback
case and it also removes the compiler warning.
2019-06-11 15:52:23 -07:00
Ethan Atkins 9c821b7b13 Make dependency layer threadsafe
We discovered that turbo mode did not work in the sbt settings project.
I tracked this down to the dependency classloader bundle not being
thread safe.
2019-06-11 15:52:02 -07:00
eugene yokota bf03d24f6d
Merge pull request #4797 from eed3si9n/wip/mailmap
Add mailmap
2019-06-11 09:35:41 +02:00
Eugene Yokota ee3fed5bca Add mailmap 2019-06-11 09:30:14 +02:00
eugene yokota 4d0c5a5410
Merge pull request #4793 from eed3si9n/wip/rc2
use 1.3.0-RC2
2019-06-10 21:22:38 +02:00
Eugene Yokota 44451b9a24 sbt 1.3.0-RC2 2019-06-10 17:36:01 +02:00
eugene yokota e67d86f641
Merge pull request #4792 from eatkins/dont-print-stacktrace
Remove err.printStackTrace in MainLoop
2019-06-10 01:13:13 +02:00
Ethan Atkins 54d79e664d Remove err.printStackTrace in MainLoop
I added this for debugging and did not mean to leave it in. It causes
massive walls of text to be printed sometimes when compilation fails.
2019-06-09 15:59:08 -07:00
eugene yokota d05e7e0613
Merge pull request #4790 from eed3si9n/wip/bumpzinc
Zinc 1.3.0-M7
2019-06-10 00:54:12 +02:00
Eugene Yokota f697e3a907 Zinc 1.3.0-M7 2019-06-09 23:04:32 +02:00
eugene yokota 94d5eca166
Merge pull request #4786 from eatkins/close-classloaders
Close classloaders
2019-06-09 02:52:22 +02:00
Ethan Atkins a38d2669e1 Add system property for closing classloaders
I realized that some builds may crash if we automatically close the
classloaders. While I do think that is a good thing in general that we
are closing the loaders by default, we shuold have an option for
supressing this behavior.

I made all of the custom classloaders that we define for test and run
check this property before calling the super.close method.
2019-06-08 17:07:39 -07:00
Ethan Atkins a6bc7b1c76 Fix typo 2019-06-08 17:06:34 -07:00
eugene yokota 10ca452bd8
Merge pull request #4785 from eatkins/welcome-banner
Welcome banner
2019-06-09 00:57:54 +02:00
Ethan Atkins 5e0b9a0c2f Add welcome banner to sbt shell
We want to notify users about the new features available in sbt 1.3.0 to
increase visibility. Turbo mode especially can benefit many builds, but
we have opted to leave it off by default for now.

The banner will be displayed the first time sbt enters the shell command
on each sbt run. The banner can be disabled globally with the sbt.banner
system property. It can be displayed on a per sbt version by running the
skipWelcomeBanner command. That command touches a file in the ~/.sbt/1.0
directory to make it persistent across all projects.
2019-06-08 14:09:39 -07:00
Ethan Atkins cd0461e301 Improve reload warnings
I decided creations/deletions/updates were a bit too technical rather
than descriptive. It also wasn't really correct to say Meta build
sources because the meta build is the build for the build. Instead, I
dropped Meta from the sentence. I also made the instructions when
changed sources are detected more active. I left them capitalized since
they are instructions rather than warnings.

Apply these changes by running `reload`.
Automatically reload the build when source changes are detected by setting `Global / onChangedBuildSource := ReloadOnSourceChanges`.
Disable this warning by setting `Global / onChangedBuildSource := IgnoreSourceChanges`.

Also indentation was wrong for the printed files when multiple files had
changed because the mkString middle argument was "  \n" rather than "\n  ".
2019-06-08 13:55:19 -07:00
eugene yokota 47cd001eea
Merge pull request #4783 from eed3si9n/wip/layeringstrategy
turbo mode
2019-06-08 22:32:48 +02:00
Eugene Yokota 6878fb6cdb turbo mode
This creates a performance mode that enables experimental or advanced features that might require some debugging by the build user when it doesn't work.

Initially we are putting the layered ClassLoader (`ClassLoaderLayeringStrategy.AllLibraryJars`) behind this flag.
2019-06-08 21:37:50 +02:00
Eugene Yokota 006722f81c centralize system properties 2019-06-08 19:53:59 +02:00
eugene yokota 299bdcd372
Merge pull request #4784 from eatkins/fix-scala-instance-test
Wait for akka termination in test
2019-06-08 19:52:30 +02:00
Ethan Atkins ef5a595472 Wait for akka termination in test
We now correctly close the test classloader which can cause this
scripted test to fail if the classloader is closed before the actor
system finishes terminating.
2019-06-08 10:16:47 -07:00
eugene yokota fd0f078c73
Merge pull request #4780 from eatkins/java-reflection-v2
Java reflection v2
2019-06-07 07:53:14 +02:00
eugene yokota efa26d6eb5
Merge pull request #4782 from eatkins/reuse-sbt-classpath
Re-use metabuild scala instance layer
2019-06-07 07:16:12 +02:00
Ethan Atkins f1698d2bf2 Re-use metabuild scala instance layer
At some point I noticed that projects with no scala sources in the build
loaded significantly faster than projects that had even a single scala
file -- no matter how simple that file was. This didn't really make
sense to me because *.sbt files _do_ have to be compiled. I finally
realized that classloading was a likely bottle neck because *.sbt
files are compiled on the sbt classpath while *.scala files are compiled
with a different classloader generated by the classloader cache. It then
occurred to me that we could pre-fill the classloader cache with the
scala layer of the sbt metabuild classloader.

I found that compared to 1.3.0-M5, a project with a simple scala file in
the project directory loaded about 2 seconds faster after this change.
Even if there are no scala sources in the build.sbt, there is a similar
performance improvement for running "sbt compile", which I found exited
2-3 seconds faster after this change.
2019-06-06 21:02:24 -07:00