Remove "dartfmt" entrypoint from the SDK.

Change-Id: I32a9f95d7b22d3311767ba22c350f197592abcab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215300
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2021-10-04 18:40:57 +00:00 committed by commit-bot@chromium.org
parent a6fb77f02e
commit b927288ed1
10 changed files with 7 additions and 201 deletions

View file

@ -100,10 +100,6 @@ group("dartdevc") {
deps = [ "utils/dartdevc" ]
}
group("dartfmt") {
deps = [ "utils/dartfmt" ]
}
group("analysis_server") {
deps = [ "utils/analysis_server" ]
}

View file

@ -297,6 +297,12 @@
`dart compile exe` and `dart compile aot-snapshot` commands, which offer the
same functionality.
- **Breaking Change**: The standalone `dartfmt` tool has been removed as
previously announced. Its replacement is the `dart format` command.
Note that `dart format` has [a different set of options and
defaults][dartfmt cli] than `dartfmt`.
#### Dart VM
- **Breaking Change** [#45451](https://github.com/dart-lang/sdk/issues/45451):

View file

@ -5,13 +5,12 @@ You can find information about Dart online at dartlang.org.
Here's a brief guide to what's in here:
bin/ Binaries/scripts to compile, run, and manage Dart applications.
dart Dart virtual machine
dart Main Dart command-line executable
dart2js Dart-to-JavaScript compiler
dart2native Dart-to-native AOT compiler
dartanalyzer Dart static analyzer
dartdoc Dart documentation generator
pub Pub, the Dart package manager
dartfmt Dart code formatter
lib/ Libraries that are shipped with the Dart runtime. More
information is available at api.dartlang.org.

View file

@ -36,7 +36,6 @@ declare_args() {
# ......dart.lib (import library for VM native extensions on Windows)
# ......dartaotruntime or dartaotruntime.exe (executable)
# ......dartdoc
# ......dartfmt
# ......dart2js
# ......dartanalyzer
# ......dartdevc
@ -50,7 +49,6 @@ declare_args() {
# ........dartdev.dill
# ........dartdevc.dart.snapshot
# ........dartdoc.dart.snapshot
# ........dartfmt.dart.snapshot
# ........dds.dart.snapshot
# ........frontend_server.dart.snapshot
# ........gen_kernel.dart.snapshot (if not on ia32)
@ -94,7 +92,6 @@ declare_args() {
# Scripts that go under bin/
_platform_sdk_scripts = [
"dartanalyzer",
"dartfmt",
"pub",
]
@ -102,7 +99,6 @@ _full_sdk_scripts = [
"dart2js",
"dartanalyzer",
"dartdevc",
"dartfmt",
"pub",
]
@ -127,10 +123,6 @@ _platform_sdk_snapshots = [
"dartdoc",
"../utils/dartdoc",
],
[
"dartfmt",
"../utils/dartfmt",
],
[
"dds",
"../utils/dds:dds",

View file

@ -1,34 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Run dart_style/bin/format.dart on the Dart VM. This script assumes the Dart
# repo's directory structure.
echo "Warning: 'dartfmt' is deprecated. Please use 'dart format'." 1>&2
echo "(See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.)" 1>&2
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
PROG_NAME="$(follow_links "$BASH_SOURCE")"
# Handle the case where dart-sdk/bin has been symlinked to.
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
DART="$BIN_DIR/dart"
DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
DARTFMT="$DART_ROOT/third_party/pkg_tested/dart_style/bin/format.dart"
exec "$DART" "--packages=$DART_ROOT/.packages" "$DARTFMT" "$@"

View file

@ -1,60 +0,0 @@
@echo off
REM Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.
echo Warning: 'dartfmt' is deprecated. Please use 'dart format'. 1>&2
echo (See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.) 1>&2
setlocal
rem Handle the case where dart-sdk/bin has been symlinked to.
set DIR_NAME_WITH_SLASH=%~dp0
set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
rem Get rid of surrounding quotes.
for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
set DART=%BIN_DIR%\dart
rem Get absolute full name for SDK_DIR.
for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
rem Remove trailing backslash if there is one
if %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
rem Get absolute full name for DART_ROOT.
for %%i in ("%SDK_DIR%\..\") do set DART_ROOT=%%~fi
rem Remove trailing backslash if there is one
if %DART_ROOT:~-1%==\ set DART_ROOT=%DART_ROOT:~0,-1%
set DARTFMT=%DART_ROOT%\third_party\pkg_tested\dart_style\bin\format.dart
"%DART%" "--packages=%DART_ROOT%\.packages" "%DARTFMT%" %*
endlocal
exit /b %errorlevel%
rem Follow the symbolic links (junctions points) using `dir to determine the
rem canonical path. Output with a link looks something like this
rem
rem 01/03/2013 10:11 PM <JUNCTION> abc def
rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
rem
rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
rem surrounded by right angle bracket and left square bracket. Once we get
rem the filename, which is name of the link, we recursively follow that.
:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
^| %SystemRoot%\System32\find.exe "> %~n1 [" 2^>nul`) do (
set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof
:end

View file

@ -1,32 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Run dart_style/bin/format.dart on the Dart VM. This script assumes the Dart
# SDK's directory structure.
echo "Warning: 'dartfmt' is deprecated. Please use 'dart format'." 1>&2
echo "(See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.)" 1>&2
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
PROG_NAME="$(follow_links "$BASH_SOURCE")"
# Handle the case where dart-sdk/bin has been symlinked to.
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
SNAPSHOT="$BIN_DIR/snapshots/dartfmt.dart.snapshot"
# We are running the snapshot in the built SDK.
DART="$BIN_DIR/dart"
exec "$DART" "$SNAPSHOT" "$@"

View file

@ -1,47 +0,0 @@
@echo off
REM Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.
echo Warning: 'dartfmt' is deprecated. Please use 'dart format'. 1>&2
echo (See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.) 1>&2
setlocal
rem Handle the case where dart-sdk/bin has been symlinked to.
set DIR_NAME_WITH_SLASH=%~dp0
set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
rem Get rid of surrounding quotes.
for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\dartfmt.dart.snapshot
"%DART%" "%SNAPSHOT%" %*
endlocal
exit /b %errorlevel%
rem Follow the symbolic links (junctions points) using `dir to determine the
rem canonical path. Output with a link looks something like this
rem
rem 01/03/2013 10:11 PM <JUNCTION> abc def
rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
rem
rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
rem surrounded by right angle bracket and left square bracket. Once we get
rem the filename, which is name of the link, we recursively follow that.
:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
^| %SystemRoot%\System32\find.exe "> %~n1 ["`) do (
set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof
:end

View file

@ -1,2 +0,0 @@
/dartfmt.Makefile
/dartfmt.target.mk

View file

@ -1,12 +0,0 @@
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import("../application_snapshot.gni")
application_snapshot("dartfmt") {
main_dart = "../../third_party/pkg_tested/dart_style/bin/format.dart"
# Train it on formatting its own source.
training_args = [ "../../third_party/pkg_tested/dart_style" ]
}