Merge pull request #7554 from sbt/wip/merge-1.10.x

[2.x] merge 1.10.x
This commit is contained in:
eugene yokota 2024-06-09 22:38:04 -04:00 committed by GitHub
commit e6db18f5c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
731 changed files with 5373 additions and 3741 deletions

View File

@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-20.04
java: 17
distribution: temurin
jobtype: 1
@ -41,8 +41,8 @@ jobs:
distribution: adopt
jobtype: 7
- os: macos-12
java: 8
distribution: adopt
java: 17
distribution: temurin
jobtype: 8
- os: windows-2019
java: 8
@ -59,168 +59,168 @@ jobs:
JDK11: adopt@1.11.0-9
SPARK_LOCAL_IP: "127.0.0.1"
steps:
- name: Checkout sbt/sbt
uses: actions/checkout@v3
- name: Checkout sbt/io
uses: actions/checkout@v3
with:
repository: sbt/io
ref: develop
path: io
- name: Checkout sbt/librarymanagement
uses: actions/checkout@v3
with:
repository: sbt/librarymanagement
ref: develop
path: librarymanagement
- name: Checkout sbt/zinc
uses: actions/checkout@v3
with:
repository: sbt/zinc
ref: wip/sbt-2.x
path: zinc
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Coursier cache
uses: coursier/cache-action@v6
# - name: Cache sbt
# uses: actions/cache@v3
# with:
# path: ~/.sbt
# key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2019' }}
- name: Pre-test cleanup
shell: bash
run: |
rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
- name: Publish local Zinc
shell: bash
run: |
./sbt -v lowerUtils/publishLocal
cd zinc/
sbt publishLocal
- name: Build and test (1)
if: ${{ matrix.jobtype == 1 }}
shell: bash
run: |
rm -rf "$HOME/.sbt/boot/" || true
# ./sbt -v --client mimaReportBinaryIssues
./sbt -v --client javafmtCheck
./sbt -v --client "Test/javafmtCheck"
./sbt -v --client scalafmtCheckAll
./sbt -v --client scalafmtSbtCheck
./sbt -v --client serverTestProj/scalafmtCheckAll
# ./sbt -v --client headerCheck
# ./sbt -v --client "Test/headerCheck"
./sbt -v --client "Test/compile"
./sbt -v --client publishLocal
./sbt -v --client test
./sbt -v --client "serverTestProj/test"
# ./sbt -v --client doc
./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.13.x
./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.12.x
./sbt -v --client "all $UTIL_TESTS"
- name: Build and test (2)
if: ${{ matrix.jobtype == 2 }}
shell: bash
run: |
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* classloader-cache/* package/*"
# ./sbt -v "scripted watch/*"
- name: Build and test (3)
if: ${{ matrix.jobtype == 3 }}
shell: bash
run: |
# ./sbt -v "dependencyTreeProj/publishLocal; scripted dependency-graph/*"
./sbt -v --client "scripted dependency-management/* project-load/* java/* run/*"
# ./sbt -v --client "scripted plugins/*"
# ./sbt -v --client "scripted nio/*"
- name: Build and test (4)
if: ${{ matrix.jobtype == 4 }}
shell: bash
run: |
# ./sbt -v "repoOverrideTest:scripted dependency-management/*"
./sbt -v "scripted source-dependencies/*"
# ./sbt -v "scripted project/*"
- name: Build and test (5)
if: ${{ matrix.jobtype == 5 }}
shell: bash
run: |
./sbt -v --client test
./sbt -v --client "++2.13.x; all $UTIL_TESTS"
./sbt -v --client "++2.12.x; all $UTIL_TESTS"
# - name: Build and test (6)
# if: ${{ matrix.jobtype == 6 }}
# shell: bash
# run: |
# # build from fresh IO, LM, and Zinc
# BUILD_VERSION="1.5.0-SNAPSHOT"
# cd io
# sbt -v -Dsbt.build.version=${BUILD_VERSION} +publishLocal
# cd ../
# sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal"
# rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
# sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; all $UTIL_TESTS; ++$SCALA_212; all $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*"
- name: Build and test (7)
if: ${{ matrix.jobtype == 7 }}
shell: bash
run: |
# test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package
sbt -Dsbt.build.version=$TEST_SBT_VER rpm:packageBin debian:packageBin
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test
cd citest && ./test.sh
$HOME/bin/jabba install $JDK11 && exec $HOME/bin/jabba which --home $JDK11
java -Xmx32m -version
./test.sh
- name: Build and test (8)
if: ${{ matrix.jobtype == 8 }}
shell: bash
run: |
# test building sbtn on macOS
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8, test using JDK 8, on macOS
cd launcher-package
bin/coursier resolve
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test
cd citest && ./test.sh
- name: Build and test (9)
if: ${{ matrix.jobtype == 9 }}
shell: bash
run: |
# test building sbtn on Windows
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8, test using JDK 8, on Windows
cd launcher-package
bin/coursier.bat resolve
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test
cd citest
./test.bat
test3/test3.bat
- name: Cleanup
shell: bash
run: |
rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
- name: Checkout sbt/sbt
uses: actions/checkout@v4
- name: Checkout sbt/io
uses: actions/checkout@v4
with:
repository: sbt/io
ref: develop
path: io
- name: Checkout sbt/librarymanagement
uses: actions/checkout@v4
with:
repository: sbt/librarymanagement
ref: develop
path: librarymanagement
- name: Checkout sbt/zinc
uses: actions/checkout@v4
with:
repository: sbt/zinc
ref: wip/sbt-2.x
path: zinc
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Coursier cache
uses: coursier/cache-action@v6
# - name: Cache sbt
# uses: actions/cache@v3
# with:
# path: ~/.sbt
# key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2019' }}
- name: Pre-test cleanup
shell: bash
run: |
rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
- name: Publish local Zinc
shell: bash
run: |
./sbt -v lowerUtils/publishLocal
cd zinc/
sbt publishLocal
- name: Build and test (1)
if: ${{ matrix.jobtype == 1 }}
shell: bash
run: |
rm -rf "$HOME/.sbt/boot/" || true
# ./sbt -v --client mimaReportBinaryIssues
./sbt -v --client javafmtCheck
./sbt -v --client "Test/javafmtCheck"
./sbt -v --client scalafmtCheckAll
./sbt -v --client scalafmtSbtCheck
./sbt -v --client serverTestProj/scalafmtCheckAll
# ./sbt -v --client headerCheck
# ./sbt -v --client "Test/headerCheck"
./sbt -v --client "Test/compile"
./sbt -v --client publishLocal
./sbt -v --client test
./sbt -v --client "serverTestProj/test"
# ./sbt -v --client doc
./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.13.x
./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.12.x
./sbt -v --client "all $UTIL_TESTS"
- name: Build and test (2)
if: ${{ matrix.jobtype == 2 }}
shell: bash
run: |
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* classloader-cache/* package/*"
# ./sbt -v "scripted watch/*"
- name: Build and test (3)
if: ${{ matrix.jobtype == 3 }}
shell: bash
run: |
# ./sbt -v "dependencyTreeProj/publishLocal; scripted dependency-graph/*"
./sbt -v --client "scripted dependency-management/* project-load/* java/* run/*"
# ./sbt -v --client "scripted plugins/*"
# ./sbt -v --client "scripted nio/*"
- name: Build and test (4)
if: ${{ matrix.jobtype == 4 }}
shell: bash
run: |
# ./sbt -v "repoOverrideTest:scripted dependency-management/*"
./sbt -v "scripted source-dependencies/*"
# ./sbt -v "scripted project/*"
- name: Build and test (5)
if: ${{ matrix.jobtype == 5 }}
shell: bash
run: |
./sbt -v --client test
./sbt -v --client "++2.13.x; all $UTIL_TESTS"
./sbt -v --client "++2.12.x; all $UTIL_TESTS"
# - name: Build and test (6)
# if: ${{ matrix.jobtype == 6 }}
# shell: bash
# run: |
# # build from fresh IO, LM, and Zinc
# BUILD_VERSION="1.5.0-SNAPSHOT"
# cd io
# sbt -v -Dsbt.build.version=${BUILD_VERSION} +publishLocal
# cd ../
# sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal"
# rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
# sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; all $UTIL_TESTS; ++$SCALA_212; all $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*"
- name: Build and test (7)
if: ${{ matrix.jobtype == 7 }}
shell: bash
run: |
# test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package
sbt -Dsbt.build.version=$TEST_SBT_VER rpm:packageBin debian:packageBin
sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
cd citest && ./test.sh
$HOME/bin/jabba install $JDK11 && exec $HOME/bin/jabba which --home $JDK11
java -Xmx32m -version
./test.sh
- name: Build and test (8)
if: ${{ matrix.jobtype == 8 }}
shell: bash
run: |
# test building sbtn on macOS
./sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
cd launcher-package
bin/coursier resolve
../sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
# This fails due to the JLine issue
# cd citest && ./test.sh
- name: Build and test (9)
if: ${{ matrix.jobtype == 9 }}
shell: bash
run: |
# test building sbtn on Windows
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8, test using JDK 8, on Windows
cd launcher-package
bin/coursier.bat resolve
sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
cd citest
./test.bat
test3/test3.bat
- name: Cleanup
shell: bash
run: |
rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true

24
.github/workflows/cla.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Scala CLA
on: [pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check CLA
env:
AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
echo "Pull request submitted by $AUTHOR";
signed=$(curl -s "https://www.lightbend.com/contribute/cla/scala/check/$AUTHOR" | jq -r ".signed");
if [ "$signed" = "true" ] ; then
echo "CLA check for $AUTHOR successful";
else
echo "CLA check for $AUTHOR failed";
echo "Please sign the Scala CLA to contribute to the Scala compiler.";
echo "Go to https://www.lightbend.com/contribute/cla/scala and then";
echo "comment on the pull request to ask for a new check.";
echo "";
echo "Check if CLA is signed: https://www.lightbend.com/contribute/cla/scala/check/$AUTHOR";
exit 1;
fi;

View File

@ -2,7 +2,7 @@
name: Submit Dependency Graph
on:
push:
branches: [1.7.x] # default branch of the project
branches: [1.9.x] # default branch of the project
permissions: {}
jobs:
submit-graph:
@ -12,5 +12,5 @@ jobs:
name: Submit Dependency Graph
runs-on: ubuntu-latest # or windows-latest, or macOS-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: scalacenter/sbt-dependency-submission@v2

23
.github/workflows/lock-thread.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: 'Lock Threads'
on:
schedule:
# once a week on Saturday
- cron: '0 1 * * 6'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
discussions: write
concurrency:
group: lock-threads
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
process-only: "issues"

View File

@ -15,34 +15,36 @@ jobs:
include:
- os: ubuntu-latest
java: 8
distribution: adopt
runs-on: ${{ matrix.os }}
env:
JAVA_OPTS: -Xms800M -Xmx800M -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
steps:
- name: Checkout sbt/sbt
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout sbt/io
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: sbt/io
ref: develop
path: io
- name: Checkout sbt/librarymanagement
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: sbt/librarymanagement
ref: develop
path: librarymanagement
- name: Checkout sbt/zinc
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: sbt/zinc
ref: develop
path: zinc
- name: Setup
uses: olafurpg/setup-scala@v13
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: "adopt@1.${{ matrix.java }}"
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Build and deploy

12
.github/workflows/winget.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: Publish to WinGet
on:
release:
types: [released]
jobs:
publish:
runs-on: windows-latest # action can only be run on windows
steps:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: sbt.sbt
token: ${{ secrets.WINGET_TOKEN }}

View File

@ -98,34 +98,6 @@ Pull Requests
See below for the branch to work against.
### Adding notes
Most pull requests should include a "Notes" file which documents the change. This file should reside in the
directory:
<sbt root>
notes/
<target release>/
<your-change-name>.md
Notes files should have the following contents:
* Bullet item description under one of the following sections:
- `### Bug fixes`
- `### Improvements`
- `### Fixes with compatibility implications`
* Complete section describing new features.
### Clean history
Make sure you document each commit and squash them appropriately. You can use the following guides as a reference:
* Scala's documentation on [Git Hygiene](https://github.com/scala/scala/tree/v2.12.0-M3#git-hygiene)
* Play's documentation on [Working with Git](https://www.playframework.com/documentation/2.4.4/WorkingWithGit#Squashing-commits)
Build from source
-----------------
See [DEVELOPING](./DEVELOPING.md)
Profiling sbt
@ -133,27 +105,13 @@ Profiling sbt
See [PROFILING](./PROFILING.md)
Other notes for maintainers
---------------------------
### Publishing VS Code Extensions
Reference https://code.visualstudio.com/docs/extensions/publish-extension
```
$ sbt
> vscodePlugin/compile
> exit
cd vscode-sbt-scala/client
# update version number in vscode-sbt-scala/client/package.json
$ vsce package
$ vsce publish
```
Other notes
-----------
## Signing the CLA
Contributing to sbt requires you or your employer to sign the
[Lightbend Contributor License Agreement](https://www.lightbend.com/contribute/cla).
[Scala Contributor License Agreement](https://www.lightbend.com/contribute/cla/scala).
To make it easier to respect our license agreements, we have added an sbt task
that takes care of adding the LICENSE headers to new files. Run `headerCreate`

View File

@ -7,15 +7,15 @@ Create a [fork](https://docs.github.com/en/github/getting-started-with-github/fo
### Branch to work against
sbt uses **two or three** branches for development:
Generally the default branch set on Github is what we recommend as the base line for PRs.
sbt uses two or three branches for development:
Use the **default** branch set on Github for bug fixes.
- Next minor branch: `1.$MINOR.x`, where `$MINOR` is next minor version (e.g. `1.9.x` during 1.8.x series)
- Next minor branch: `1.$MINOR.x`, where `$MINOR` is next minor version (e.g. `1.10.x` during 1.9.x series)
- Development branch: `develop`
- Stable branch: `1.$MINOR.x`, where `$MINOR` is current minor version (e.g. `1.8.x` during 1.8.x series)
- Stable branch: `1.$MINOR.x`, where `$MINOR` is current minor version (e.g. `1.9.x` during 1.9.x series)
Currently `develop` branch represents the next major version of sbt, i.e. sbt 2.
Next minor branch is where new features can be added as long as it is binary compatible with sbt 1.0.
The `develop` branch represents sbt 2.x, the next major sbt series.
Next minor branch is where new features should be added as long as it is binary compatible with sbt 1.x.
The `stable` branch represents the current stable sbt release. Only bug fixes are back-ported to the stable branch.
### Instruction to build just sbt
@ -96,7 +96,7 @@ In order to see a change you've made to sbt's source code, this cache should be
By default sbt uses a snapshot version (this is a scala convention for quick local changes- it tells users that this version could change).
One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers.
This is important when testing perfomance, so that the slowness of the resolution does not impact sbt.
This is important when testing performance, so that the slowness of the resolution does not impact sbt.
You can workaround that by using a version name like `1.$MINOR.$PATCH-LOCAL1`.
A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanCache` task.
@ -167,6 +167,13 @@ command. To run a single test, such as the test in
### Random tidbits
### Clean history
Make sure you document each commit and squash them appropriately. You can use the following guides as a reference:
* Scala's documentation on [Git Hygiene](https://github.com/scala/scala/tree/v2.12.0-M3#git-hygiene)
* Play's documentation on [Working with Git](https://www.playframework.com/documentation/2.4.4/WorkingWithGit#Squashing-commits)
#### Import statements
You'd need alternative DSL import since you can't rely on sbt package object.

View File

@ -187,7 +187,8 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2011 - 2018, Lightbend, Inc.
Copyright (c) 2023, Scala Center
Copyright (c) 2011 - 2022, Lightbend, Inc.
Copyright (c) 2008 - 2010, Mark Harrah
Licensed under the Apache License, Version 2.0 (the "License");

3
NOTICE
View File

@ -1,5 +1,6 @@
sbt
Copyright 2011 - 2017, Lightbend, Inc.
Copyright 2023, Scala center
Copyright 2011 - 2022, Lightbend, Inc.
Copyright 2008 - 2010, Mark Harrah
Licensed under Apache v2 license (see LICENSE)

View File

@ -1,20 +1,10 @@
[ask]: https://stackoverflow.com/questions/ask?tags=sbt
[Lightbend]: https://www.lightbend.com/
[subscriptions]: https://www.lightbend.com/platform/subscription
[gitter]: https://gitter.im/sbt/sbt
Support
=======
[Lightbend] sponsors sbt and encourages contributions from the active community. Enterprises can adopt it for mission critical systems with confidence because Lightbend stands behind sbt with commercial support and services.
For community support please [ask] on StackOverflow with the tag "sbt" (and the name of the sbt plugin(s) if any).
- State the problem or question clearly and provide enough context. Code examples and `build.sbt` are often useful when appropriately edited.
- There's also [Gitter sbt/sbt room][gitter], but Stackoverflow is recommended so others can benefit from the answers.
For professional support, for instance if you need faster response times, [Lightbend], the maintainer of Scala compiler and sbt, provides:
- [Lightbend Subscriptions][subscriptions], which includes Expert Support
- Training
- Consulting

View File

@ -4,6 +4,7 @@ import com.typesafe.tools.mima.core.ProblemFilters._
import com.typesafe.tools.mima.core._
import local.Scripted
import java.nio.file.{ Files, Path => JPath }
import java.util.Locale
import scala.util.Try
@ -47,7 +48,7 @@ ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml"
Global / semanticdbEnabled := !(Global / insideCI).value
// Change main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala too, if you change this.
Global / semanticdbVersion := "4.5.13"
Global / semanticdbVersion := "4.7.8"
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID
@ -59,7 +60,8 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
headerLicense := Some(
HeaderLicense.Custom(
"""|sbt
|Copyright 2011 - 2018, Lightbend, Inc.
|Copyright 2023, Scala center
|Copyright 2011 - 2022, Lightbend, Inc.
|Copyright 2008 - 2010, Mark Harrah
|Licensed under Apache License 2.0 (see LICENSE)
|""".stripMargin
@ -69,6 +71,7 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
componentID := None,
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
testFrameworks += TestFramework("verify.runner.Framework"),
Global / concurrentRestrictions += Util.testExclusiveRestriction,
@ -172,6 +175,9 @@ def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[_]] = Def settings
exclude[DirectMissingMethodProblem]("sbt.PluginData.apply"),
exclude[DirectMissingMethodProblem]("sbt.PluginData.copy"),
exclude[DirectMissingMethodProblem]("sbt.PluginData.this"),
exclude[IncompatibleResultTypeProblem]("sbt.EvaluateTask.executeProgress"),
exclude[DirectMissingMethodProblem]("sbt.Keys.currentTaskProgress"),
exclude[IncompatibleResultTypeProblem]("sbt.PluginData.copy$default$10")
),
)
@ -183,11 +189,11 @@ lazy val sbtRoot: Project = (project in file("."))
minimalSettings,
onLoadMessage := {
val version = sys.props("java.specification.version")
""" __ __
""" __ __
| _____/ /_ / /_
| / ___/ __ \/ __/
| (__ ) /_/ / /_
| /____/_.___/\__/
| (__ ) /_/ / /_
| /____/_.___/\__/
|Welcome to the build for sbt.
|""".stripMargin +
(if (version != "1.8")
@ -201,7 +207,6 @@ lazy val sbtRoot: Project = (project in file("."))
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
Util.publishPomSettings,
otherRootSettings,
Transform.conscriptSettings(bundledLauncherProj),
publish := {},
publishLocal := {},
publish / skip := true,
@ -363,7 +368,7 @@ lazy val utilLogging = project
disruptor,
sjsonNewScalaJson.value,
),
libraryDependencies ++= Seq(scalacheck % "test", scalatest % "test"),
testDependencies,
Compile / generateContrabands / contrabandCodecsDependencies := List(sjsonNewCore.value),
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
Compile / managedSourceDirectories +=
@ -374,6 +379,7 @@ lazy val utilLogging = project
if (name == "Throwable") Nil
else old(tpe)
},
Test / fork := true,
utilMimaSettings,
mimaBinaryIssueFilters ++= Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.util.SuccessEvent.copy*"),
@ -404,6 +410,7 @@ lazy val utilLogging = project
exclude[MissingTypesProblem]("sbt.internal.util.ConsoleAppender"),
exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"),
exclude[MissingClassProblem]("sbt.internal.util.Terminal$BlockingInputStream$"),
exclude[IncompatibleResultTypeProblem]("sbt.util.LoggerContext#Log4JLoggerContext.loggers"),
),
)
.configure(addSbtIO)
@ -1056,6 +1063,10 @@ lazy val serverTestProj = (project in file("server-test"))
)
val isWin = scala.util.Properties.isWin
val isLinux = scala.util.Properties.isLinux
val isArmArchitecture: Boolean = sys.props
.getOrElse("os.arch", "")
.toLowerCase(Locale.ROOT) == "aarch64"
val buildThinClient =
inputKey[JPath]("generate a java implementation of the thin client")
// Use a TaskKey rather than SettingKey for nativeInstallDirectory so it can left unset by default
@ -1077,6 +1088,7 @@ lazy val sbtClientProj = (project in file("client"))
nativeImageReady := { () =>
()
},
nativeImageVersion := "22.2.0",
nativeImageOutput := target.value / "bin" / "sbtn",
nativeImageOptions ++= Seq(
"--no-fallback",

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -16,6 +16,7 @@
{"pattern":"org/jline/utils/screen.caps"},
{"pattern":"library.properties"},
{"pattern":"darwin/x86_64/libsbtipcsocket.dylib"},
{"pattern":"linux/aarch64/libsbtipcsocket.so"},
{"pattern":"linux/x86_64/libsbtipcsocket.so"},
{"pattern":"win32/x86_64/sbtipcsocket.dll"}
]

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,4 +1,13 @@
package sbt.internal.util.appmacro
/*
* sbt
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.internal.util
package appmacro
import scala.compiletime.summonInline
import scala.quoted.*

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -8,11 +9,14 @@
package sbt
package plugins
import scala.annotation.nowarn
object DependencyTreePlugin extends AutoPlugin {
object autoImport extends DependencyTreeKeys
override def trigger = AllRequirements
override def requires = MiniDependencyTreePlugin
@nowarn
val configurations = Vector(Compile, Test, IntegrationTest, Runtime, Provided, Optional)
// MiniDependencyTreePlugin provides baseBasicReportingSettings for Compile and Test

View File

@ -1,4 +1,5 @@
sbt: Completion Component
Copyright 2011 - 2017, Lightbend, Inc.
Copyright 2023, Scala center
Copyright 2011 - 2022, Lightbend, Inc.
Copyright 2008 - 2010, Mark Harrah
Licensed under BSD-3-Clause license (see LICENSE)

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -82,7 +83,7 @@ class FileExamplesTest extends UnitSpec {
def prefixedPathsOnly: List[String] =
allRelativizedPaths
.filter(_ startsWith withCompletionPrefix)
.withFilter(_ startsWith withCompletionPrefix)
.map(_ substring withCompletionPrefix.length)
def createSampleDirStructure(tempDir: File): Unit = {
@ -91,8 +92,8 @@ class FileExamplesTest extends UnitSpec {
nestedFiles = toChildFiles(childDirectories(1), List("farfile1", "barfile2"))
nestedDirectories = toChildFiles(childDirectories(1), List("fardir1", "bardir2"))
(childDirectories ++ nestedDirectories).map(_.mkdirs())
(childFiles ++ nestedFiles).map(_.createNewFile())
(childDirectories ++ nestedDirectories).foreach(_.mkdirs())
(childFiles ++ nestedFiles).foreach(_.createNewFile())
baseDir = tempDir
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -0,0 +1,33 @@
/*
* sbt
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package xsbti;
import java.util.Optional;
/**
* An Action is very miminal representation of a `CodeAction` in the LSP protocol.
*
* <p>However it only focuses on the actual title, description, and edit, leaving it up to the
* language server to communicate with the client and put together a proper codeAction in accordance
* to client capabilities.
*
* @see <a href=
* "https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction">`CodeAction`</a>
*/
public interface Action {
/** Title of the action that will be shown to the user client side. */
String title();
/** Optional description that may be shown to the user client side to explain the action. */
Optional<String> description();
/** The actual edit contained in the action. */
WorkspaceEdit edit();
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -11,6 +12,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
// Note: Update InterfaceUtil.scala as well.
public interface Problem {
String category();
@ -39,13 +42,44 @@ public interface Problem {
return Optional.empty();
}
/** @deprecated use {@link #diagnosticRelatedInformation()} instead. */
@Deprecated
default List<DiagnosticRelatedInformation> diagnosticRelatedInforamation() {
return diagnosticRelatedInformation();
}
/**
* The possible releated information for the diagnostic being reported.
*
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala
* versions that do not have the concept of "related information".
*/
default List<DiagnosticRelatedInformation> diagnosticRelatedInforamation() {
default List<DiagnosticRelatedInformation> diagnosticRelatedInformation() {
return Collections.emptyList();
}
/**
* Actions (aka quick fixes) that are able to either fix or address the issue that is causing this
* Problem.
*
* <p>For example given the following code:
*
* <pre>
* trait Example:
* def foo(): Unit
* def bar(): Unit
*
* class MyExample extends Example
* </pre>
*
* You could expect this to have multiple actions attatched:
*
* <ul>
* <li>An option to implement a stub method for `foo()` and `bar()`
* <li>An option to make `MyExample` abstract
* </ul>
*/
default List<Action> actions() {
return Collections.emptyList();
}
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -0,0 +1,26 @@
/*
* sbt
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package xsbti;
/**
* A representation of the `TextEdit` found in the LSP protocol.
*
* <p>NOTE: That instead of a `Range` we use the internal [[xsbti.Position]].
*
* @see <a
* href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEdit">`TextEdit`</a>
*/
public interface TextEdit {
/** The position this edit will be applied to. */
Position position();
/** The next text that will be inserted into the given [[TextEdit.position]]. */
String newText();
}

View File

@ -0,0 +1,27 @@
/*
* sbt
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package xsbti;
import java.util.List;
/**
* A minimal representatin of the `WorkspaceEdit` found in the LSP protocol.
*
* <p>However it only supports the minimal `changes` to ensure the fixes will work with all clients.
*
* <p>NOTE: In the future this may be expanded to handle resource operations via `documentChanges`.
*
* @see <a href=
* "https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceEdit">`WorkspaceEdit`</a>
*/
public interface WorkspaceEdit {
/** List of [[xsbti.TextEdit]] that belong to this WorkspaceEdit. */
List<TextEdit> changes();
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -19,7 +20,7 @@ import org.apache.logging.log4j.{ Level => XLevel }
import sbt.internal.util.ConsoleAppender._
import sbt.util._
import org.apache.logging.log4j.core.AbstractLogEvent
import org.apache.logging.log4j.message.StringFormatterMessageFactory
import org.apache.logging.log4j.message.SimpleMessageFactory
import java.util.concurrent.atomic.AtomicReference
object ConsoleLogger {
@ -654,7 +655,7 @@ private[sbt] class ConsoleAppenderFromLog4J(
delegate.append(new AbstractLogEvent {
override def getLevel(): XLevel = ConsoleAppender.toXLevel(level)
override def getMessage(): Message =
StringFormatterMessageFactory.INSTANCE.newMessage(message.toString, Array.empty[AnyRef])
SimpleMessageFactory.INSTANCE.newMessage(message.toString, Array.empty[AnyRef])
})
}
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -18,8 +19,8 @@ import org.jline.terminal.{ Attributes, Size, Terminal => JTerminal }
import org.jline.terminal.Attributes.{ InputFlag, LocalFlag }
import org.jline.terminal.Terminal.SignalHandler
import org.jline.terminal.impl.{ AbstractTerminal, DumbTerminal }
import org.jline.terminal.impl.jansi.JansiSupportImpl
import org.jline.terminal.impl.jansi.win.JansiWinSysTerminal
import org.jline.terminal.impl.jansi.JansiTerminalProvider
import org.jline.terminal.spi.{ SystemStream, TerminalProvider }
import org.jline.utils.OSUtils
import scala.jdk.CollectionConverters.*
import scala.util.Try
@ -31,23 +32,22 @@ private[sbt] object JLine3 {
private[this] val forceWindowsJansiHolder = new AtomicBoolean(false)
private[sbt] def forceWindowsJansi(): Unit = forceWindowsJansiHolder.set(true)
private[this] def windowsJansi(): org.jline.terminal.Terminal = {
val provider = new JansiTerminalProvider
val termType = sys.props.get("org.jline.terminal.type").orElse(sys.env.get("TERM")).orNull
val term = JansiWinSysTerminal.createTerminal(
provider.winSysTerminal(
"console",
termType,
OSUtils.IS_CONEMU,
Charset.forName("UTF-8"),
-1,
false,
SignalHandler.SIG_DFL,
true
true,
SystemStream.Output
)
term.disableScrolling()
term
}
private val jansi = {
val (major, minor) =
(JansiSupportImpl.getJansiMajorVersion, JansiSupportImpl.getJansiMinorVersion)
(JansiTerminalProvider.getJansiMajorVersion, JansiTerminalProvider.getJansiMinorVersion)
(major > 1 || minor >= 18) && Util.isWindows
}
private[util] def system: org.jline.terminal.Terminal = {
@ -115,6 +115,11 @@ private[sbt] object JLine3 {
}
}
}
// returns 'null' if the terminal was created with no provider
override def getProvider(): TerminalProvider = null
// returns 'null' if the terminal is not bound to a system stream.
override def getSystemStream(): SystemStream = null
override val input: InputStream = new InputStream {
override def read: Int = {
val res = term.inputStream match {
@ -176,7 +181,7 @@ private[sbt] object JLine3 {
case null => -1
case i => i.toInt
}
override def readBuffered(buf: Array[Char]): Int = {
override def readBuffered(buf: Array[Char], off: Int, len: Int, timeout: Long): Int = {
if (buffer.isEmpty) fillBuffer()
buffer.take match {
case i if i == -1 => -1

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -49,7 +50,7 @@ object StackTrace {
val els = t.getStackTrace()
var i = 0
while ((i < els.size) && include(els(i))) {
while ((i < els.length) && include(els(i))) {
appendElement(els(i))
i += 1
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -192,9 +193,40 @@ trait Terminal extends AutoCloseable {
else 0
}
private[sbt] def flush(): Unit = printStream.flush()
private[sbt] def readArrow: Int = withRawInput {
val in = System.in
val ESC = '\u001B'
val EOT = '\u0004'
var result: Int = -1
def readBracket: Int =
in.read() match {
case '[' => readAnsiControl
case _ => 0
}
def readAnsiControl: Int =
in.read() match {
case 'A' => Terminal.VK_UP
case 'B' => Terminal.VK_DOWN
case 'C' => Terminal.VK_RIGHT
case 'D' => Terminal.VK_LEFT
case _ => 0
}
in.read() match {
case ESC => readBracket
// Ctrl+D to quit
case EOT => -1
case c => c
}
}
}
object Terminal {
private[sbt] final val VK_UP = 256
private[sbt] final val VK_DOWN = 257
private[sbt] final val VK_RIGHT = 258
private[sbt] final val VK_LEFT = 259
val NO_BOOT_CLIENTS_CONNECTED: Int = -2
// Disable noisy jline log spam
if (System.getProperty("sbt.jline.verbose", "false") != "true")
@ -868,13 +900,19 @@ object Terminal {
override lazy val isAnsiSupported: Boolean =
!isDumbTerminal && Terminal.isAnsiSupported && !isCI
override private[sbt] def progressState: ProgressState = consoleProgressState.get
override def isEchoEnabled: Boolean =
try system.echo()
catch { case _: InterruptedIOException => false }
override def isSuccessEnabled: Boolean = true
private lazy val echoEnabled: AtomicBoolean = new AtomicBoolean({
try system.echo()
catch {
case _: InterruptedIOException => false
}
})
override def isEchoEnabled: Boolean = echoEnabled.get()
override def setEchoEnabled(toggle: Boolean): Unit =
try Util.ignoreResult(system.echo(toggle))
catch { case _: InterruptedIOException => }
try {
Util.ignoreResult(system.echo(toggle))
echoEnabled.set(toggle)
} catch { case _: InterruptedIOException => }
override def getBooleanCapability(capability: String): Boolean =
capabilityMap.get(capability).fold(false)(system.getBooleanCapability)
override def getNumericCapability(capability: String): Integer =

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -12,7 +13,17 @@ import java.util.Optional
import java.util.function.Supplier
import java.{ util => ju }
import xsbti.{ DiagnosticCode, DiagnosticRelatedInformation, Position, Problem, Severity, T2 }
import xsbti.{
Action,
DiagnosticCode,
DiagnosticRelatedInformation,
Position,
Problem,
Severity,
TextEdit,
WorkspaceEdit,
T2,
}
import scala.collection.mutable.ListBuffer
@ -130,6 +141,7 @@ object InterfaceUtil {
): Problem =
problem(cat, pos, msg, sev, rendered, None, List.empty[DiagnosticRelatedInformation])
@deprecated("Use the overload of this method with more arguments", "1.9.0")
def problem(
cat: String,
pos: Position,
@ -139,7 +151,59 @@ object InterfaceUtil {
diagnosticCode: Option[DiagnosticCode],
diagnosticRelatedInforamation: List[DiagnosticRelatedInformation]
): Problem =
new ConcreteProblem(cat, pos, msg, sev, rendered, diagnosticCode, diagnosticRelatedInforamation)
problem(
cat,
pos,
msg,
sev,
rendered,
diagnosticCode,
diagnosticRelatedInforamation,
List.empty[Action],
)
def problem(
cat: String,
pos: Position,
msg: String,
sev: Severity,
rendered: Option[String],
diagnosticCode: Option[DiagnosticCode],
diagnosticRelatedInformation: List[DiagnosticRelatedInformation],
actions: List[Action],
): Problem =
new ConcreteProblem(
cat,
pos,
msg,
sev,
rendered,
diagnosticCode,
diagnosticRelatedInformation,
actions,
)
def action(
title: String,
description: Option[String],
edit: WorkspaceEdit,
): Action =
new ConcreteAction(title, description, edit)
def workspaceEdit(changes: List[TextEdit]): WorkspaceEdit =
new ConcreteWorkspaceEdit(changes)
def textEdit(position: Position, newText: String): TextEdit =
new ConcreteTextEdit(position, newText)
def diagnosticCode(code: String, explanation: Option[String]): DiagnosticCode =
new ConcreteDiagnosticCode(code, explanation)
def diagnosticRelatedInformation(
position: Position,
message: String
): DiagnosticRelatedInformation =
new ConcreteDiagnosticRelatedInformation(position, message)
private final class ConcreteT2[A1, A2](a1: A1, a2: A2) extends T2[A1, A2] {
val get1: A1 = a1
@ -187,6 +251,42 @@ object InterfaceUtil {
override val startColumn = o2jo(startColumn0)
override val endLine = o2jo(endLine0)
override val endColumn = o2jo(endColumn0)
override def toString: String = {
val src = sourcePath0 match {
case Some(x) => s"$x"
case None => "none"
}
val line = line0 match {
case Some(x) => s":$x"
case None => ""
}
val offset = offset0 match {
case Some(x) => s":$x"
case None => ""
}
s"""$src$line$offset"""
}
private def toTuple(p: Position) =
(
p.line,
p.lineContent,
p.offset,
p.pointer,
p.pointerSpace,
p.sourcePath,
p.sourceFile,
p.startOffset,
p.endOffset,
p.startLine,
p.startColumn,
p.endLine,
p.endColumn,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: Position => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteProblem(
@ -196,7 +296,8 @@ object InterfaceUtil {
sev: Severity,
rendered0: Option[String],
diagnosticCode0: Option[DiagnosticCode],
diagnosticRelatedInformation0: List[DiagnosticRelatedInformation]
diagnosticRelatedInformation0: List[DiagnosticRelatedInformation],
actions0: List[Action],
) extends Problem {
val category = cat
val position = pos
@ -204,8 +305,116 @@ object InterfaceUtil {
val severity = sev
override val rendered = o2jo(rendered0)
override def diagnosticCode: Optional[DiagnosticCode] = o2jo(diagnosticCode0)
override def diagnosticRelatedInforamation(): ju.List[DiagnosticRelatedInformation] =
override def diagnosticRelatedInformation(): ju.List[DiagnosticRelatedInformation] =
l2jl(diagnosticRelatedInformation0)
@deprecated("use diagnosticRelatedInformation", "1.9.0")
override def diagnosticRelatedInforamation(): ju.List[DiagnosticRelatedInformation] =
diagnosticRelatedInformation()
override def actions(): ju.List[Action] =
l2jl(actions0)
override def toString = s"[$severity] $pos: $message"
private def toTuple(p: Problem) =
(
p.category,
p.position,
p.message,
p.severity,
p.rendered,
p.diagnosticCode,
p.diagnosticRelatedInformation,
p.actions,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: Problem => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteAction(
title0: String,
description0: Option[String],
edit0: WorkspaceEdit,
) extends Action {
val title: String = title0
val edit: WorkspaceEdit = edit0
override def description(): Optional[String] =
o2jo(description0)
override def toString(): String =
s"Action($title0, $description0, $edit0)"
private def toTuple(a: Action) =
(
a.title,
a.description,
a.edit,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: Action => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteWorkspaceEdit(changes0: List[TextEdit]) extends WorkspaceEdit {
override def changes(): ju.List[TextEdit] = l2jl(changes0)
override def toString(): String =
s"WorkspaceEdit($changes0)"
private def toTuple(w: WorkspaceEdit) = jl2l(w.changes)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: WorkspaceEdit => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteTextEdit(position0: Position, newText0: String) extends TextEdit {
val position: Position = position0
val newText: String = newText0
override def toString(): String =
s"TextEdit($position, $newText)"
private def toTuple(edit: TextEdit) =
(
edit.position,
edit.newText,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: TextEdit => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteDiagnosticCode(code0: String, explanation0: Option[String])
extends DiagnosticCode {
val code: String = code0
val explanation: Optional[String] = o2jo(explanation0)
override def toString(): String = s"DiagnosticCode($code)"
private def toTuple(c: DiagnosticCode) =
(
c.code,
c.explanation,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: DiagnosticCode => toTuple(this) == toTuple(o)
case _ => false
}
}
private final class ConcreteDiagnosticRelatedInformation(position0: Position, message0: String)
extends DiagnosticRelatedInformation {
val position: Position = position0
val message: String = message0
override def toString(): String = s"DiagnosticRelatedInformation($position, $message)"
private def toTuple(info: DiagnosticRelatedInformation) =
(
info.position,
info.message,
)
override def hashCode: Int = toTuple(this).##
override def equals(o: Any): Boolean = o match {
case o: DiagnosticRelatedInformation => toTuple(this) == toTuple(o)
case _ => false
}
}
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -39,11 +40,13 @@ abstract class Logger extends xLogger {
def success(message: => String): Unit
def log(level: Level.Value, message: => String): Unit
def verbose(msg: Supplier[String]): Unit = debug(msg)
def debug(msg: Supplier[String]): Unit = log(Level.Debug, msg)
def warn(msg: Supplier[String]): Unit = log(Level.Warn, msg)
def info(msg: Supplier[String]): Unit = log(Level.Info, msg)
def error(msg: Supplier[String]): Unit = log(Level.Error, msg)
def trace(msg: Supplier[Throwable]): Unit = trace(msg.get())
def success(msg: Supplier[String]): Unit = success(msg.get())
def log(level: Level.Value, msg: Supplier[String]): Unit = log(level, msg.get)
}

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
@ -10,8 +11,8 @@ package sbt.util
import sbt.internal.util._
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicBoolean
import scala.jdk.CollectionConverters.*
import java.util.concurrent.atomic.{ AtomicReference, AtomicBoolean }
// import scala.jdk.CollectionConverters.*
/**
* Provides a context for generating loggers during task evaluation. The logger context can be
@ -35,27 +36,27 @@ object LoggerContext {
private[util] class LoggerContextImpl extends LoggerContext {
private class Log extends MiniLogger {
private val consoleAppenders: java.util.Vector[(Appender, Level.Value)] =
new java.util.Vector
private val consoleAppenders: AtomicReference[Vector[(Appender, Level.Value)]] =
new AtomicReference(Vector.empty)
def log(level: Level.Value, message: => String): Unit = {
val toAppend = consoleAppenders.asScala.filter { case (a, l) => level.compare(l) >= 0 }
val toAppend = consoleAppenders.get.filter { case (a, l) => level.compare(l) >= 0 }
if (toAppend.nonEmpty) {
val m = message
toAppend.foreach { case (a, l) => a.appendLog(level, m) }
}
}
def log[T](level: Level.Value, message: ObjectEvent[T]): Unit = {
consoleAppenders.forEach { case (a, l) =>
consoleAppenders.get.foreach { case (a, l) =>
if (level.compare(l) >= 0) a.appendObjectEvent(level, message)
}
}
def addAppender(newAppender: (Appender, Level.Value)): Unit =
Util.ignoreResult(consoleAppenders.add(newAppender))
Util.ignoreResult(consoleAppenders.updateAndGet(_ :+ newAppender))
def clearAppenders(): Unit = {
consoleAppenders.forEach { case (a, _) => a.close() }
consoleAppenders.clear()
consoleAppenders.get.foreach { case (a, _) => a.close() }
consoleAppenders.set(Vector.empty)
}
def appenders: Seq[Appender] = consoleAppenders.asScala.map(_._1).toVector
def appenders: Seq[Appender] = consoleAppenders.get.map(_._1)
}
private[this] val loggers = new ConcurrentHashMap[String, Log]
private[this] val closed = new AtomicBoolean(false)

View File

@ -1,6 +1,7 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/

Some files were not shown because too many files have changed in this diff Show More