Commit Graph

2329 Commits

Author SHA1 Message Date
eugene yokota aad0464138
Merge pull request #6947 from eed3si9n/wip/banner
Banner
2022-07-02 19:20:11 -04:00
Eugene Yokota 31a6c60df3 Banner 2022-07-02 19:07:34 -04:00
Eugene Yokota 05d3d8689b Remove compatibility check from ++
Problem
-------
Since sbt-doge merger `++ <sv> <command1>` has used binary compatibility
as a test to select subproject, but it causes surprising situations like
sbt/sbt#6915, and it blurs the responsibility of YAML file and build
file as the version specified in the version can override the Scala
version test on local laptop.

Solution
--------
This removes the compatibiliy check (backward-only or otherwise),
and require that `<sv>` match one of `crossScalaVersions` using the new
Semantic Version selector pattern.
2022-07-02 18:38:04 -04:00
eugene yokota 6d0ef2093d
Merge pull request #6943 from raboof/more-appropriate-error-when-no-versions-match
Show a more appropriate message when no Scala versions matches
2022-06-28 09:26:06 -04:00
Arnout Engelen 697e3bce51
Show a more appropriate message when no Scala versions matches
When switching scala versions with a wildcard, and no subproject
has a matching version to switch to, show a more appropriate error
message
2022-06-28 14:43:06 +02:00
Arnout Engelen 6a79bdb461
Show a more useful log message when doing a flexible version switch
Suggested by @SethTisue in https://github.com/sbt/sbt/pull/6894#issuecomment-1168042209

Will show multiple lines when different versions are selected for different subprojects.

When no subprojects have a matching Scala version you will get a
'Switch failed' exception anyway, so in that case there is no
change in behavior.
2022-06-28 07:59:13 +02:00
Rui Gonçalves 705d3d58ce Filter incompatible Scala 3 projects in cross switch commands 2022-06-26 22:46:37 -04:00
Arnout Engelen 8973fce1fa
More flexible Scala version switch
By using SemanticSelector instead of custom globbing.

Follow-up on https://github.com/sbt/sbt/pull/6894,
fixes https://github.com/sbt/sbt/issues/6934
2022-06-26 12:43:41 +02:00
eugene yokota 1db7dd328a
Merge pull request #6935 from eed3si9n/wip/temp-directories
[1.7.x] Fix sbt trying to delete /tmp on ARM Macs
2022-06-25 20:23:39 -04:00
Eugene Yokota 87dc5da93a Fix sbt trying to delete /tmp on ARM Macs
Problem
-------
There's a bug in ipcsocket cleanup logic that effectively
tries to wipe out /tmp.

Workaround
----------
We should fix the underlying bug, but we can start by
explicitly configuring the temp directories ipcsocket uses.

Ref https://github.com/sbt/sbt/issues/6931
2022-06-25 18:58:19 -04:00
Kamil Podsiadlo 7921cab7e3 fix: publishing bsp diagnostics
* do not publish bsp diagnostics if there were and there are no problems
* publish diagnostics if problems needs to be updated
2022-06-25 11:14:51 +02:00
Arnout Engelen cd915845db Add support for wildcards in Scala version switch
Picking from the `crossScalaVersions`

As discussed in https://github.com/sbt/sbt/discussions/6893
2022-06-24 01:41:38 -04:00
eugene yokota 290925fd99
Merge pull request #6916 from eed3si9n/wip/revert-6814
[1.7.x] Revert "Add support for scala-output-version flag in Scala 3"
2022-06-13 01:57:48 -04:00
Eugene Yokota d9e43ecfdf Revert "Add support for scala-output-version flag in Scala 3"
This reverts commit 1e89d71311.
2022-06-13 01:28:37 -04:00
Eugene Yokota d5889d3ce3 Bump to Scala 2.12.16 2022-06-13 01:27:24 -04:00
Eugene Yokota c04b2a4f73 lm 1.7.0-M1
This removes OkHttp dependency.
This also removes an experimental feature to customize HTTP for Ivy called
CustomHttp we added in sbt 1.3.0.
Since LM got switched to Coursier in 1.3.0, I don't think we advertized
CustomHttp.
2022-06-13 00:52:32 -04:00
xuwei-k 45518c7f24 Update semanticdbVersion 2022-04-17 18:32:14 -04:00
Ethan Atkins ca7c872e27 Restore watchOnTermination
At some point the watchOnTermination callback stopped working. I'm not
exactly sure how or why that happened but it is fairly straightforward
to restore. The one tricky thing was that the callback has the signature
(Watch.Action, _, _, _) => State, which requires propagating the action
to the failWatch command. The easiest way to do this was to add a
mutable field to the ContinuousState. This is rather ugly and reflects
some poor design choices but a more comprehensive refactor is out of
the scope of this fix.

This commit adds a scripted test that ensures that the callback is
invoked both in the successful and unsuccessful watch cases. In each
case the callback deletes a file and we ensure that the file is indeed
absent after the watch exits.
2022-04-17 18:31:54 -04:00
Kamil Podsiadlo faf8dfde72 bsp: add JVM test/run env capabilities to BSP 2022-04-16 13:46:12 +02:00
Kamil Podsiadlo 6eb911ad15 refactor: simplify JVm environment requests
refactor: extract common logic to the `bspInputTask`
2022-04-12 20:09:35 +02:00
Kamil Podsiadlo ad4113caeb feat: implement BSP's JVM environment requests 2022-04-12 20:09:31 +02:00
eugene yokota d065f38576
Merge pull request #6854 from eed3si9n/bport/6847
[1.7.x] Do not fire `build/publishDiagnostics` if there are (and were) no problems
2022-03-27 00:55:00 -04:00
Rikito Taniguchi 620c55d6ac Re-publish warnings on BSP server startup
Imitate 8aaf828b03
2022-03-27 00:12:23 -04:00
Rikito Taniguchi 862d373f02 Don't fire publishDiagnostic if there's no problems both in current and previous compilation 2022-03-27 00:12:14 -04:00
Brice Jaglin 491f70cd30 includePluginResolvers should work for coursier resolutions 2022-03-27 00:06:55 -04:00
Michał Pałka 1e89d71311 Add support for scala-output-version flag in Scala 3 2022-03-24 15:35:57 +01:00
Kamil Podsiadlo ce978a19ed tests: add test case for framework field in scala test classes request 2022-03-10 19:56:49 +01:00
Kamil Podsiadlo 23b50688ba feat: add optional framework field to the bsp 2022-03-04 10:53:25 +01:00
Eugene Yokota 515993498d Use lazy val 2021-12-28 23:45:04 -05:00
Eugene Yokota 544a935534 Update banner 2021-12-26 01:48:14 -05:00
Eugene Yokota 2f2ceeb9c9 Update banner 2021-11-29 05:32:33 -05:00
Eugene Yokota 5b179395ec Fixes fake position handling, take 2
Fixes #6720
Ref #5994

