Commit Graph

11969 Commits

Author SHA1 Message Date
Ethan Atkins 53788ba356 Support input tasks in cross (+) command 2019-12-03 10:47:15 -08:00
Ethan Atkins 0cbbee4418 Don't import fields from local variables
I found it hard to reason about where certain local variables, like
currentRef, were coming from. I also changed 'x' to 'extracted' in a few
places for clarity as well.
2019-12-03 10:45:52 -08:00
eugene yokota 3fc9513ec5
Merge pull request #5259 from eatkins/background-jobs
Background jobs
2019-12-02 15:55:15 -05:00
Ethan Atkins abb3f61ff1
Merge branch 'develop' into background-jobs 2019-12-02 08:58:24 -08:00
Ethan Atkins 21f09e6025
Merge pull request #5260 from eatkins/state-transform
Improve StateTransform
2019-12-02 08:51:18 -08:00
Ethan Atkins 1a7d6a84f5
Merge branch 'develop' into state-transform 2019-12-02 08:03:46 -08:00
eugene yokota 56af617908
Merge pull request #5258 from eatkins/lint
Make minor improvements to project setting linting
2019-11-30 23:29:26 -05:00
eugene yokota bb938e761d
Merge pull request #5256 from eatkins/scalafmt
Bump scalafmt and run on metabuild
2019-11-30 23:27:52 -05:00
eugene yokota 9a3b7cfc3f
Merge pull request #5257 from eatkins/bump-sbt
Bump sbt version
2019-11-30 23:26:37 -05:00
Ethan Atkins 9e02d31fcf
Merge pull request #5255 from eatkins/scripted-exceptions
Don't print stack trace for pending tests
2019-11-30 18:10:45 -08:00
Ethan Atkins 8d67593cf5
Merge branch 'develop' into scripted-exceptions 2019-11-30 15:51:53 -08:00
Ethan Atkins 73a196798f Move background job service directory location
Rather than putting the background job temporary files in whatever
java.io.tmpdir points to, this commit moves the files into a
subdirectory of target in the project root directory.

To make the directory configurable via settings, I had to move the
declaration of the bgJobService setting later in the project
initialization process. I don't think this should matter because
background jobs shouldn't be created until after the project has loaded
all of its settings..
2019-11-30 15:20:00 -08:00
Ethan Atkins 73edc8d4ff Use anonymous function instead of Runnable 2019-11-30 15:20:00 -08:00
Ethan Atkins 7426ae520c Fix background job shutdown
When a user calls sbt exit and there is an active background job, sbt
may not exit cleanly. This was primarily because the
background job service shutdown method depended on the
StandardMain.executionContext which was closed before the background job
service was shutdown. This was fixable by reordering the resource
closing in StandardMain.runManaged.
2019-11-30 15:20:00 -08:00
Ethan Atkins 8d26bc73b4 Shutdown background job on error
When running a main method, if the user inputs ctrl+c then the `run`
task will exit but the main method is not interrupted so it continues
running even once sbt has returned to the shell. If the main method is a
webserver, this prevents run from ever starting again on a fixed port.
To fix this, we can modify the waitForTry method to stop the job if an
exception is thrown (ctrl+c leads to an interrupted exception being
thrown by waitFor).

I rework the BackgroundJobService so that the default implementation of
waitForTry is now usable and no longer needs to be overridden. The side
effect of this change is that waitFor may now throw an exception. Within
sbt, waitFor was only used in one place and I reworked it to use
waitForTry instead. This could theoretically break a downstream user who
relied on waitFor not throwing an exception but I suspect that there
aren't many users of this api, if any at all.
2019-11-30 15:20:00 -08:00
Ethan Atkins a83c280db1 Improve StateTransform
The StateTransform class introduced in
9cdeb7120e did not cleanly integrate with
logic for transforming the state using the `transformState` task
attribute. For one thing, the state transform was only applied if the
root node returned StateTransform but no transformation would occur if a
task had a dependency that returned StateTransform. Moreover, the
transformation would override all other transformations that may have
occurred during task evaluation.

This commit updates StateTransform to act very similarly to the
transformState attribute. Instead of wrapping a `State` instance, it now
wraps a transformation function from `State => State`. This function
can be applied on top of or prior to the other transformations via the
`transformState`.

For binary compatibility with 1.3.0, I had to add the stateProxy
function as a constructor parameter in order to implement the `state`
method. The proxy function will generally throw an exception unless the
legacy api is used. To avoid that, I private[sbt]'d the legacy api so
that binary compatibility is preserved but any builds targeting > 1.4.x
will be required to use the new api.

