Commit Graph

130 Commits

Author SHA1 Message Date
Dmitrii Naumenko b83eee4528 [sonatype publishing] print deployment validation errors if present
Before this change you had to log into the sonatype account and search for the errors there.
(https://central.sonatype.com/publishing/deployments)
This was inconvenient, especially if you don't have the admin access to the account.
2025-08-04 15:03:53 +02:00
Jules Ivanic 8c0010a086
Review: the new configurable request timeout value should be `10.minutes` and should only be used for upload 2025-07-04 16:40:52 +04:00
Jules Ivanic 084ca08f34
Allow users to configure the timeout when publishing to the Maven Central repo 2025-07-02 13:53:50 +04:00
Leonidas Spyropoulos 1cd9c1ec64
fix: semanticdb expects Wildcard imports to be in the last position
Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
2025-06-11 08:57:07 +01:00
Eugene Yokota 929b0bf525 fix: Fix Sonatype publishing
**Problem**
1. query string wasn't passed in, so sonaRelease wasn't working
2. deployment name should be human readable

**Solution**
This fixes the query string passing by hand-crafting the URL.

This also generates human readable deployment name.
2025-05-18 15:25:27 -04:00
Eugene Yokota ff6ea5570b fix: Fix Central Portal status checking
**Problem**
It's supposed to be POST but I'm usin g GET, which results in 500.
2025-05-18 12:51:06 -04:00
Eugene Yokota d8813bc506 Sonatype Publish Portal support
**Problem**
Sonatype is sunsetting HTTP Rest endpoint OSSRH in June 2025.

**Solution**
This implements a built-in publishing mechanism.
Kudos to David Doyle who has spearheaded Sonatype Central support via sonatype-central-client etc.
2025-05-15 03:27:54 -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
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
Adrien Piquerez 0fef804b18 Fix #6738: register all forked process 2021-12-06 09:12:38 +01:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09: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 60890eb7d9
Update main-actions/src/main/scala/sbt/Sync.scala 2021-07-31 14:22:25 -04:00
eugene yokota 7efbbf2f34
Update main-actions/src/main/scala/sbt/Sync.scala 2021-07-31 14:07:25 -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
Adrien Piquerez ba73f87296 add scaladoc in EvalReporter 2021-07-12 09:28:39 +02:00
Adrien Piquerez 94cc9a84ac Fix mima binary issues 2021-07-08 09:25:01 +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
Josef Vlach 0c7bc71403
Instantiate only test runners needed by current TestDefinitions 2021-03-28 20:58:18 +01:00
Eugene Yokota d0f540aea1 Patch for unidoc 2021-03-08 22:41:19 -05:00
Eugene Yokota 22d12f6618 Use nowarn annotation 2021-02-06 22:31:47 -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 8f5759e48d Cross build to Scala 2.13 2021-01-10 20:24:05 -05:00
Ethan Atkins 2e208af7c1 Close jline 3 terminal when console exits
The jline 3 Terminal is an autocloseable and should be closed when we're
down with it. I'm not exactly sure what resources we were potentially
leaking, but the jline3term variable is an instance of the jline
AbstractTerminal class which I know can create a thread in some
circumstances. This came up while working on #6185.
2020-12-03 08:30:14 -08:00
Ethan Atkins 78620cd902 Manage ansi codes and color codes separately
The ConsoleAppender formatEnabledInEnv field was being used both as an
indicator that ansi codes were supported and that color codes are
enabled. There are cases in which general ansi codes are not supported
but color codes are and these use cases need to be handled separately.
To make things more explicit, this commit adds isColorEnabled and
isAnsiSupported to the Terminal companion object so that we can be more
specific about what the requirements are (general ansi escape codes or
just colors). There are a few cases in ConsoleAppender itself where
formatEnabledInEnv was used to set flags for both color and ansi codes.
When that is the case, we use Terminal.isAnsiSupported because when that
is true, colors should at least work but there are terminals that
support color but not general ansi escape codes.
2020-10-21 08:01:12 -07:00
Ethan Atkins d3f8cc8161 Kill external processes on sigint
On linux and mac, entering ctrl+c will automatically kill any forked
processes that were created by the sbt server because sigint is
automatically forwarded to the child process. This is not the case on
windows where it is necessary to forcibly kill these processes.
2020-08-23 10:15:07 -07:00
Eugene Yokota ff711f4719 Adjust to Zinc change 2020-08-15 13:20:46 -04:00
Ethan Atkins 90dacc339c Support scala 2.13 console in thin client
In order to make the console task work with scala 2.13 and the thin
client, we need to provide a way for the scala repl to use an sbt
provided jline3 terminal instead of the default terminal typically built
by the repl. We also need to put jline 3 higher up in the classloading
hierarchy to ensure that two versions of jline 3 are not loaded (which
makes it impossible to share the sbt terminal with the scala terminal).

One impact of this change is the decoupling of the version of
jline-terminal used by the in process scala console and the version
of jline-terminal specified by the scala version itself. It is possible
to override this by setting the `useScalaReplJLine` flag to true. When
that is set, the scala REPL will run in a fully isolated classloader. That
will ensure that the versions are consistent. It will, however, for sure
break the thin client and may interfere with the embedded shell ui.

As part of this work, I also discovered that jline 3 Terminal.getSize is
very slow. In jline 2, the terminal attributes were automatically cached with a
timeout of, I think, 1 second so it wasn't a big deal to call
Terminal.getAttributes. The getSize method in jline 3 is not cached and
it shells out to run a tty command. This caused a significant
performance regression in sbt because when progress is enabled, we call
Terminal.getSize whenever we log any messages. I added caching of
getSize at the TerminalImpl level to address this. The timeout is 1
second, which seems responsive enough for most use cases. We could also
move the calculation onto a background thread and have it periodically
updated, but that seems like overkill.
2020-08-09 17:12:15 -07:00
Eugene Yokota 002f97cae7 Build pipelining
Ref https://github.com/sbt/zinc/pull/744

This implements `ThisBuild / usePipelining`, which configures subproject pipelining available from Zinc 1.4.0.

The basic idea is to start subproject compilation as soon as pickle JARs (early output) becomes available. This is in part enabled by Scala compiler's new flags `-Ypickle-java` and `-Ypickle-write`.

The other part of magic is the use of `Def.promise`:

```
earlyOutputPing := Def.promise[Boolean],
```

This notifies `compileEarly` task, which to the rest of the tasks would look like a normal task but in fact it is promise-blocked. In other words, without calling full `compile` task together, `compileEarly` will never return, forever waiting for the `earlyOutputPing`.
2020-08-06 02:31:01 -04:00
Ethan Atkins eb88d523e0 Update sbt for latest zinc apis 2020-07-22 15:00:56 -07:00
Ethan Atkins 25e83d8fec Add Terminal.withRawOutput api
In the scala console, it's essential that we not process the bytes that
are written to the terminal by jline.
2020-07-10 13:37:54 -07:00
Ethan Atkins 1b03c9b1a9 Make Terminal a trait to support multiple clients
In order to support a multi-client sbt server ux, we need to factor
`Terminal` out into a class instead of a singleton. Each terminal provides
and outputstream and inputstream. In all of the places where we were
previously relying on the `Terminal` singleton we need to update the
code to use `Terminal.get`, which will redirect io to the terminal whose
command is currently running.

This commit does not implement the server side ui for network clients.
It is just preparatory work for the multi-client ui.

The Terminal implementations have thread safe access to the output
stream. For this reason, I had to remove the sychronization on the
ConsoleOut lockObject. There were code paths that led to deadlock when
synchronizing on the lockObject.
2020-06-24 19:22:57 -07:00
frosforever d1cf37b2ca Update Tests.Group to be bin compat by manually implementing case class methods 2020-05-04 09:29:31 -04:00
frosforever b2942f6321 Add user defined tags to Tests.Group 2020-05-04 09:29:31 -04:00
Ethan Atkins 7902ec3b7d Add Terminal abstraction
This commit aims to centralize all of the terminal interactions
throughout sbt. It also seeks to hide the jline implementation details
and only expose the apis that sbt needs for interacting with the
terminal.

In general, we should be able to assume that the terminal is in
canonical (line buffered) mode with echo enabled. To switch to raw mode
or to enable/disable echo, there are apis: Terminal.withRawSystemIn and
Terminal.withEcho that take a thunk as parameter to ensure that the
terminal is reset back to the canonical mode afterwards.
2020-05-01 12:35:43 -07:00
Eugene Yokota 3ce4d22b84 integrate with VirtualFile changes
Ref https://github.com/sbt/zinc/pull/712
2020-04-24 17:44:14 -04:00
Eugene Yokota b97de940a5 Make val loading order top-to-bottom
Fixes #2232

Within `build.sbt` this makes sure that definitions are ordered from top to bottom.
This matters when multiple subprojects refer to the same setting (probably not a good practice).
2020-02-22 04:45:34 -05:00
Ethan Atkins c5f0ee0e59 Don't use last modified time of directories in doc
I noticed that sbt does a _lot_ of no-op docs in the sbt project.
Through some debugging, I determined that this was because the target
directory last modified time of some of the dependent projects would
change between runs. I'm not really sure why that was happening but
instead of computing the last modified time of the directory, we should
be checking the last modified time of the directory contents.

After this change a no-op `doc` in the sbt project returns in less than
one second on my mac. Before, it was more like 25-60 seconds (the upper
bound is one runs `doc` because `sbtRoot/doc` takes about a minute).
2020-01-13 13:11:09 -08:00
Arnout Engelen ceb28a0a41 Target 1.4.0 2019-12-24 10:11:09 +01:00
Arnout Engelen 52b72a7e14 Target 1.4.0 2019-12-24 10:11:09 +01:00
Arnout Engelen 21533863da Don't emit timestamps when packaging to jar
This makes the build more deterministic.
2019-12-24 10:11:09 +01:00
Eugene Yokota 54b3405f42 apply -Yno-lub
To demonstrate [-Yno-lub](http://eed3si9n.com/stricter-scala-with-ynolub), this shows the code changes that removes lubing (Not all subprojects are done).

After I made the changes, I switched the Scala back to normal 2.12.10.
2019-10-13 23:46:23 -04:00
Ethan Atkins 7c2a1c858b 1.3.0
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJdbz/aAAoJEDeJDimNmiv6Am8IAKv23f6BPIWZFeokzJLkUt8v
 DDLyzIwzE0hTFKInCNhGDCFtACFFgoD8/7t9D5gmLttQr4F9ke94DqWBEP3kbgan
 Qb4rR8uwglPUJmOhzBj2Qs3A8fAXdg3wm/6OlllQzBwCYNxFf3MhmJc3hF4vd+jO
 93JqwbY50entqha9z299+NpLPTKWtVC5R+1pAF+LwObjLOYqlxiGvAcl7jWx1qte
 VN+BabBYT4Hw43kJCutglHu8vttG68m+fqYGxjAmZXYBAbn0NPyE7GHmqkQ5baAz
 DUbc0vU2nY6tpUFNlNfu9PTPnRwHdSjSJTa9Ug7hw24z2oTg2tapNDXIpt6n6ZA=
 =onwH
 -----END PGP SIGNATURE-----

Merge tag 'v1.3.0' into 1.3.x-merge

1.3.0
2019-09-05 10:15:41 -07:00
Ethan Atkins b996675c93 Name test tasks with the test name
Ref https://github.com/sbt/sbt/issues/4911. This names each parallel
test task with the name of the task so that supershell can display it.
It only applies for parallel tests. When run sequentially, supershell
will still display executeTests.
2019-09-02 14:58:49 -07:00
xuwei-k dfe789d7c6 avoid deprecated /: and :\
use foldLeft and foldRight

https://github.com/scala/scala/blob/v2.13.0/src/library/scala/collection/IterableOnce.scala#L682-L686
2019-08-30 11:20:53 +09:00
Eugene Yokota 9512a60fa6 Fix java.util.zip.ZipException: duplicate entry
Fixes #4889

#4329 switched from using Map to Seq during packaging. That allowed multiple files to be included with different paths, but it also started admitting duplicate files causing ZipException.
2019-07-23 01:28:32 -04:00
Ethan Atkins a3ac4c76a6 Bump scalafmt
Intellij had issues resolving 2.0.0-RCX so it will be nice to be using
the latest.
2019-07-18 12:40:21 -07:00
Akhtyam Sakaev 3ea9f8a71b
fix typo 2019-06-06 08:05:16 +03:00
Ethan Atkins 2deac62b00 Bump io
The newest version of io repackages a number of classes into the
sbt.nio.* packages. It also changes some of the semantics of glob
related apis. This commit updates all of the usages of the updated apis
within sbt but should have no functional difference.
2019-05-02 14:33:01 -07:00
Eugene Yokota 1e157b991a apply formatting 2019-04-20 03:23:54 -04:00