Problem
-------
Sometimes the compiler returns a fake position such as `<macro>`.
This causes this causes InvalidPathException on Windows if we try
to convert it into NIO path.

Solution
--------
Looks for less-than sign in the VirtualFileRef and skip those.
Since BSP requires the diagnostic info to be associated with
files, we probably can't do much.
2021-11-27 23:42:20 -05:00
Eugene Yokota e3afa845ec Extend supershell close timeout
Fixes #6592

Problem
-------
On Heroku there's timeout.

Solution
--------
This seems to be coming from supershell closing the executor.
Extend the timeout to 30s.
2021-11-27 21:26:52 -05:00
David Francoeur a448b1caab
Load credentials from SBT_CREDENTIALS (#6724)
Load credentials from SBT_CREDENTIALS
Prefer sys.env to System.getenv
2021-11-27 02:44:49 -05:00
Eugene Yokota 6c68b843d5 Fixes tab completion of global keys
Fixes #1373
Fixes #6715

Following my own PR #2855 around `ThisBuild`, this attempts to fix the
tab completion of globally scoped keys from the shell.
2021-11-16 19:23:25 -05:00
eugene yokota b3aae681bf
Merge pull request #6711 from xuwei-k/fix-scala-2-13-warn
fix Scala 2.13 warnings
2021-11-14 21:53:57 -05:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09:00
xuwei-k aa8b1141f8 Update scalatest 2021-11-14 22:03:59 +09:00
Amina Adewusi 3c81e08fa2 Migrates Treeview.scala to use Contraband
Migrates TreeView.scala to use Contraband from scala.util.parsing.json,
because this is now deprecated.
The TreeView logic is used in the dependencyBrowseTree task.
2021-11-12 16:52:12 +00:00
Adrien Piquerez c77d6dfb38 Fix #6698: Synchronize all RPC messages with systemOut notifications
`systemOut` notifications are buffered so that they are sent at most
once every 20 millisecond. Other RPC messages are not buffered.
As a consequence, some RPC messages can pass in front of some
systemOut notifications.
That's why `sbt --client run` can exit before it receives all the logs.

In general I think it is safer to maintain the order of all messages.
To do so we can force the flush of systemOut before each RPC message.
2021-11-03 10:21:02 +01:00
Adrien Piquerez 75d3bf2b5f [BSP] remove duplicated sources in sbt build target
Also remove the base directory (`./project/`) from the list of source directories
2021-10-29 15:40:00 +02:00
Adrien Piquerez e64c71dd58 [BSP] Support base source files 2021-10-29 15:40:00 +02:00
kijuky 890ecdc556 Overloaded without passing null. 2021-10-19 13:51:15 +09:00
kijuky 76c1b68516 Enable the asciiGraphWidth setting to the dependencyTree tasks. #5962 2021-10-19 02:15:31 +09:00
xuwei-k 9052c745b1 re-enable `dependency-graph` tests 2021-10-11 20:40:24 +09:00
kxbmap 59f178a4c4 Make javaHome that forks scripted tests configurable
Normally scripted tests are forked using the JVM that is running sbt.
If set `scripted / javaHome`, forked using it.

```
scripted / javaHome := Some(file("/path/to/jdk-x.y.z"))
```

Or use `java++` command before scripted.

```
sbt> java++ 11!
sbt> scripted
```
2021-10-05 00:35:56 +09:00
kxbmap 24e7398b5b Add Windows Java home selectors for some distributions that provides an installer
- Eclipse Temurin
- IBM Semeru Runtimes
- Microsoft Build of OpenJDK
- Amazon Corretto
- Azul Zulu Builds of OpenJDK
- Liberica JDK
2021-10-02 16:56:12 +09:00
Nima Taheri fcd7a3bef2 Handle cycles while rendering json dependency tree to json 2021-09-28 11:28:20 -07:00
eugene yokota 5532af17c7
Merge pull request #6629 from er1c/add-sbt-cache-arg
Add --sbt-cache argument and update localCacheDirectory key description
2021-09-19 14:02:34 -04:00
Eugene Yokota 0413727796 Drop TrapExit
Fixes https://github.com/sbt/sbt/issues/6558

Problem
-------
sbt uses SecurityManager feature of JDK to trap `sys.exit` call during
`run`-like tasks, since we emulate `run` and `console` as function calls.
JDK 17 deprecated SecurityManager and it's printing warnings.

Solution
--------
About 10 years go, `exit` was a convenient way of quitting both Scala
REPL and sbt shell. Scala 2.11 broke this by removing the `Predef.exit`.
We still need to worry about `run` potentially calling `sys.exit`
but that can be handled using fork feature.
In the long-run, it probably is better to be JDK 17 compatible.
2021-09-19 12:47:59 -04:00
Eugene Yokota 8b9cbb3311 Follow up on Scala 2.12.15 bump 2021-09-18 18:08:26 -04:00
Amina Adewusi 505492ed33 Add -Xsource:3 flag
Adding Scala 3 compatible mode for the compilation of build.sbt files.
2021-09-17 18:16:11 +01:00
Amina Adewusi c013d1180c Bump scala version to 2.12.15 2021-09-17 17:46:07 +01:00
Amina Adewusi ea67d3376b Fix for crossSbtVersions triggering lintBuild
Currently crossSbtVersions is incorrectly generating a warning that it
is an unused setting (see https://github.com/sbt/sbt/pull/5153). This
PR fixes this by adding it to the list of excluded lint keys.

Fixes #6571.
2021-09-12 04:42:01 +01:00
Igal Tabachnik 9986fb6eed Adding a test verifying task progress reports (task start/progress/finish) 2021-09-10 13:06:03 +03:00
Igal Tabachnik 2f589b6713 Extracting progress reporter to own class 2021-09-10 01:02:01 +03:00
Igal Tabachnik f209d0093c BSP tasks report progress during compilation 2021-09-09 23:25:06 +03:00
Igal Tabachnik 8fe769c41d
Merge branch 'develop' into buildTarget/cleanCache 2021-09-06 11:40:06 +03:00
Eugene Yokota 39bcfee937 Fix ClassCastException
Ref #6592
When there's an issue like timeout, currently it throws a
ClassCastException because I made some assumption about the underlying
error. This removes the unnecessary casting.
2021-09-05 01:02:37 -04:00
Igal Tabachnik 20fcab4651 Ensuring both "Rebuild Project" and "Rebuild module" work from IntelliJ 2021-08-28 13:50:12 +03:00
Igal Tabachnik c55880d795 Implementing `buildTarget/cleanCache` to support Rebuild operations from IntelliJ 2021-08-27 17:46:41 +03:00
Eric Peters 4dcae2cb73 Add --sbt-cache argument and update localCacheDirectory key description 2021-08-21 07:35:09 -07:00
Amina Adewusi 3c9826f4f4 Fixes shutdown hook error in timing report
This fixes the closed channel exception generated when running
sbt -timings help. This bug was introduced in sbt 1.4 where a wrapper
was created (Terminal.scala) around the terminal. This meant that the
shutdown hook which had been used previously was no longer working.

This has been fixed by avoiding the use of the JVM shutdown hook and
instead manually running the thunk at a place in the code where
the programme is still able to respond.
2021-08-20 17:45:14 +01:00
eugene yokota 8586e19f62
Merge pull request #6611 from Nirvikalpa108/remote-cache-again
Virtualize Sync.sync so it can be cached remotely for resources dir syncing
2021-07-31 14:56:29 -04:00
Amina Adewusi 696a19f5d7 Virtualize Sync.sync so it can be cached remotely for resources dir syncing
An alternative to https://github.com/sbt/sbt/pull/6554.
2021-07-31 18:23:30 +01:00
eugene yokota 47117020ab
Merge pull request #6605 from ScalaWilliam/more-verbose-server-exception
Building on #6353 to help identify the issue of #6101 for Windows users.
2021-07-31 13:15:34 -04:00
Adrien Piquerez 120ccccaab Make BSP requests robust to some target failures
The request of the form buildTarget/* often take a sequence of build
targets as parameter. So far if there is an error on a single build
target, the entire request fails.
This is not the best because the client wants the result of the other
build targets anyway:
For example:
- workspace/buildTargets: if one build target has an invalid Scala
version we still want to import the other ones
- buildTarget/scalacOptions: if a dependency cannot be resolved we still
want to import the build targets that do not depend on it
- buildTarget/scalaMainClasses: if buildTarget does not compile we still
want the main classes of the other targets
...

The change is to respond to BSP requests with the successful
build targets and  to ignore the failed ones.
This is implemented the same in Bloop since before BSP in sbt.

In  https://github.com/build-server-protocol/build-server-protocol/issues/204,
I made a proposal to also add the failed build targets in the response.
2021-07-30 14:41:00 +02:00
William Narmontas febccde3e7 Building on #6353 to help identify the issue of #6101 for Windows users. 2021-07-24 19:59:00 +01:00
eugene yokota d4162cce04
Merge pull request #6566 from adpi2/fix-6010
[BSP] Send diagnostics and meaningful error message when reloading fails
2021-07-12 16:01:48 -04:00
Adrien Piquerez 5490385303 Remove topLoader hack for dotty 2021-07-08 10:03:47 +02:00
Adrien Piquerez 69795cbed7 Move jansiExclusionLoader to scalaInstanceTopLoader 2021-07-08 10:03:47 +02:00
Adrien Piquerez 63dcb1957b Move scalaInstanceTopLoader to compileBase settings 2021-07-08 09:27:20 +02:00
Adrien Piquerez a76e209dde [BSP] send diagnostics when evaluating build.sbt
Since build.sbt is compiled/evaluated in `sbt.compiler.Eval`,
this commit introduces a `BuildServerEvalReporter` to redirect
the compiler errors to the BSP clients.

A new `finalReport` method is added in the new `EvalReporter` base class
to reset the old diagnostics.
2021-07-08 09:25:01 +02:00
Adrien Piquerez 4804cc2fa4 Simplify bspReload cmd by calling doLoadProject
Fixes #6010: Send real error message when realod failed
2021-07-08 08:39:46 +02:00
Adrien Piquerez a825c115c2 [BSP] Ignore sbt target in resources request 2021-06-30 10:31:43 +02:00
Jason Zaugg 3d92827af3 Fix compilation error in test 2021-06-30 12:12:24 +10:00
Jason Zaugg fe046476b1 Refine and test SBT BSP target
- Pass source dirs and current list of files
  - Align display name and URI
2021-06-30 11:19:24 +10:00
Jason Zaugg 0bd736be2a Record build sources in PluginData for BSP 2021-06-28 23:27:33 +10:00
Jason Zaugg 111cc5f473 Add scalacOptions to the SBT targets 2021-06-28 11:02:12 +10:00
Jason Zaugg af14864986 Address review feedback
- Restore old type of `bspWorkspace` key for backwards compat.
    Instead, introduce `bspFullWorkspace` that includes the
    SBT targets
  - Log a warning if the client requests, e.g. `scalaMainClasses`
    for a SBT target
  - Refactor the code that creates the SBT build targets so it
    doesn't depend on `sbtFullWorkspace`.
  - Add a setting `bspSbtEnabled` to let the user opt-opt of
    SBT target export (e.g. to compensate for a client that does
    not yet support them)
2021-06-28 11:02:12 +10:00
Jason Zaugg 45e8e2f90d Support the SBT extension in BSP import
This enables code assist in the .sbt and project/*.scala files
in IntelliJ and any other IDEs that implement this extension.
2021-06-28 11:02:09 +10:00
Adrien Piquerez 852498e992 [BSP] Remove useless log after request failure 2021-06-25 10:41:10 +02:00
Adrien Piquerez f58c8c349a [BSP] add handle for cancelled compilation 2021-06-25 10:41:08 +02:00
Adrien Piquerez f0efbf0f5d Make BSP compile fail after random exception 2021-06-25 10:40:32 +02:00
Adrien Piquerez 74ff1b0a4a Fill error message when BSP task fails 2021-06-24 17:00:22 +02:00
Samuel CLARENC c9562cb1c3
Merge branch 'develop' into bspBuildTargetResources 2021-06-21 16:52:58 +02:00
Samuel CLARENC f3ec202a06 Add resourcesProvider flag to BuildServerCapabilities in BSP contra 2021-06-21 16:51:34 +02:00
Samuel CLARENC a0e3d89855 Implement BSP buildTarget/resources command 2021-06-21 16:51:34 +02:00
Amina Adewusi 24bb4de35e
Merge branch 'develop' into remote-cache 2021-06-18 20:13:55 +01:00
Amina Adewusi f82c0c4c5f fixes remote caching not managing resource files
What is the problem?
When using remote caching, the resource files are not tracked so if they
have changed, pullRemoteCache will deliver both the old resource file
as well as the changed one.

This is a problem, because it's not the behaviour that our users will
expect and it's not in keeping with the contract of this feature.

Why is this happening?
Zinc, sbt's incremental compiler, keeps track of changes that have
been made. It keeps this in what is called the Analysis file.
However, resource files are not tracked in the Analysis file, so
remote caching is not invalidating the unchanged resource file in
place of the latest version.

What is the solution?
PullRemoteCache deletes all of the resources files. After this,
copyResources is called by PackageBin, which puts the latest
version of the resources back.
2021-06-18 20:10:07 +01:00
eugene yokota a9402a61ae
Merge pull request #6538 from adpi2/fix-mkScalaInstance
Fix compiler class loader jars
2021-06-12 01:00:22 -04:00
Adrien Piquerez 75a55a10df fix compiler class loader jars 2021-06-11 10:41:40 +02:00
Adrien Piquerez cbc1c87974 Disconnect BSP server when build/exit 2021-06-09 18:01:09 +02:00
eugene yokota f2f884436b
Merge pull request #6499 from pikinier20/scaladoc-scalac-options
Add missing scalac options to scaladoc task configuration
2021-05-30 22:06:32 -04:00
Ethan Atkins 7dbf7978e9 Disable multiple main class warning w/ qualified key
If the user runs foo/runMain in a project with multiple main classes,
sbt will still warn the user about their being multiple main classes
even though this is a pointless warning since the user either is running
runMain which requires a main class. The run task is also excluded since
by default it prompts the user with a main class selector. The previous
logic for doing this filtering was bad because it only looked at the
first command in a sequence and couldn't handle the foo/runMain case
since it was looking for an exact match with `run` or `runMain`. This
commit relaxes those restrictions to look at all of the strings in the
command as well as splitting the string to check if the last part of the
key ends in run or runMain. This logic could theoretically be incorrect
if the user wrote an input task that was expecting run or runMain as
user input but even in that case the only consequence would be that they
wouldn't see the multiple main class warning which generally isn't all
the helpful unless you are packaging a jar that expects there to be only
one main class. It seems unlikely that that the user would be running a
custom input task that is both packaging a jar and expecting run or
runMain as input strings.
2021-05-30 14:48:05 -07:00
Matthias Kurz ee460e0043
Upgrade semanticdb to newest version which supports Scala 2.12.14 2021-05-28 21:44:10 +02:00
Matthias Kurz fbfc272171
Scala 2.12.14 / 2.13.6 2021-05-28 18:13:28 +02:00
Filip Zybała 236f419f88 Add condition preventing errors on 3.0.0. Add scripted test for running doc on Scala.js project 2021-05-27 14:56:47 +02:00
eugene yokota 1ae2d9d59c
Merge pull request #6517 from Nirvikalpa108/fix-nowarn
Fix @nowarn annotation in old sbt plugin style
2021-05-21 13:58:16 -04:00
Amina Adewusi 2e6fb3f2a5 Fix nowarn in both old & new sbt plugin styles
Fixes #6430.

What is the problem?
As detailed in #6430, the @nowarn annotation was not suppressing
warnings, even after the first attempt to fix this in PR#6431.

This first PR fixed the problem for projects using
enablePlugins(SbtPlugin), but not for those using sbtPlugin := true.

Why is this a valuable problem to solve?
The annotation was not working as users would expect.

What is this solution?
I have moved the scalacOptions change from SbtPlugin.projectSettings
to the scalacOptions in the JvmPlugin settings.

Has this been tested?
Yes, a test has been added. Also, this branch was tested successfully
on the twinagle repo (https://github.com/soundcloud/twinagle/pull/224).
2021-05-21 18:11:24 +01:00
Brice Jaglin 622eabfa95 dedup unmanagedSourceDirectories for Scala 3
For Scala 3, scalaBinaryVersion == epochVersion
2021-05-15 22:14:51 +02:00
Adrien Piquerez ce59ea754a expose makeScalaInstance 2021-05-10 11:32:33 +02:00
Eugene Yokota 25148899a1 Skip zip file manipulation if the package is empty
Fixes https://github.com/sbt/sbt/issues/6497
2021-05-09 18:55:04 -04:00
eugene yokota e1766d9a3d
Merge pull request #6500 from Nirvikalpa108/correct-client-arg
make -client the same as --client
2021-05-07 14:48:37 -04:00
Amina Adewusi f12b0baef0 make -client the same as --client
The problem was that -client was different from --client, which
makes for a confusing user experience. So, this change makes
them the same and re-names -client to --java-client. The value
of this is that hopefully -client and --client being the same
feels more logical to users.
2021-05-07 16:07:42 +01:00
Filip Zybała fcab06bd3d Add missing scalac options to scaladoc task configuration 2021-05-07 11:58:18 +02:00
Adrien Piquerez a07bd46cdb Add util-interface to SbtInterfaceLoader 2021-05-03 11:18:12 +02:00
eugene yokota 9b6d4b5390
Merge pull request #6488 from eed3si9n/wip/new
Fix new command leaving behind target, take 2
2021-05-02 21:52:44 -04:00
Eugene Yokota 1c8b55107d Fix new command leaving behind target, take 2
Fixes #2835

Somehow the fix in #4033 due to various initialization.
Here's a bit more aggressive rebasing of the base directory
that should fix the `project` and `target` directory created during sbt
new.
2021-05-02 20:48:10 -04:00
Adrien Piquerez ded074ac75 Expose Defaults.makeScalaInstance 2021-05-01 20:29:42 +02:00
Jason Pickens 223ab2b310
Remove configuration scope from runner settings 2021-04-20 15:35:06 +12:00
Guillaume Galy 8849bfbcd5 Retain classifiers for transitive dependencies when publishing to Ivy 2021-04-19 15:24:45 +02:00
kenji yoshida 61f4ed1017
fix typo 2021-04-16 15:48:53 +09:00
Philippus Baalman 4bf7f3a877
Fix typo 2021-04-12 21:02:14 +02:00
eugene yokota 627f72ef87
Merge pull request #6425 from ashleymercer/issues/2853-junit-config
Allow output directory for JUnitXmlTestsListener to be configured
2021-04-12 10:15:56 -04:00
Ashley Mercer b37fc6d5be Allow JUnitXmlTestsListener output directory to be configured
Add `testReportsDirectory` setting to allow output directory for
JUnitXmlTestsListener to be configured.

Add `testReportSettings` which provides defaults values:

- by default this uses the build configuration name as a prefix so
  `target/test-reports` for `Test` config, but `target/it-reports`
  for `IntegrationTest` (previously this was hardcoded to always
  use `target/test-reports`). To override this set e.g.

  `Test / testReportsDirectory := target.value / "my-custom-dir"`

- the `JunitXmlTestsListener` is now only attached to the `Test`
  and `IntegrationTest` configs by default (previously it was added
  to the global configuration object). Any configs which inherit
  from one of these will continue to have the listener attached;
  but completely custom configurations will need to re-add with:

  `project.settings(testReportSettings)`

Fixes #2853
2021-04-12 12:17:50 +01:00
Adrien Piquerez 7ac35d11d9 Fix MetaBuildLoader 2021-04-07 17:11:38 +02:00
Adrien Piquerez 56746d5792 Fix unused nowarn in sbt plugins 2021-04-06 15:45:52 +02:00
Adrien Piquerez b0ee80e34e Use full Scala 3 version in crossTarget 2021-04-01 10:23:38 +02:00
Guillaume Martres 24dba24b2a Fix Scala 2.13-3.0 sandwich on Scala >= 3.0.0
The binary version of Scala >= 3.0.0 will be 3, but the logic was
hardcoded for 3.0.
2021-03-31 13:54:40 +02:00
Eugene Yokota 2a3a0f5594 Fixes clean not cleaning files added to cleanFiles
Fixes #6395

The current code assumes cleanFiles are only directories. This fixes that.
2021-03-29 00:23:50 -04:00
eugene yokota 1cb23c843b
Merge pull request #6417 from mkurz/fix_warn
Add missing versionScheme to warning
2021-03-28 16:43:07 -04:00
Josef Vlach 0c7bc71403
Instantiate only test runners needed by current TestDefinitions 2021-03-28 20:58:18 +01:00
Matthias Kurz dc2865d407
Add missing versionScheme to warning 2021-03-28 21:31:48 +02:00
Adrien Piquerez 54c27d575b Fix internal dependency configurations 2021-03-23 15:58:23 +01:00
Eugene Yokota 01e3d9e9d8 Use LOCALAPPDATA or $HOME/AppData/Local on Windows
Fixes https://github.com/sbt/sbt/issues/5206

Problem
--------
Coursier uses directories-jvm to determine its default cache directory.
Currently directories-jvm shells out to Powershell to call the [Known Folders API](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid), which doesn't work in various environments, and instead of an error, it apparently returns `null/Coursier/cache` as the directory name.

Solution
--------
With due respect to the heroic effort directories-jvm is making to comply to the directory standards on all operating systems, including that of Microsoft, I don't think the majority of the sbt users care exactly where that directory is as long as it is well-documented, and calculated in a fast and predictable way.

Instead of shelling out to Powershell, or using JNI, to hit the Known Folders API, I propose we first look at `LOCALAPPDATA` environment variable. When it is not found, it will fall back to `$HOME/AppData/Local`. Per discussion in https://github.com/dirs-dev/directories-jvm/issues/43, `LOCALAPPDATA` environment variable may NOT represent the one-true Known Folders API value of the AppData directory in case the user happened to have set the `LOCALAPPDATA` environmental variable. For the purpose of picking a directory for Coursier cache, I don't find that to be a problem because it will be faster, more reliable, and predictable.
2021-03-21 20:50:03 -04:00
eugene yokota b8691cba88
Merge pull request #6397 from arixmkii/bsp-env-var
Environment variables support in BSP debug session
2021-03-19 11:45:01 -04:00
Arthur Sengileyev 75a5135417 Adding env vars at ScalaMainClass creation time 2021-03-18 23:13:03 +02:00
Adrien Piquerez 332b53735e Silence unused-nowarn in meta-build 2021-03-18 18:27:26 +01:00
Arthur Sengileyev 970ce22aca Environment variables support in BSP debug session 2021-03-15 13:41:50 +02:00
eugene yokota 3d784b9217
Merge pull request #6378 from adpi2/bsp-logging
Improve BSP processing logs
2021-03-09 09:46:31 -05:00
Adrien Piquerez 93afa7e892 Improve BSP processing logs
The processing log is sent when a command issued by a request is being
processed, if the request has not yet been responded. In particular,
the processing log of sbtReportResult is filtered out if the client has
already received a response.

The processing log severity is the lowest so that it can be ignored by
the BSP client.
2021-03-09 10:18:12 +01:00
Ethan Atkins 7dc5590190 Don't use deprecated `in` inside of macros
The inputFileChanges, inputFiles and outputFiles macros all used the now
deprecated `in` syntax, which causes warnings for builds that use these
apis. SlashSyntax doesn't naively work in these macros so it was easier
to just reimplement the logic in this file.

Fixes #6330
2021-03-08 10:54:01 -08:00
Matthias Kurz 6fbed26d22 Make sure to also pass absolute sourceFile to sourceMappers 2021-03-07 14:44:42 -05:00
eugene yokota ff6cbf2e1f
Merge pull request #6351 from steinybot/scripted-publish-deps
Publish all plugin dependencies
2021-03-04 23:35:59 -05:00
Ondra Pelech 81457e60ec
Give an explanation in case of ServerAlreadyBootingException (#6353)
Give and explanation in case of ServerAlreadyBootingException
2021-03-04 23:21:42 -05:00
eugene yokota 5f24664c0d
Merge pull request #6355 from marcospereira/updates/semanticdb-4.4.10
Update semanticdb to version 4.4.10
2021-03-04 20:17:06 -05:00
Marcos Pereira c9941aeabc
Update semanticdb to version 4.4.10 2021-03-04 16:38:00 -05:00
Matthias Kurz de313bbdde
Never set a default for sourcePositionMappers 2021-03-04 22:30:35 +01:00
Jason Pickens 6e0da94d91
Publish all plugin dependencies 2021-03-04 12:09:12 +13:00
eugene yokota 0972b7fa17
Merge pull request #6336 from adpi2/fix-tasty-test
Fix TastyFiles added twice in Test
2021-02-24 13:28:51 -05:00
eugene yokota c5eda8c7ce
Merge pull request #6332 from adpi2/fix-scala3-doc
Fix scaladoc resolution without JCenter
2021-02-24 11:25:20 -05:00
Adrien Piquerez c1e7b9c3f8 Fix TastyFiles added twice in Test 2021-02-24 15:58:31 +01:00
Julien Richard-Foy fad8e8c3c9 Add MUnit test framework 2021-02-24 10:42:30 +01:00
Adrien Piquerez ff12c87367 fix scaladoc resolution without JCenter 2021-02-23 16:24:49 +01:00
eugene yokota ab2b396543
Merge pull request #6329 from eed3si9n/fport/6326
[fport] synchronize access to stamps in testQuickFilter
2021-02-22 00:42:50 -05:00
Rafał Sumisławski d3080ee3f0 synchronise access to stamps in testQuickFilter 2021-02-22 00:15:51 -05:00
Eugene Yokota 695261a068 Migrate most of the internal usage of in 2021-02-22 00:09:36 -05:00
Eugene Yokota 6c18a37d3f integrate assumedVersionScheme and assumedEvictionErrorLevel
Fixes https://github.com/sbt/sbt/issues/6301
Fixes https://github.com/sbt/sbt/issues/6302

```scala
ThisBuild / assumedVersionScheme := VersionScheme.PVP
ThisBuild / assumedVersionSchemeJava := VersionScheme.EarlySemVer
ThisBuild / assumedEvictionErrorLevel := Level.Warn
```
2021-02-21 19:17:34 -05:00
Adrien Piquerez 9a2b0f5f06 Move sbtDependency in pluginCrossBuild to JvmPlugin 2021-02-20 13:22:30 +01:00
Adrien Piquerez be1e756104 Upgrade semanticdb default version 2021-02-20 11:36:58 +01:00
Eugene Yokota 5495524e60 Fix "-Yrangepos" disappearing from Test / scalacOptions
Fixes https://github.com/sbt/sbt/issues/5934

In #5886 adpi2 reported that Test / scalacOptions could have unwanted duplicated flags from Compile / scalacOptions. So #5887 added

```diff
+    // remove duplicated semanticdbOptions
+    scalacOptions --= (Compile / semanticdbOptions).value
```

Notice that it's subtracting (Compile / semanticdbOptions).value regardless of the semanticdbEnabled value. If semanticdbEnabled is set to true I am guessing that it would all work out, but when it's false, it's just subtracting "-Yrangepos".

This fixes that by checking for semanticdbEnabled.
2021-02-17 00:45:41 -05:00
eugene yokota 6c6df88d1e
Merge pull request #6309 from eed3si9n/wip/deprecate_old_shell_syntax
Deprecate old shell syntax
2021-02-16 10:08:13 -05:00
Eugene Yokota 9cde1dfcaa Warn on missing versionScheme
Fixes https://github.com/sbt/sbt/issues/6303

This will print warning on publishing when versionScheme is not set.

```
[warn] versionScheme setting is empty; set `ThisBuild / versionScheme := Some("early-semver")` or `Some("pvp")`
[warn] so tooling can use it for evction errors etc - https://www.scala-sbt.org/1.x/docs/Publishing.html
```
2021-02-15 16:53:57 -05:00
Eugene Yokota 2305abd81e Deprecate old shell syntax
Unified slash syntax was added in sbt 1.1.x (https://github.com/sbt/sbt/pull/3434).
This deprecates the older shell syntax: `proj/cofing:intask::key`.

### Example

```
sbt:hello> it:compile
[warn] sbt 0.13 shell syntax is deprecated use slash syntax instead: IntegrationTest / compile
[info] compiling 1 Scala source to /private/tmp/hello/target/scala-2.13/classes ...

sbt:hello> compile:console::scalacOptions
[warn] sbt 0.13 shell syntax is deprecated use slash syntax instead: Compile / console / scalacOptions
```
2021-02-15 13:40:47 -05:00
eugene yokota da4e1d3711
Merge pull request #6296 from bjaglin/semanticdb-confs
better support of custom configurations in SemanticdbPlugin
2021-02-15 12:12:48 -05:00
Eugene Yokota a25d9e7114 dependency-graph fixes 2021-02-06 22:58:12 -05:00
Eugene Yokota 587d821828 Override filter method on the FilteringReporter 2021-02-06 22:32:14 -05:00
Eugene Yokota 22d12f6618 Use nowarn annotation 2021-02-06 22:31:47 -05:00
Brice Jaglin 145966e3f3 better support of custom configurations in SemanticdbPlugin
Second take at https://github.com/sbt/sbt/issues/5886, which fixed the
problem for Test specifically but not for custom configurations.

* Any child of Compile (like Custom in the scripted) had to use
  testSettings, whether they were related to testing or not
* Custom configurations with grand parents (like SystemTest in the
  scripted) would get duplicated scalacOptions no matter what they used
2021-02-06 23:52:55 +01:00
Eugene Yokota 5ebb3da150 Override warning + error method
Scala compiler changed the implementation of reporter in 2.12.13 such that overriding `info0` no longer increments the error count in the delegating reporter.
See https://github.com/scala/bug/issues/12317 for details.
2021-02-01 01:20:20 -05:00
Eugene Yokota 61a077e3a6 Scala 2.12.13 2021-01-31 12:59:31 -05:00
Eugene Yokota 1275051974 Deprecate externalPom
Ref #5493
2021-01-24 23:36:02 -05:00
eugene yokota 83012a9644
Merge pull request #6237 from eed3si9n/wip/package
packageTimestamp setting
2021-01-24 23:24:09 -05:00
Eugene Yokota 628d908a5c packageTimestamp setting
Fixes https://github.com/sbt/sbt/issues/6235

In sbt 1.4.0 (https://github.com/sbt/sbt/pull/5344) we started wiping out the timestamps in JAR
to make the builds more repeatable.
This had an unintended consequence of breaking Play's last-modified response header (https://github.com/playframework/playframework/issues/10572).

This adds a global setting called `packageTimestamp`, which is
initialized as follows:

```scala
packageTimestamp :== Package.defaultTimestamp,
```

Here the `Package.defaultTimestamp` would pick either the value from the
`SOURCE_DATE_EPOCH` environment variable or 2010-01-01.

To opt out of this default, the user can use:

```scala
ThisBuild / packageTimestamp := Package.keepTimestamps

// or

ThisBuild / packageTimestamp := Package.gitCommitDateTimestamp
```

Before (sbt 1.4.6)
------------------

```
$ ll example
total 32
-rw-r--r--  1 eed3si9n  wheel   901 Jan  1  1970 Greeting.class
-rw-r--r--  1 eed3si9n  wheel  3079 Jan  1  1970 Hello$.class
-rw-r--r--  1 eed3si9n  wheel   738 Jan  1  1970 Hello$delayedInit$body.class
-rw-r--r--  1 eed3si9n  wheel   875 Jan  1  1970 Hello.class
```

After (using Package.gitCommitDateTimestamp)
--------------------------------------------

```
$ unzip -v target/scala-2.13/root_2.13-0.1.0-SNAPSHOT.jar
Archive:  target/scala-2.13/root_2.13-0.1.0-SNAPSHOT.jar
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
     288  Defl:N      136  53% 01-25-2021 03:09 888682a9  META-INF/MANIFEST.MF
       0  Stored        0   0% 01-25-2021 03:09 00000000  example/
     901  Defl:N      601  33% 01-25-2021 03:09 3543f377  example/Greeting.class
    3079  Defl:N     1279  59% 01-25-2021 03:09 848b4386  example/Hello$.class
     738  Defl:N      464  37% 01-25-2021 03:09 571f4288  example/Hello$delayedInit$body.class
     875  Defl:N      594  32% 01-25-2021 03:09 ad295259  example/Hello.class
--------          -------  ---                            -------
    5881             3074  48%                            6 files
```
2021-01-24 22:14:31 -05:00
eugene yokota feaea5d943
Merge pull request #6265 from adpi2/scala3-doc
[1.5.0-M1] Improve error report for scala3doc missing
2021-01-24 21:36:26 -05:00
eugene yokota 43409fcc6f
Update main/src/main/scala/sbt/Defaults.scala 2021-01-24 18:02:50 -05:00
Eugene Yokota c5d65fe3c7 Cache configuration parser 2021-01-23 22:27:25 -05:00
Eugene Yokota 5deb1f5994 Fix configuration identifier completion
Fixes https://github.com/sbt/sbt/issues/6282
2021-01-23 22:15:06 -05:00
Marko Elezovic 79645dfee7 Fix ExitCode calc on StashOnFailure
Previous sbt.Exec != String match would never fail
2021-01-19 11:37:00 +01:00
Adrien Piquerez 67689e0bbd Improve error report for scala3doc missing 2021-01-18 20:20:03 +01:00
Eugene Yokota 98450fe743 Add half-failing tests for completions 2021-01-16 03:48:57 -05:00
Eugene Yokota 1c6a5d21bb Port mutable.Specification to verify.BasicTestSuite 2021-01-16 00:47:53 -05:00
Naoki Takezoe 5ce3a174e8 Reset ZipEntry timestamps to 2010-01-01 in order to prevent negative value 2021-01-14 08:32:50 +09:00
Adrien Piquerez fdcfe87dbf
Merge branch 'develop' into client-launch-jar 2021-01-11 13:20:49 +01:00
Eugene Yokota 8f5759e48d Cross build to Scala 2.13 2021-01-10 20:24:05 -05:00
Eugene Yokota f8c158291d Work around Scala parallel collections situation
Ref https://github.com/scala/scala-parallel-collections/issues/22

Parallel collection got split off without source-compatible library, so apparently we need to roll our own compat hack, which causes import not used, so it needs to be paired with silencer.
2021-01-10 18:02:18 -05:00
Eugene Yokota ab402543d3 Replace the unicode arrows 2021-01-10 14:20:43 -05:00
Eugene Yokota 6d2a516df5 Port XMainConfiguration to Java
The bytecode generated by 2.13 compiler contains scala.runtime.BoxedUnit in the constant pool. To avoid referencing scala-library, port XMainConfiguration to Java.
2021-01-10 14:17:26 -05:00
Adrien Piquerez 8f5c222a0c Introduce tastyFiles task 2021-01-04 18:43:49 +01:00
Adrien Piquerez ab345e0a71 Adapt sources and scalacOptions for scala3doc 2021-01-04 10:01:34 +01:00
Adrien Piquerez 5f4197cf2e Use scala-doc-tool config for scala3doc 2021-01-04 10:01:34 +01:00
Adrien Piquerez 521e80b61b Fix semanticdb on Scala > 3.0.0-M3 2020-12-25 17:34:06 +01:00
Adrien Piquerez 166a421a26 Fix Scala 3 consoleProject and add scripted test 2020-12-23 21:21:54 +01:00
Adrien Piquerez 4b91541a69 Fix MetaBuildLoader on local snapshot deps 2020-12-23 21:20:59 +01:00
Adrien Piquerez 2d75cbd3b9 Manage .tasty files in Scala 3 2020-12-23 21:20:59 +01:00
Adrien Piquerez 08b83d6b31 Fetch Scala 3 compiler bridge binary module
Contrary to Scala 2, Scala 3 compiler bridges are tied to the compiler
version. There is one compiler bridge foreach compiler version.
Scala compiler bridges are pure java so they are binary compatible with
all Scala version. Consequently, we can fetch the binary module directly
without using the ZincCompilerBridgeProvider.
2020-12-23 21:20:59 +01:00
Adrien Piquerez c9478529e6 Manage Scala 3 instances 2020-12-23 21:20:24 +01:00
eugene yokota f9d8d8c45f
Merge pull request #6221 from eed3si9n/wip/eviction_error
Replace EvictionWarning with EvictionError
2020-12-23 13:03:30 -05:00
João Ferreira 08eaa9fb3b regen contraband 2020-12-21 17:21:54 +00:00
Eugene Yokota 1111ed09ad Replace EvictionWarning with EvictionError
Fixes https://github.com/sbt/sbt/issues/5976
Ref https://eed3si9n.com/enforcing-semver-with-sbt-strict-update

This removes the guess-based EvictionWarning, and runs EvictionError instead.
EvictionError uses the `ThisBuild / versionScheme` information supplied by the library authors in addition to `libraryDependencySchemes` that the build users could provide:

```scala
ThisBuild / libraryDependencySchemes += "com.example" %% "name" % "early-semver"
```

as the version scheme "early-semver", "semver-spec", "pvp", "strict", or "always" may be used.
Here's an example of `update` failure:

```
[error]  * org.typelevel:cats-effect_2.13:3.0.0-M4 (early-semver) is selected over {2.2.0, 2.0.0, 2.0.0, 2.2.0}
[error]      +- com.example:use2_2.13:0.1.0-SNAPSHOT               (depends on 3.0.0-M4)
[error]      +- org.http4s:http4s-core_2.13:0.21.11                (depends on 2.2.0)
[error]      +- io.chrisdavenport:vault_2.13:2.0.0                 (depends on 2.0.0)
[error]      +- io.chrisdavenport:unique_2.13:2.0.0                (depends on 2.0.0)
[error]      +- co.fs2:fs2-core_2.13:2.4.5                         (depends on 2.2.0)
[error]
[error]
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel
```

This catches the violation of cats-effect_2.13:3.0.0-M4 version scheme (early-semver) without user setting additional overrides. If the user wants to opt-out of this, the user can do so per module:

```scala
ThisBuild / libraryDependencySchemes += "org.typelevel" %% "cats-effect" % "always"
```

or globally as:

```
ThisBuild / evictionErrorLevel := Level.Info
```
2020-12-21 00:24:39 -05:00
Ethan Atkins 0a8e8a45d0 Catch RejectedExecutionException in MainLoop
sbt 1.4.x was printing a very verbose and annoying
RejectedExectionException when the user cancelled tasks with ctrl+c.

Fixes #6192
2020-12-18 16:57:27 -08:00
Adrien Piquerez f38a7272e7 Remove dotty tool dependencies 2020-12-17 10:24:07 +01:00
Adrien Piquerez c9ab2ee558 Put compiler-interface in the Scala Instance top loader 2020-12-11 11:47:08 +01:00
Matthias Kurz 0dc7622969
Use identity 2020-12-04 00:36:48 +01:00
Matthias Kurz 8e48630376
onLoad now runs with correct FileTreeRepository and CacheStoreFactory 2020-12-04 00:01:47 +01:00
Erlend Hamnaberg a554976ffb Update main/src/main/scala/sbt/internal/server/BuildServerProtocol.scala
Change from review

Co-authored-by: Adrien Piquerez <adrien.piquerez@gmail.com>
2020-11-29 16:36:38 +01:00
Ethan Atkins b70bdce683 Set the exit value when sbt is started with -client 2020-11-27 12:12:15 -08:00
Erlend Hamnaberg 341e09a07e Make it possible to not write the bsp connection file
Made the bspConfig task dependendant on the bspConfig value.
Changed the bspConfig setting to use a attributeKey so we can use it in the server as well.
2020-11-27 20:00:12 +01:00
João Ferreira e1d8f0cafd
Updates to Coursier 2.0.7 (#6120)
* Updates to Coursier 2.0.7

https://github.com/coursier/sbt-coursier/releases/tag/v2.0.4 which includes https://github.com/coursier/coursier/releases/tag/v2.0.7

> Memo-ize classes that can be created at a high rate

coursier.core.{Dependency, Module, Publication} are now memo-ized (using weak references). This can lower the amount of duplicate instances of these objects, and lower GC pressure.
2020-11-26 19:25:37 -05:00