Ensures that `buildTarget/compile` returns a `StatusCode.Error` instead
of a JSON-RPC error even when the compile error is buried deeper in the
`Incomplete` causes.
Fixes#8104
**Problem**
Compiler options for the compiler plugins ends up capturing the absolute path, specific to the machine.
**Solution**
This encodes the plugin paths as virtual paths.
**Problem**
Incremental test (aka testQuick) has a bug when companion objects
depends on others since at some point it's failing to look up relationship from Zinc analysis.
**Solution**
This fixes the lookup.
**Problem**
Incremental test (aka testQuick) has a bug when companion objects
depends on others since at some point it's failing to look up relationship from Zinc analysis.
**Solution**
This fixes the lookup.
**Problem**
sbt 1.10.10 still has retry problem with compilation.
**Solution**
Revert the retry logic back to the time when we only retried IOExceptions.
**Problem**
The error message uses name, which may not match the actual project id
that the user can type into the shell.
**Solution**
Use displayBuildRelative to calculate the proper subproject id.
**Problem**
`run` task has been emulated via function call inside of a sandboxed classloader,
and blocking the command processing of sbt server loop.
This poses isolation and availability issues.
**Solution**
This implements client-side run where the server creates a sandbox environment, and sends the information to the client,
and the client forks a new JVM to perform the run.
The client-side behavior has been implemented in sbtn side already.
**Problem**
When compilation fails, it's retrying 10 times
since Retry now retries on non-IOExceptions.
**Solution**
This adds CompileFailed to excluded exception list.
**Problem**
client-side run apparently won't work for Scala.JS,
so forcing sbtn users to client-side run will break the Scala.JS users.
**Solution**
This reverts the client-side run on sbt 1.x, while retaining the
mechanism for sbt 2.x usages via sbtn.
Now, if `run / connectInput := true` is true, stdout will not display on sbtn.
**Problem**
There are a few places where javaHome or java path is set,
using java.home system property. The problem is that it points to JRE,
not JDK, so it would break on Java compilation etc.
**Solution**
If the path ends with jre, go up one directory.
**Problem**
`run` task blocks the server, but during the run the server is just
waiting for the built program to finish.
**Solution**
This implements client-side run where the server creates a sandbox
environment, and sends the information to the client,
and the client forks a new JVM to perform the run.
**Problem**
semanticdbEnabled doesn't work on sbt 2.x
1. classes directory has changed during compilation
2. semanticdb scalacOptions are duplicated for Test
**Solution**
1. change to using the backend directory
2. reimplement scalacOptions handling
In `classifiersModuleTask` we now don't include the full plugin classpath, but include only the dependency classpath (effectively excluding sbt.PluginData.definitionClasspath). Only items from the dependency classpath are considered to be published. Only for them we can download classifier artifacts later in the `updateSbtClassifiers` pipeline.
This also fixes integration test "dependency-management/update-sbt-classifiers".
I also made the test stricter, it now tests the module ids that are included in the sbt classpath.
**Problem**
We changed the content of Chrome tracing file incorrectly
and renamed tid to tname.
**Solution**
1. This renames tname back to to tid.
2. To retain the fix to avoid Thread#getId, this calls
either the JDK 8 way or the JDK 19 way reflectively.
Add a `allowUnsafeScalaLibUpgrade` setting (default is `false`) to
demote the SIP-51 build failure to a warning.
If the scalaVersion is 2.13.12 but some dependency pulls in
scala-library 2.13.13, the compiler will stay at 2.13.12, but
the dependency classpath will contain scala-library 2.13.13.
This usually works, the compiler can run fine with a newer
scala-library on its dependency classpath.
Macro expansion may fail, if the macro uses some library
class / method that doesn't exist in the old version.
The macro itself is loaded from the dependency classpath
into the class loader running the compiler, where the older
Scala library is on the runtime classpath.
Using the Scala REPL in sbt may also fail in a similar fashion.
**Problem**
Currently sbtn doesn't correctly display the stdout
during `run` because by the time it starts the terminal has been reset.
**Solution**
Don't reset the terminal in-between the tasks.
**Problem**
JSON-RPC is currently full of terminal capability query
since JLine seems to be asking them for each line.
**Solution**
This caches the query.
**Problem**
BOM support current has perf issues.
**Solution**
This bumps Coursier to 2.1.22.
This also adds a new setting `csrMavenDependencyOverride`,
which will default to false.
**Problem**
There are a few places where javaHome or java path is set,
using java.home system property. The problem is that it points to JRE,
not JDK, so it would break on Java compilation etc.
**Solution**
If the path ends with jre, go up one directory.
**Problem**
`java.net.URL` calls out to the network to perform `equals`,
so we should remove that from anywhere that can be involved in caching etc.
**Solution**
This changes java.net.URL to java.net.URI in Keys.
**Problem**
Whether a subproject is root or not is currently detected by
comparing getCanonicalFile against the build base directory.
Problem is that often the root project uses "." as the directory,
and getting the canonical file works ok for the current build,
but it breaks when loading `ProjectRef`.
There might be other bugs related to the root project detection.
**Solution**
This factors out `isRootPath` function that's aware of the build base.
This PR adds the repro test prepared by xuwei-k.
**Problem**
Currently the following warning shows up while compiling metabuild:
[warn] Failed to parse `-Wconf` configuration: cat=unused-nowarn:s
[warn] unknown category: unused-nowarn
-Wconf:cat=unused-nowarn in general was added as a Scala 2.12 of
falsely warning about pure expression not doing anything in the macro.
**Solution**
We should be able to remove the -Wconf flag in sbt 2.x.
**Problem**
Slash syntax is currently implemented via a series of implicit
converters (Conversion), which is not nice, partly because
the behavior is difficult to follow.
**Solution**
This removes all the implicit converters and moves the slashes
into:
1. / methods under Reference for subproject scoping.
2. / methods under ScopeAxis with Reference type constraint
for the initial Zero scoping.
3. Return RefThenConfig structure for intermediate config scoping.
4. / method under `Scoped`, which is base trait for the keys
to implement task scoping e.g. `compile / scalacOptions`.
5. Extension methods for ConfigKey.
6. Extension methods for AttributeKey.
Problem
Currently Scala 3.x - 2.13 sandwich doesn't seem to work for projectMatrix.
This is due to isScala2Scala3Sandwich checking for "3." while projectMatrix
uses scalaBinaryVersion, which is 3.
Solution
This consolidates the implementation of isScala2Scala3Sandwich with the one
in Defaults module, and check for both "3" and "3."
To build the index of all aggregate keys, we were computing the reverse
aggregation of each key, before indexing them.
And so each aggregate key was indexed many times, once for each
aggregated project. It was parallelized to reduce the latency.
In this PR, we compute the reverse aggregation of all the keys at once,
removing all duplication. We cannot parallelize this process anymore
but we don't need to, because it is a lot faster. It reduces the total
CPU time by 12%. The impact for the user depends on its number of cores.