Commit Graph

3022 Commits

Author SHA1 Message Date
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
Ethan Atkins 5c508e4275 Fix waitWatch failure handling
The waitWatch command is very similar to shell in that it should
override the onFailure command to be itself. It also enqueues itself to
remaining commands whenever it reads a new command which made it
unnecessary to append waitWatch to the runCommmand in Continuous.
2020-11-25 14:54:13 -08:00
eugene yokota 1051690d61
Merge pull request #5515 from jtjeferreira/better_file_input
introduce a new Input/Output: FileInput/FileOutput
2020-11-25 11:11:04 -05:00
João Ferreira dd411cac9f introduce a new new Input/Output: FileInput/FileOutput
* FileInput avoids the intermediate String parsing of PlainInput
* FileOuput also avoid the intermediate String representation of PlainOutput
2020-11-25 14:04:56 +00:00
Ethan Atkins c6ab4d843e Fix watch shell option
When a user returns to the shell with 's' in recent versions of sbt, the
prompt is not initially displayed. This ends up being because MainLoop
was incorrectly setting the terminal prompt to Prompt.Watch when it
exited watch. I realized in debugging the issue that it didn't make
sense to restort the terminal prompt to the initial value before task
evaluation. By removing that logic, the 's' option option started
working correctly again.
2020-11-23 14:25:11 -08:00
Ethan Atkins ab2875e837 Use jni implementation of ipcsocket apis on arm macs
There isn't yet a version of the jna available that works with the new
apple silicon using arm64. To workaround this, we can use the jni
implementation by default on arm64 macs. If the user wants to force the
jni implementation for any supported platform, they can opt in with the
`sbt.ipcsocket.jni` system property and/or by setting the serverUseJni
setting.
2020-11-23 12:31:15 -08:00
Ethan Atkins a9957e5d73 Make the thin client `cancel` command work reliably
When the sbt server is running a task, it presents all connected clients
with a message that instructs them that they cancel the running task.
Unfortunately, this often didn't work and the task would keep running
after cancel was entered. The reason for this was because the exec id
passed in to NetworkChannel did not necessarily match the exec id of the
running task. Because cancel in this case is not really exec specific,
this commit adds a flag to NetworkChannel.cancel that forces it to
cancel the running task regardless of what execID is passed in.
2020-11-23 10:05:47 -08:00
Eugene Yokota 00265bf912 Work around "a pure expression does nothing" warning, take 2
In https://github.com/sbt/sbt/pull/5981 I tried to work around the spruious post-macro "a pure expression does nothing" warning (https://github.com/scala/bug/issues/12112) by trying to remove some pure-looking expressions out of the tree.

This quickly backfired when it was reported that sbt 1.4.3 was not evaluating some code. This backs out the macro-level manipulation, and instead try to silence the warning at the reporter level. This feels safer, and it seems to work just as well.
2020-11-22 17:04:19 -05:00
Eugene Yokota bd7a2e05bf Use `Global / localCacheDirectory` for remote caching
Fixes https://github.com/sbt/sbt/issues/6102

https://github.com/sbt/sbt/pull/6026 changed the implementation of remote cache to NOT use dependency resolution (Coursier), and directly use Ivy resolver for efficiency. This was good, but when I made the change, I've changed the cache directory to be `crossTarget.value / "remote-cache"`. This was ok for local testing purpose, but not great for real usage since we don't want the cache to be wiped out either in the CI machines or on a local laptop.

This adds a new Global key called `localCacheDirectory`. Similar to Coursier cache, this is meant to be shared across all builds running on a machine. Also similar to Coursier cache this will try to follow the operating system specifc caching directory.

### localCacheDirectory location

- Environment variable: `SBT_LOCAL_CACHE`
- System property: `sbt.global.localcache`
- Windows: %LOCALAPPDATA%\sbt\v1
- macOS: $HOME/Library/Caches/sbt/v1
- Linux: $HOME/.cache/sbt/v1
2020-11-22 14:35:20 -05:00
eugene yokota f4f8b6a97e
Merge pull request #6151 from eatkins/scripted-batch-execution
Only set scriptedBatchExcution true for >= 1.4
2020-11-21 13:41:01 -05:00
Ethan Atkins d686bead0b Only set scriptedBatchExcution true for >= 1.4
In #6091, we updated the ScriptedPlugin to set scriptedBatchExecution :=
true for all 1.x versions but not 0.13. This commit further restricts
the setting so that it is only set for sbt >= 1.4, which seems necessary
based on the comments in #6094.
2020-11-21 08:31:49 -08:00