Commit Graph

2329 Commits

Author SHA1 Message Date
Adrien Piquerez b189d49968 Refactoring 2023-10-25 14:19:03 +02:00
unknown 3d1319efea Use sourcePositionMappers in BuildServerReporter 2023-10-25 11:40:18 +02:00
Eugene Yokota 2956f168db Make loading order alphabetical for plugins
**Problem**
Plugins are topologically sorted, but plugins with equal weigh could
modify the same key via `~=` etc, resulting in different builds
depending on the artifact.

**Solution**
This attempts to fix that by first sorting the selected plugins
by the class name before sorting it topologically.
2023-10-15 22:09:23 -04:00
adpi2 da41144f37
Merge pull request #7350 from dragos/commands-progress
Add a new CommandProgress API.
2023-10-12 09:24:14 +02:00
Martin Duhem 77e22e9a01 Small documentation fixes 2023-10-11 22:30:18 +02:00
MINKYU LEE 9f1d2fd4ed
Fix bug of unmanagedResourceDirectories (#7178)
Sort resourceDirectories for copyResourcesTask
2023-10-08 22:56:48 -04:00
kenji yoshida 32558c9537
catch NoSuchMethodError when call runFinalization 2023-10-08 18:04:06 +09:00
eugene yokota 5d6d30ed1c
Merge pull request #7396 from mkurz/uri_log_dependencyBrowseTree 2023-10-07 13:03:25 -04:00
Matthias Kurz 5fddf3d741
Include uri in log of dependencyBrowseTree 2023-10-07 12:20:01 +02:00
adpi2 d53ccda9c4
Merge branch '1.10.x' into commands-progress 2023-10-04 09:49:05 +02:00
Michel Davit c5fd4f2e6d Support cross-build for external project ref 2023-10-03 16:12:54 +02:00
eugene yokota 397c7a634a
Merge pull request #7352 from adpi2/bsp-javacoptions
[BSP] Implement `buildTarget/javacOptions`
2023-09-21 13:54:31 -04:00
Matthew de Detrich 8ce5f2e336 Document scriptedSbt 2023-09-15 20:49:39 +02:00
Eugene Yokota b1e9308ebe Use binary compiler bridge
Problem
-------
Starting Scala 2.13.12, Scala 2 has in-sourced the compiler bridge
implementtion, which hopefully will be kept up to date more than the
ones in Zinc.

Solution
--------
This switches to using the pre-compiled compiler bridge for >=2.13.12.
2023-09-11 23:15:15 -04:00
Seth Tisue 876a85461d add a Scala 3 seed to the sbt new menu 2023-08-13 07:18:09 -07:00
Iulian Dragos 18353f1ca8
Reviewer's suggestions. 2023-08-11 16:08:11 +02:00
Adrien Piquerez 5515619ecc Implement buildTarget/javacOptions 2023-08-10 16:11:28 +02:00
Iulian Dragos 51a774b081
Fix failing test case 2023-08-08 11:29:32 +02:00
Iulian Dragos 193dba708f
Add missing header. 2023-08-08 10:14:48 +02:00
Iulian Dragos 0f53349ce9
Add method overload to keep binary compatibility 2023-08-08 09:54:09 +02:00
Iulian Dragos 82ae293e3f
Add a new CommandProgress API.
In addition to ExecuteProgress, this new interface allows builds and plugins to receive events when commands start and finish, including the State before and after each command. It also makes cancellation visible to clients by making the Cancelled type top-level.
2023-08-07 17:09:30 +02:00
Adrien Piquerez 897e2552e4 Maintain order of internal deps 2023-08-02 10:26:59 +02:00
Eugene Yokota de20328029 Let ++ fall back to a bincompat Scala version
Fixes https://github.com/sbt/sbt/issues/7327

**Problem**
In builds with mixed Scala patch versions (like scalameta),
it's possible for a core subproject to be set to the lastest 2.12.x,
but the compiler plugin component is cross published to 2.12.0 etc.
`++ 2.12.0` in this case does not work since sbt 1.7.x onwards requires
the queried Scala version to be listed in `crossScalaVersions`.

**Solution**
This implements sbt 1.6.x-like fallback mechanism,
but instead of using the queried version (e.g. 2.12.0) it will set
the Scala version to one of listed versions that is binary compatible.
2023-07-09 18:31:55 -04:00
eugene yokota 98cafd366c
Merge pull request #7318 from eed3si9n/wip/template_bump
Bump toolkit versions
2023-06-25 20:07:14 -04:00
eugene yokota 4b810a63e7
Merge pull request #7304 from eed3si9n/wip/templates
Make sbt new extensible
2023-06-25 20:07:02 -04:00
Eugene Yokota 952db253a2 Bump toolkit versions 2023-06-25 19:18:43 -04:00
eugene yokota 5fc0a4c8d4
Merge pull request #7317 from xuwei-k/trivial-refactoring 2023-06-25 11:28:41 -04:00
eugene yokota fb011ecaa3
Merge pull request #7315 from xuwei-k/URL-constructor 2023-06-24 22:14:00 -04:00
xuwei-k 6c032b8283 some trivial refactoring
- remove unused type params
- use `withFilter` if possible
- use `collectFirst` instead of `collect` and `headOption`
- use `length` instead of `size` if `Array` or `String`
- use `foreach` instead of `map`
2023-06-25 08:57:41 +09:00
xuwei-k c7ec22cff8 avoid deprecated `java.net.URL` constructor
- https://bugs.openjdk.org/browse/JDK-8295949
- 4338f527aa
2023-06-25 08:23:09 +09:00
xuwei-k 3de0c92754 fix scaladoc warnings 2023-06-25 08:04:17 +09:00
xuwei-k 2edb4dcbb6 fix typo 2023-06-24 20:05:52 +09:00
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
Eugene Yokota 5398f6e1aa Make sbt new extensible
Problem
-------
`sbt new` (`sbt init`) hardcodes the templates, which I think is ok,
but without changing much, we can make it extensible.

Solution
--------
This adds two new keys `templateDescriptions` and `templateRunLocal`,
which can customize the behavior for in-house usage etc.
2023-06-18 15:48:18 -04:00
Ondra Pelech 9ec7c4f027 Dependency graph with colors (based on the organization) (#7052) 2023-06-17 02:29:48 +02:00
Krzysztof Atłasik 118138a0c8
Add new template to text-based menu (#7300) 2023-06-15 05:14:40 -04:00
eugene yokota c6bc422ea3
Merge pull request #7298 from adpi2/fix-7297 2023-06-14 08:56:06 -04:00
Adrien Piquerez a209cf2700 Fix #7297: Convert OffsetPosition to BSP range 2023-06-14 10:35:54 +02:00
adpi2 f692583034
Merge pull request #7295 from adpi2/fix-7288
Fix #7288: `publish` should not fail if `publish / skip := true`
2023-06-13 09:54:45 +02:00
eugene yokota e0d88607a5
Merge pull request #7294 from ckipp01/semanticDbUpdate
deps: bump the default semanticdb version used
2023-06-12 13:03:53 -04:00
Adrien Piquerez 783a8e57db Fix #7288 and implement publisM2 / skip 2023-06-12 18:06:06 +02:00
eugene yokota cfa88f766f
Merge pull request #7290 from mkurz/sbtn-1.9.0
sbtn 1.9.0
2023-06-12 10:49:49 -04:00
Chris Kipp 05ac9c88d1 deps: bump the default semanticdb version used
This updates semanticdb from 4.5.13 to 4.7.8.
2023-06-12 16:44:20 +02:00
Alex Klibisz b9cc499ec3
Fix typo in exportPipelining Key description 2023-06-07 13:21:00 -04:00
Matthias Kurz 7256fb2725
sbtn 1.9.0 2023-06-06 17:12:41 +02:00
Adrien Piquerez dd00e143f2 Fix #7285: use legacy Maven style on publishLocal 2023-06-05 21:24:20 +02:00
Eugene Yokota 7c7576843a Fix sbt init menu
Problem
-------
sbt init menu doesn't pick the right template in the latter half.

Solution
--------
This fixes the mapping between the position and the letter.
2023-06-01 22:45:51 -04:00
Eugene Yokota 1f1ee778e3 Update Scala to 2.12.18
Fixes https://github.com/sbt/sbt/issues/7235
2023-06-01 12:13:40 -04:00
eugene yokota babbdaeaa0
Merge pull request #7264 from eed3si9n/wip/diagnostic
Forward ScalaDiagnostic
2023-05-26 09:49:59 -04:00
Arman Bilge dc79c592cf Update typelevel toolkit, config test artifact 2023-05-22 21:53:09 +00:00
Eugene Yokota 93bd66b673 Forward ScalaDiagnostic
**Problem**
Zinc added actions in Problem, but it's not yet forwarded to BSP
clients.

**Solution**
As discussed in
https://contributors.scala-lang.org/t/roadmap-for-actionable-diagnostics/6172,
the plan seems to be to use the `data` field with `actions` inside it,
so this implements that.
2023-05-22 00:33:46 -04:00
Jakub Kozłowski f8a29b748b
Add weaver-cats as a default test framework (#7263)
Add weaver-cats as a default test framework
2023-05-21 23:28:04 -04:00
Matthew de Detrich e3c7bc7d8f
Deprecate itSettings 2023-05-22 00:14:29 +02:00
eugene yokota 26e9af13ec
Merge pull request #7240 from eed3si9n/wip/bannar
sbt 1.9.0 bannar
2023-05-07 14:41:01 -04:00
Eugene Yokota b122e292e5 Bump Typelevel toolkit 2023-05-07 14:18:18 -04:00
Eugene Yokota 731af0173c Add init as an alias to new 2023-05-07 14:17:26 -04:00
Eugene Yokota 2664884f37 sbt 1.9.0 bannar 2023-05-07 14:05:05 -04:00
Eugene Yokota 86ecec8ac3 sbt-giter8-resolver 0.16.2 2023-05-07 01:28:46 -04:00
Eugene Yokota 51591bde5b Make new more interactive
If the terminal supports ANSI control sequence,
this displays the template list in an interactive way.
The focused template is rendered reversed,
and arrow key can be used to move the focus up/down.
2023-05-06 20:07:47 -04:00
eugene yokota 3d1349a37d
Merge pull request #7234 from adpi2/fix-7233
[1.9.x] Fix #7233: copy artifact files of sbt plugin
2023-05-04 12:47:28 -04:00
Adrien Piquerez bb0bb5ce58 Fix #7233
The sbt-reproducible-build fails if  two artifacts point to the same file.

When packaging the artifacts of an sbt plugin,
we copy each files to avoid this issue.
2023-05-04 10:46:21 +02:00
Eugene Yokota 4c96c087c0 Fix typo 2023-05-03 21:20:16 -04:00
eugene yokota d8725e245e
Merge pull request #7228 from eed3si9n/wip/new
sbt new, a text-based adventure
2023-05-01 00:27:47 -04:00
Eugene Yokota a033c37d6e sbt new, a text-based adventure
**Problem**
You want to get started with sbt, and you don't know
which template to get started with.

**Solution**
This implements an interactive menu on `sbt new` command
when invoked without an argument to list template candidates.

The first option is `scala/toolkit.local`, which locally creates
an sbt build without calling out to Giter8 (GitHub).
2023-04-30 23:36:06 -04:00
Eugene Yokota f98c4fff3b Update modules 2023-04-30 00:56:11 -04:00
eugene yokota df738abbbd
Merge pull request #7215 from dragos/expose/external-hooks-public
Expose RunProfiler to the build
2023-04-25 11:49:28 -04:00
Iulian Dragos 6dfebc689b
Add a key for Zinc listeners.
Expose what the incremental compiler is doing behind the scenes. The RunProfiler interface has been part of Zinc for a while, but this allows the build itself, or an Sbt plugin, to hook their own implementation.

We expose a list of such listeners to avoid plugins stepping on each other and replacing an existing listener.
2023-04-25 12:00:02 +02:00
Iulian Dragos 9301bc2589
Make externalHooks public
This key has been added in 4061dabf4d but it is only available to Sbt itself. Since ExternalHooks is a Java interface, defined in Zinc for a while and fairly stable, I think this should be safe to do.

My main  motivation is to allow installing an InvalidationProfiler from an Sbt plugin, thus gaining access to zinc recompilation decisions. See related PR https://github.com/sbt/zinc/pull/1181
2023-04-18 15:13:09 +03:00
adpi2 e1b0b25418
Merge pull request #7201 from adpi2/sbt-plugin-toggle
[1.9.x] Add `sbtPluginPublishLegacyMavenStyle` to publish to Artifactory
2023-04-12 09:55:13 +02:00
Adrien Piquerez 9e0a728c58 Add sbtPluginPublishLegacyMavenStyle to publish to Artifactory
Artifactory rejects the legacy artifacts of sbt plugin.
It is now possible to publish to Artifactory
by turning `sbtPluginPublishLegacyMavenStyle` off.
2023-04-11 16:56:24 +02:00
Adrien Piquerez 5436ed5ef8 Fix cross-publish sbt plugin to Maven 2023-04-11 11:43:44 +02:00
eugene yokota 4a470dcd17
Merge pull request #7148 from armanbilge/feature/release-notes-url
Add `releaseNotesURL` setting
2023-03-07 10:37:46 -05:00
Matthew de Detrich 714e4175b3
Improve grammar on skip key description 2023-03-04 09:19:17 +01:00
Matthew de Detrich 2a332a56a9
Make skip work on publishLocal 2023-03-03 16:09:44 +01:00
Arman Bilge ed29e35f41 Bump lm, use release notes key 2023-02-28 06:08:13 +00:00
Adrien Piquerez 8020ec4d7c Smooth transition to valid Maven pattern of sbt plugin
For an sbt plugin, we publish two POM files, the legacy one, and the
new Maven compatible one. The name of the new POM file contains the sbt
cross-version _2.12_1.0. The format of the new POM file is also slightly
different, because we append the sbt cross-version to all artifactIds of
sbt plugins. Hence Maven can resolve the new sbt plugin POM and its
dependencies.

When resolving an sbt plugin, we first try to resolve the new Maven POM
and if it fails we fallback on the legacy one. When parsing the new POM
format, we remove the sbt cross-version from all artifact IDs so that
there is no mismatch between old and new format of dependencies.
2023-02-22 10:09:26 +01:00
Arman Bilge 11ea11e382
Fix
Co-authored-by: Marco Zühlke <mzuehlke@gmail.com>
2023-02-12 22:54:19 -08:00
Arman Bilge 3cde7f8e07 Missing comma 2023-02-12 23:27:14 +00:00
Arman Bilge 3ce8008ae7 WIP support for `releaseNotesURL` 2023-02-10 06:19:39 +00:00
Adrien Piquerez 9b4d5a5a5a Fix reporting Java diagnostics through BSP
Java diagnostics don't have a pointer but we should report them.
Copied implementation from Bloop to translate the position of an
xsbti.Problem to a BSP range.
2023-01-27 10:21:44 +01:00
Eugene Yokota b0b7705739 Fixes Debian 11 compat
Fixes https://github.com/sbt/sbt/issues/7118

Problem
-------
sbtn 1.8.1 was built using ubuntu-latest, which meant picking up newer
glibc.

Solution
--------
This downgraded the ubuntu machine to build sbtn.
2023-01-04 17:19:29 -05:00
Matthias Kurz ac638a764d
Use latest sbtn 2023-01-03 16:02:18 +01:00
Matthias Kurz 5fa46859d2
Make use of sbtn aarch64 binary where possible 2023-01-03 12:41:49 +01:00
Eugene Yokota 39dc13668f lm-coursier-shaded 2.0.12
https://github.com/coursier/sbt-coursier/releases/tag/v2.0.12
2022-10-30 18:25:04 -04:00
Nabil Abdel-Hafeez e7a847615a
Add zio-test TestFramework to default test frameworks 2022-10-16 22:42:53 +02:00
frosforever d366b77b23 Protect against missing edges in graph by using map get vs apply 2022-10-02 14:04:50 -04:00
Eugene Yokota 2a61fb35f9 Fix /tmp/.sbt/ collision for domain socket
Problem
-------
Fixes https://github.com/sbt/sbt/issues/7013
In a shared environment, multiple users will try to create
`/tmp/.sbt/` directory, and fail.

Solution
--------
Append a deterministic hash like `/tmp/.sbt1234ABCD` based
on the user home, so the same directory is used for the given
user, but each user would have a unique runtime directory.
2022-10-02 12:45:30 -04:00
eugene yokota f0cb420fe2
Merge pull request #7031 from gontard/backport_6903_to_1.8.x
Backport #6903 to 1.8.x
2022-09-30 11:43:20 -04:00
gontard cc44169fe0 Fix testQuick on changed function in object
Fix https://github.com/sbt/sbt/issues/5504
2022-09-30 11:25:31 +02:00
gontard 89acd3eed1 Improve log for not found remote cache artifact
Before
remote cache not found for 0.0.0-7c40144bd1c774e6

After
remote cache artifact not found for org.gontard:sbt-test:0.0.0-7c40144bd1c774e6 Some(cached-compile)
2022-09-30 11:07:20 +02:00
Eugene Yokota b00792a3a7 Scala 2.12.17
This bumps up scala-xml to 2.x.
2022-09-17 04:09:52 -04:00
Eugene Yokota 573cd2de81 Giter8 0.15.0 by default 2022-09-11 13:03:43 -04:00
Devin Fisher 9f9b08edbd refactor printing error to an in-function function 2022-08-10 10:08:49 -04:00
Devin Fisher 5874ad920e add output when book server socket fails to create 2022-08-10 10:08:42 -04:00
eugene yokota ab59e4c6ba
Merge pull request #6998 from ckipp01/captureCodeBsp
feat: start forwarding diagnosticCode via BSP
2022-08-10 10:03:40 -04:00
Chris Kipp 15a45cb3c0 feat: start forwarding diagnosticCode via BSP
This change is a continuation of the work that was done in
https://github.com/sbt/sbt/pull/6874 to allow the Scala 3 compiler to
forward the `diagnosticCode` of an error as well as the other normal
things. This change in dotty was merged in
https://github.com/lampepfl/dotty/pull/15565 and also backported so it
will be in the 3.2.x series release. This change captures the
`diagnosticCode` and forwards it on via BSP so that tools like Metals
can can use this code.

You can see this in the BSP trace now for a diagnostic:

For example with some code that contains the following:

```scala
val x: Int = "hi"
```

You'll see the code in the BSP diagnostic:
```  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 9,
          "character": 15
        },
        "end": {
          "line": 9,
          "character": 19
        }
      },
      "severity": 1,
      "code": "7",
      "source": "sbt",
      "message": "Found:    (\u001b[32m\"hi\"\u001b[0m : String)\nRequired: Int\n\nThe following import might make progress towards fixing the problem:\n\n  import sourcecode.Text.generate\n\n"
    }
  ]
```

Co-authored-by: Adrien Piquerez <adrien.piquerez@gmail.com>
Refs: https://github.com/lampepfl/dotty/issues/14904
2022-08-09 19:02:52 +02:00
Adrien Piquerez 634e8799e7 Catch ClosedChannelException in background job logger
We want the background job to stay alive even if its terminal
has been closed and we cannot write to it anymore
2022-08-05 14:45:38 +02:00
Adrien Piquerez 592086b889 Don't use ProxyTerminal in background job
If we use the ProxyTerminal in the background jobs, the logs
would be spread across different terminals, switching from active
client to active client. We want the logs to stick
to the client that started the job.
2022-08-04 16:48:13 +02:00
Adrien Piquerez 6bcda6684a Use BackgroundJobService context instead of MainLoop context
A new context is created and closed for each state of the MainLoop.
But the context of the backgroundJob must stay alive.
So we use a context that is owned by the BackgroundJobService.
It creates a new logger for each background job and cleans it when
the job stops.
2022-08-04 16:48:13 +02:00
Krzysztof Pado 2bffb2731e Add support for BSP's buildTarget/outputPaths method 2022-08-03 10:13:48 +02:00