Merge branch '1.10.x' into wip/merge-1.10.x

This commit is contained in:
Eugene Yokota 2024-05-07 04:39:25 -04:00
commit c81d269ed2
717 changed files with 5345 additions and 3566 deletions

View File

@ -12,7 +12,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-20.04
java: 17 java: 17
distribution: temurin distribution: temurin
jobtype: 1 jobtype: 1
@ -40,9 +40,9 @@ jobs:
java: 8 java: 8
distribution: adopt distribution: adopt
jobtype: 7 jobtype: 7
- os: macos-12 - os: macos-latest
java: 8 java: 17
distribution: adopt distribution: temurin
jobtype: 8 jobtype: 8
- os: windows-2019 - os: windows-2019
java: 8 java: 8
@ -59,168 +59,168 @@ jobs:
JDK11: adopt@1.11.0-9 JDK11: adopt@1.11.0-9
SPARK_LOCAL_IP: "127.0.0.1" SPARK_LOCAL_IP: "127.0.0.1"
steps: steps:
- name: Checkout sbt/sbt - name: Checkout sbt/sbt
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Checkout sbt/io - name: Checkout sbt/io
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/io repository: sbt/io
ref: develop ref: develop
path: io path: io
- name: Checkout sbt/librarymanagement - name: Checkout sbt/librarymanagement
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/librarymanagement repository: sbt/librarymanagement
ref: develop ref: develop
path: librarymanagement path: librarymanagement
- name: Checkout sbt/zinc - name: Checkout sbt/zinc
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/zinc repository: sbt/zinc
ref: wip/sbt-2.x ref: wip/sbt-2.x
path: zinc path: zinc
- name: Setup JDK - name: Setup JDK
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
distribution: "${{ matrix.distribution }}" distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}" java-version: "${{ matrix.java }}"
- name: Set up Python 3.7 - name: Set up Python 3.12
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: 3.7 python-version: 3.12
- name: Coursier cache - name: Coursier cache
uses: coursier/cache-action@v6 uses: coursier/cache-action@v6
# - name: Cache sbt # - name: Cache sbt
# uses: actions/cache@v3 # uses: actions/cache@v3
# with: # with:
# path: ~/.sbt # path: ~/.sbt
# key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} # key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Setup Windows C++ toolchain - name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2019' }} if: ${{ matrix.os == 'windows-2019' }}
- name: Pre-test cleanup - name: Pre-test cleanup
shell: bash shell: bash
run: | run: |
rm -rf "$HOME/.sbt/scripted/" || true rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
- name: Publish local Zinc - name: Publish local Zinc
shell: bash shell: bash
run: | run: |
./sbt -v lowerUtils/publishLocal ./sbt -v lowerUtils/publishLocal
cd zinc/ cd zinc/
sbt publishLocal sbt publishLocal
- name: Build and test (1) - name: Build and test (1)
if: ${{ matrix.jobtype == 1 }} if: ${{ matrix.jobtype == 1 }}
shell: bash shell: bash
run: | run: |
rm -rf "$HOME/.sbt/boot/" || true rm -rf "$HOME/.sbt/boot/" || true
# ./sbt -v --client mimaReportBinaryIssues # ./sbt -v --client mimaReportBinaryIssues
./sbt -v --client javafmtCheck ./sbt -v --client javafmtCheck
./sbt -v --client "Test/javafmtCheck" ./sbt -v --client "Test/javafmtCheck"
./sbt -v --client scalafmtCheckAll ./sbt -v --client scalafmtCheckAll
./sbt -v --client scalafmtSbtCheck ./sbt -v --client scalafmtSbtCheck
./sbt -v --client serverTestProj/scalafmtCheckAll ./sbt -v --client serverTestProj/scalafmtCheckAll
# ./sbt -v --client headerCheck # ./sbt -v --client headerCheck
# ./sbt -v --client "Test/headerCheck" # ./sbt -v --client "Test/headerCheck"
./sbt -v --client "Test/compile" ./sbt -v --client "Test/compile"
./sbt -v --client publishLocal ./sbt -v --client publishLocal
./sbt -v --client test ./sbt -v --client test
./sbt -v --client "serverTestProj/test" ./sbt -v --client "serverTestProj/test"
# ./sbt -v --client doc # ./sbt -v --client doc
./sbt -v --client "all $UTIL_TESTS" ./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.13.x ./sbt -v --client ++2.13.x
./sbt -v --client "all $UTIL_TESTS" ./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++2.12.x ./sbt -v --client ++2.12.x
./sbt -v --client "all $UTIL_TESTS" ./sbt -v --client "all $UTIL_TESTS"
- name: Build and test (2) - name: Build and test (2)
if: ${{ matrix.jobtype == 2 }} if: ${{ matrix.jobtype == 2 }}
shell: bash shell: bash
run: | run: |
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* classloader-cache/* package/*" ./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* classloader-cache/* package/*"
# ./sbt -v "scripted watch/*" # ./sbt -v "scripted watch/*"
- name: Build and test (3) - name: Build and test (3)
if: ${{ matrix.jobtype == 3 }} if: ${{ matrix.jobtype == 3 }}
shell: bash shell: bash
run: | run: |
# ./sbt -v "dependencyTreeProj/publishLocal; scripted dependency-graph/*" # ./sbt -v "dependencyTreeProj/publishLocal; scripted dependency-graph/*"
./sbt -v --client "scripted dependency-management/* project-load/* java/* run/*" ./sbt -v --client "scripted dependency-management/* project-load/* java/* run/*"
# ./sbt -v --client "scripted plugins/*" # ./sbt -v --client "scripted plugins/*"
# ./sbt -v --client "scripted nio/*" # ./sbt -v --client "scripted nio/*"
- name: Build and test (4) - name: Build and test (4)
if: ${{ matrix.jobtype == 4 }} if: ${{ matrix.jobtype == 4 }}
shell: bash shell: bash
run: | run: |
# ./sbt -v "repoOverrideTest:scripted dependency-management/*" # ./sbt -v "repoOverrideTest:scripted dependency-management/*"
./sbt -v "scripted source-dependencies/*" ./sbt -v "scripted source-dependencies/*"
# ./sbt -v "scripted project/*" # ./sbt -v "scripted project/*"
- name: Build and test (5) - name: Build and test (5)
if: ${{ matrix.jobtype == 5 }} if: ${{ matrix.jobtype == 5 }}
shell: bash shell: bash
run: | run: |
./sbt -v --client test ./sbt -v --client test
./sbt -v --client "++2.13.x; all $UTIL_TESTS" ./sbt -v --client "++2.13.x; all $UTIL_TESTS"
./sbt -v --client "++2.12.x; all $UTIL_TESTS" ./sbt -v --client "++2.12.x; all $UTIL_TESTS"
# - name: Build and test (6) # - name: Build and test (6)
# if: ${{ matrix.jobtype == 6 }} # if: ${{ matrix.jobtype == 6 }}
# shell: bash # shell: bash
# run: | # run: |
# # build from fresh IO, LM, and Zinc # # build from fresh IO, LM, and Zinc
# BUILD_VERSION="1.5.0-SNAPSHOT" # BUILD_VERSION="1.5.0-SNAPSHOT"
# cd io # cd io
# sbt -v -Dsbt.build.version=${BUILD_VERSION} +publishLocal # sbt -v -Dsbt.build.version=${BUILD_VERSION} +publishLocal
# cd ../ # 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" # 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 # 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/*" # 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) - name: Build and test (7)
if: ${{ matrix.jobtype == 7 }} if: ${{ matrix.jobtype == 7 }}
shell: bash shell: bash
run: | run: |
# test building sbtn on Linux # test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script # test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11 echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package cd launcher-package
sbt -Dsbt.build.version=$TEST_SBT_VER rpm:packageBin debian:packageBin sbt -Dsbt.build.version=$TEST_SBT_VER rpm:packageBin debian:packageBin
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
cd citest && ./test.sh cd citest && ./test.sh
$HOME/bin/jabba install $JDK11 && exec $HOME/bin/jabba which --home $JDK11 $HOME/bin/jabba install $JDK11 && exec $HOME/bin/jabba which --home $JDK11
java -Xmx32m -version java -Xmx32m -version
./test.sh ./test.sh
- name: Build and test (8) - name: Build and test (8)
if: ${{ matrix.jobtype == 8 }} if: ${{ matrix.jobtype == 8 }}
shell: bash shell: bash
run: | run: |
# test building sbtn on macOS # test building sbtn on macOS
sbt "-Dsbt.io.virtual=false" nativeImage ./sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script # test launcher script
echo build using JDK 8, test using JDK 8, on macOS cd launcher-package
cd launcher-package bin/coursier resolve
bin/coursier resolve ../sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test # This fails due to the JLine issue
cd citest && ./test.sh # cd citest && ./test.sh
- name: Build and test (9) - name: Build and test (9)
if: ${{ matrix.jobtype == 9 }} if: ${{ matrix.jobtype == 9 }}
shell: bash shell: bash
run: | run: |
# test building sbtn on Windows # test building sbtn on Windows
sbt "-Dsbt.io.virtual=false" nativeImage sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script # test launcher script
echo build using JDK 8, test using JDK 8, on Windows echo build using JDK 8, test using JDK 8, on Windows
cd launcher-package cd launcher-package
bin/coursier.bat resolve bin/coursier.bat resolve
sbt -Dsbt.build.version=$TEST_SBT_VER universal:packageBin universal:stage integrationTest/test sbt -Dsbt.build.version=$TEST_SBT_VER integrationTest/test
cd citest cd citest
./test.bat ./test.bat
test3/test3.bat test3/test3.bat
- name: Cleanup - name: Cleanup
shell: bash shell: bash
run: | run: |
rm -rf "$HOME/.sbt/scripted/" || true rm -rf "$HOME/.sbt/scripted/" || true
rm -rf "$HOME/.ivy2/local" || true rm -rf "$HOME/.ivy2/local" || true
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -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/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -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 name: Submit Dependency Graph
on: on:
push: push:
branches: [1.7.x] # default branch of the project branches: [1.9.x] # default branch of the project
permissions: {} permissions: {}
jobs: jobs:
submit-graph: submit-graph:
@ -12,5 +12,5 @@ jobs:
name: Submit Dependency Graph name: Submit Dependency Graph
runs-on: ubuntu-latest # or windows-latest, or macOS-latest runs-on: ubuntu-latest # or windows-latest, or macOS-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: scalacenter/sbt-dependency-submission@v2 - 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: include:
- os: ubuntu-latest - os: ubuntu-latest
java: 8 java: 8
distribution: adopt
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
JAVA_OPTS: -Xms800M -Xmx800M -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8 JAVA_OPTS: -Xms800M -Xmx800M -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
steps: steps:
- name: Checkout sbt/sbt - name: Checkout sbt/sbt
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Checkout sbt/io - name: Checkout sbt/io
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/io repository: sbt/io
ref: develop ref: develop
path: io path: io
- name: Checkout sbt/librarymanagement - name: Checkout sbt/librarymanagement
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/librarymanagement repository: sbt/librarymanagement
ref: develop ref: develop
path: librarymanagement path: librarymanagement
- name: Checkout sbt/zinc - name: Checkout sbt/zinc
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: sbt/zinc repository: sbt/zinc
ref: develop ref: develop
path: zinc path: zinc
- name: Setup - name: Setup JDK
uses: olafurpg/setup-scala@v13 uses: actions/setup-java@v4
with: with:
java-version: "adopt@1.${{ matrix.java }}" distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: Coursier cache - name: Coursier cache
uses: coursier/cache-action@v6 uses: coursier/cache-action@v6
- name: Build and deploy - 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. 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) See [DEVELOPING](./DEVELOPING.md)
Profiling sbt Profiling sbt
@ -133,27 +105,13 @@ Profiling sbt
See [PROFILING](./PROFILING.md) See [PROFILING](./PROFILING.md)
Other notes for maintainers Other notes
--------------------------- -----------
### 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
```
## Signing the CLA ## Signing the CLA
Contributing to sbt requires you or your employer to sign the 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 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` 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 ### Branch to work against
sbt uses **two or three** branches for development: 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. 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` - 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. The `develop` branch represents sbt 2.x, the next major sbt series.
Next minor branch is where new features can be added as long as it is binary compatible with sbt 1.0. 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. The `stable` branch represents the current stable sbt release. Only bug fixes are back-ported to the stable branch.
### Instruction to build just sbt ### 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). 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. 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`. 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. 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 ### 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 #### Import statements
You'd need alternative DSL import since you can't rely on sbt package object. 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 same "printed page" as the copyright notice for easier
identification within third-party archives. 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 Copyright (c) 2008 - 2010, Mark Harrah
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");

3
NOTICE
View File

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

View File

@ -1,20 +1,10 @@
[ask]: https://stackoverflow.com/questions/ask?tags=sbt [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 [gitter]: https://gitter.im/sbt/sbt
Support 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). 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. - 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. - 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 com.typesafe.tools.mima.core._
import local.Scripted import local.Scripted
import java.nio.file.{ Files, Path => JPath } import java.nio.file.{ Files, Path => JPath }
import java.util.Locale
import scala.util.Try import scala.util.Try
@ -47,7 +48,7 @@ ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml"
Global / semanticdbEnabled := !(Global / insideCI).value Global / semanticdbEnabled := !(Global / insideCI).value
// Change main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala too, if you change this. // 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") val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty) Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID Global / excludeLint += componentID
@ -59,7 +60,8 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
headerLicense := Some( headerLicense := Some(
HeaderLicense.Custom( HeaderLicense.Custom(
"""|sbt """|sbt
|Copyright 2011 - 2018, Lightbend, Inc. |Copyright 2023, Scala center
|Copyright 2011 - 2022, Lightbend, Inc.
|Copyright 2008 - 2010, Mark Harrah |Copyright 2008 - 2010, Mark Harrah
|Licensed under Apache License 2.0 (see LICENSE) |Licensed under Apache License 2.0 (see LICENSE)
|""".stripMargin |""".stripMargin
@ -69,6 +71,7 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
componentID := None, componentID := None,
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"), resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"), resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
testFrameworks += TestFramework("hedgehog.sbt.Framework"), testFrameworks += TestFramework("hedgehog.sbt.Framework"),
testFrameworks += TestFramework("verify.runner.Framework"), testFrameworks += TestFramework("verify.runner.Framework"),
Global / concurrentRestrictions += Util.testExclusiveRestriction, 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.apply"),
exclude[DirectMissingMethodProblem]("sbt.PluginData.copy"), exclude[DirectMissingMethodProblem]("sbt.PluginData.copy"),
exclude[DirectMissingMethodProblem]("sbt.PluginData.this"), 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, minimalSettings,
onLoadMessage := { onLoadMessage := {
val version = sys.props("java.specification.version") val version = sys.props("java.specification.version")
""" __ __ """ __ __
| _____/ /_ / /_ | _____/ /_ / /_
| / ___/ __ \/ __/ | / ___/ __ \/ __/
| (__ ) /_/ / /_ | (__ ) /_/ / /_
| /____/_.___/\__/ | /____/_.___/\__/
|Welcome to the build for sbt. |Welcome to the build for sbt.
|""".stripMargin + |""".stripMargin +
(if (version != "1.8") (if (version != "1.8")
@ -201,7 +207,6 @@ lazy val sbtRoot: Project = (project in file("."))
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
Util.publishPomSettings, Util.publishPomSettings,
otherRootSettings, otherRootSettings,
Transform.conscriptSettings(bundledLauncherProj),
publish := {}, publish := {},
publishLocal := {}, publishLocal := {},
publish / skip := true, publish / skip := true,
@ -374,6 +379,7 @@ lazy val utilLogging = project
if (name == "Throwable") Nil if (name == "Throwable") Nil
else old(tpe) else old(tpe)
}, },
Test / fork := true,
utilMimaSettings, utilMimaSettings,
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.util.SuccessEvent.copy*"), 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.ConsoleAppender"),
exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"), exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"),
exclude[MissingClassProblem]("sbt.internal.util.Terminal$BlockingInputStream$"), exclude[MissingClassProblem]("sbt.internal.util.Terminal$BlockingInputStream$"),
exclude[IncompatibleResultTypeProblem]("sbt.util.LoggerContext#Log4JLoggerContext.loggers"),
), ),
) )
.configure(addSbtIO) .configure(addSbtIO)
@ -1056,6 +1063,10 @@ lazy val serverTestProj = (project in file("server-test"))
) )
val isWin = scala.util.Properties.isWin 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 = val buildThinClient =
inputKey[JPath]("generate a java implementation of the thin client") 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 // 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 := { () => nativeImageReady := { () =>
() ()
}, },
nativeImageVersion := "22.2.0",
nativeImageOutput := target.value / "bin" / "sbtn", nativeImageOutput := target.value / "bin" / "sbtn",
nativeImageOptions ++= Seq( nativeImageOptions ++= Seq(
"--no-fallback", "--no-fallback",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
/* /*
* sbt * sbt
* Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah * Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE) * 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.compiletime.summonInline
import scala.quoted.* import scala.quoted.*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
/* /*
* sbt * sbt
* Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah * Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */
@ -11,6 +12,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
// Note: Update InterfaceUtil.scala as well.
public interface Problem { public interface Problem {
String category(); String category();
@ -39,13 +42,44 @@ public interface Problem {
return Optional.empty(); return Optional.empty();
} }
/** @deprecated use {@link #diagnosticRelatedInformation()} instead. */
@Deprecated
default List<DiagnosticRelatedInformation> diagnosticRelatedInforamation() {
return diagnosticRelatedInformation();
}
/** /**
* The possible releated information for the diagnostic being reported. * The possible releated information for the diagnostic being reported.
* *
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala * <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". * 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(); return Collections.emptyList();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
/* /*
* sbt * sbt
* Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah * Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */
@ -192,9 +193,40 @@ trait Terminal extends AutoCloseable {
else 0 else 0
} }
private[sbt] def flush(): Unit = printStream.flush() 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 { 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 val NO_BOOT_CLIENTS_CONNECTED: Int = -2
// Disable noisy jline log spam // Disable noisy jline log spam
if (System.getProperty("sbt.jline.verbose", "false") != "true") if (System.getProperty("sbt.jline.verbose", "false") != "true")
@ -868,13 +900,19 @@ object Terminal {
override lazy val isAnsiSupported: Boolean = override lazy val isAnsiSupported: Boolean =
!isDumbTerminal && Terminal.isAnsiSupported && !isCI !isDumbTerminal && Terminal.isAnsiSupported && !isCI
override private[sbt] def progressState: ProgressState = consoleProgressState.get override private[sbt] def progressState: ProgressState = consoleProgressState.get
override def isEchoEnabled: Boolean =
try system.echo()
catch { case _: InterruptedIOException => false }
override def isSuccessEnabled: Boolean = true 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 = override def setEchoEnabled(toggle: Boolean): Unit =
try Util.ignoreResult(system.echo(toggle)) try {
catch { case _: InterruptedIOException => } Util.ignoreResult(system.echo(toggle))
echoEnabled.set(toggle)
} catch { case _: InterruptedIOException => }
override def getBooleanCapability(capability: String): Boolean = override def getBooleanCapability(capability: String): Boolean =
capabilityMap.get(capability).fold(false)(system.getBooleanCapability) capabilityMap.get(capability).fold(false)(system.getBooleanCapability)
override def getNumericCapability(capability: String): Integer = override def getNumericCapability(capability: String): Integer =

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
/* /*
* sbt * sbt
* Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah * Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */
@ -12,7 +13,17 @@ import java.util.Optional
import java.util.function.Supplier import java.util.function.Supplier
import java.{ util => ju } 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 import scala.collection.mutable.ListBuffer
@ -130,6 +141,7 @@ object InterfaceUtil {
): Problem = ): Problem =
problem(cat, pos, msg, sev, rendered, None, List.empty[DiagnosticRelatedInformation]) 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( def problem(
cat: String, cat: String,
pos: Position, pos: Position,
@ -139,7 +151,59 @@ object InterfaceUtil {
diagnosticCode: Option[DiagnosticCode], diagnosticCode: Option[DiagnosticCode],
diagnosticRelatedInforamation: List[DiagnosticRelatedInformation] diagnosticRelatedInforamation: List[DiagnosticRelatedInformation]
): Problem = ): 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] { private final class ConcreteT2[A1, A2](a1: A1, a2: A2) extends T2[A1, A2] {
val get1: A1 = a1 val get1: A1 = a1
@ -187,6 +251,42 @@ object InterfaceUtil {
override val startColumn = o2jo(startColumn0) override val startColumn = o2jo(startColumn0)
override val endLine = o2jo(endLine0) override val endLine = o2jo(endLine0)
override val endColumn = o2jo(endColumn0) 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( private final class ConcreteProblem(
@ -196,7 +296,8 @@ object InterfaceUtil {
sev: Severity, sev: Severity,
rendered0: Option[String], rendered0: Option[String],
diagnosticCode0: Option[DiagnosticCode], diagnosticCode0: Option[DiagnosticCode],
diagnosticRelatedInformation0: List[DiagnosticRelatedInformation] diagnosticRelatedInformation0: List[DiagnosticRelatedInformation],
actions0: List[Action],
) extends Problem { ) extends Problem {
val category = cat val category = cat
val position = pos val position = pos
@ -204,8 +305,116 @@ object InterfaceUtil {
val severity = sev val severity = sev
override val rendered = o2jo(rendered0) override val rendered = o2jo(rendered0)
override def diagnosticCode: Optional[DiagnosticCode] = o2jo(diagnosticCode0) override def diagnosticCode: Optional[DiagnosticCode] = o2jo(diagnosticCode0)
override def diagnosticRelatedInforamation(): ju.List[DiagnosticRelatedInformation] = override def diagnosticRelatedInformation(): ju.List[DiagnosticRelatedInformation] =
l2jl(diagnosticRelatedInformation0) 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" 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 * sbt
* Copyright 2011 - 2018, Lightbend, Inc. * Copyright 2023, Scala center
* Copyright 2011 - 2022, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah * Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */

View File

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

View File

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

View File

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

View File

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

View File

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

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