Unfortunately I couldn't private[sbt] StateTransform.apply(state: State)
because mima interpreted it as a method type change becuase I added
StateTransform.apply(transform: State => State). This may be a mima bug
given that StateTransform.apply(state: State) would be jvm public even
when private[sbt], but I figured it was quite unlikely that any users
were using this method anyway since it was incorrectly implemented in
1.3.0 to return `state` instead of `new StateTransform(state)`.
2019-11-30 15:06:34 -08:00
Ethan Atkins 3bb847fc72 Allow lintUnusedKeys to be disabled
The linting can take a while for large projects because `Def.compiled`
scales in the number of settings. Even for small projects (i.e. scripted
tests), it takes about 50 ms on my computer. This doesn't change the
current behavior because the default value is true.
2019-11-30 15:00:38 -08:00
Ethan Atkins 805fa002a7 Only print unused setting warning if there are any 2019-11-30 15:00:38 -08:00
Ethan Atkins d7a191e277 Bump sbt version 2019-11-30 14:59:44 -08:00
Ethan Atkins bb73730c00 Run scalafmtSbt
Also add scalafmtSbtCheck to travis.
2019-11-30 14:57:57 -08:00
Ethan Atkins 094d730b06 Bump scalafmt 2019-11-30 14:57:20 -08:00
eugene yokota 181bfe8a46
Merge pull request #5254 from dwijnand/cleanup/Transform
Cleanup project/Transform.scala
2019-11-30 17:47:39 -05:00
Ethan Atkins a708cac2a3 Don't print stack trace for pending tests
This can be very noisy, especially for tests that are marked pending
because they fail to load the build. These induce a lengthy and largely
unhelpful "Reload for batch scripted failed..." error message.
2019-11-30 13:53:47 -08:00
eugene yokota 5377fb98df
Merge pull request #5251 from steinybot/fix/5250-console-project-scala-2-13
Fix consoleProject for scala 2.13
2019-11-29 23:02:12 -05:00
Dale Wijnand 02e26465f7 Cleanup project/Transform.scala 2019-11-28 21:25:49 +00:00
Jason Pickens 71bc3876d9
Scope compiler bridge to consoleProject 2019-11-28 20:29:31 +13:00
Jason Pickens 8c3245d569
Add test to reproduce consoleProject bug 2019-11-28 20:14:49 +13:00
eugene yokota 964f7867b3
Merge pull request #5242 from xuwei-k/update-license-url
Update license url
2019-11-23 12:03:10 -05:00
xuwei-k fc94204e8c Update license url 2019-11-23 16:09:13 +09:00
eugene yokota 4c1f7a7548
Merge pull request #5240 from eed3si9n/wip/bumpcoursier
lm-coursier-shaded 2.0.0-RC5-2
2019-11-22 15:45:59 -05:00
Eugene Yokota 8f82014e31 mima 2019-11-22 14:37:07 -05:00
Eugene Yokota 0e3f94ea53 lm-coursier-shaded 2.0.0-RC5-2
Fixes #5132
Fixes #4706
Fixes #4688
2019-11-22 14:00:48 -05:00
eugene yokota b18140c14b
Merge pull request #5182 from eed3si9n/wip/nolub
apply -Yno-lub
2019-11-22 11:01:54 -05:00
eugene yokota c45e991c6b
Merge pull request #5229 from eed3si9n/wip/addPluginSbtFile
addPluginSbtFile command fixes
2019-11-21 17:02:02 -05:00
eugene yokota aa6ce25a86
Merge pull request #308 from esamson/master
Use exec to launch when not in cygwin
2019-11-20 21:49:36 +02:00
eugene yokota 9b9e168fb4
Merge pull request #5235 from fthomas/fix/5234
Include description and homepage in ivy.xml files
2019-11-20 21:44:13 +02:00
Edward Samson a362c964de Use exec to launch when not in cygwin
This allows, for example, capturing the correct PID when launching sbt
from within a bash script. The original change from
1a07150560 was to address an issue
specific to cygwin.
2019-11-20 13:57:33 +08:00
eugene yokota 031021cea0
Merge pull request #307 from er1c/script-version-no-copy
Update sbt.bat --script-version to execute early and avoid java check/robocopy bootstrap
2019-11-18 07:49:17 +02:00
Eric Peters 8122bd7020 Update citest to use 1.3.0 release 2019-11-17 11:49:58 -08:00
Eric Peters 63eabf3c8f Update sbt.bat --script-version to execute early and avoid java check/robocopy bootstrap - Fixes #5220 2019-11-17 08:35:30 -08:00
Frank S. Thomas 16860b5273 Include description and homepage in ivy.xml files
This PR includes the values of the `description` and `homepage`
settings into the `ivy.xml` files generated by the `makeIvyXml`
task. It restores the behaviour of sbt 1.2.8 and if `useCoursier`
is set to `false`.

Two things are changed in this PR:
 * `IvyXml.content` now adds the `homepage` attribute to the
   `description` element if `project.info.homePage` is not empty.
 * `CoursierInputsTasks.coursierProject0` now fills the previous
   empty `CProject.info` field with the description and homepage.

Closes: #5234
2019-11-16 20:18:42 +01:00
eugene yokota 98aac0a413
Merge pull request #306 from michaelh0911/master
Add special handling for -XX
2019-11-13 09:00:06 +02:00
Michael Hsu 1318c0f594 Add special handling for -XX, -XX:+ and -XX:0 2019-11-11 10:59:06 +08:00
Michael Hsu cb19634350 Fix tests for -XX, then add test for -XX:+ and -XX:- 2019-11-11 10:56:10 +08:00
Eugene Yokota 033601c393 addPluginSbtFile command fixes
Ref #4211
Fixes #4395
Fixes #4600

This is a reimplementation of `--addPluginSbtFile`. #4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
2019-11-10 20:03:09 -05:00
Michael Hsu 34ca729719 Fix Travis CI error: find: '=': No such file or directory 2019-11-10 20:46:55 +08:00
Michael Hsu c742f66dd8 Add tests for -XX and mutiple -D 2019-11-09 22:44:13 +08:00
Michael Hsu fe43d0b975 Add special handling for -XX
Fix special handling for -D where > null should be > nul
Fix the problem that only the first option of SBT_OPTS and JAVA_OPTS got processed
2019-11-08 10:23:53 +08:00
eugene yokota 08c7fd1b8f
Merge pull request #5225 from samvel1024/develop
Sleep the current thread when we need to retry background job shutdown
2019-11-06 10:33:51 -05:00
Samvel Abrahamyan ff75a21d4f Sleep the current thread when we need to retry background job shutdown 2019-11-05 14:54:55 +01:00