Commit Graph

3135 Commits

Author SHA1 Message Date
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