[web] remove top-level scripts for dartdevc and dart2js.

This completes the breaking change that was previously announced in
https://github.com/dart-lang/sdk/issues/46100

Change-Id: Ie81665e7932fe00a8c1fee9f67ee8294cd4c89e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248342
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Sigmund Cherem 2022-06-14 18:29:17 +00:00 committed by Commit Bot
parent 3099911746
commit 69249df50b
7 changed files with 14 additions and 229 deletions

View file

@ -140,6 +140,13 @@ them, you must set the lower bound on the SDK constraint for your package to
### Tools
#### Dart command line
- **Breaking change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
The standalone `dart2js` and `dartdevc` tools have been removed as previously
announced. `dart2js` is replaced by the `dart compile js` command, `dartdevc`
is no longer exposed as a command-line tool.
#### Linter
Updated the Linter to `1.25.0`, which includes changes that

View file

@ -174,7 +174,7 @@ void main(List<String> args) async {
mode: ProcessStartMode.inheritStdio, environment: environment);
}
Future<void> runDdc(String command, List<String> args) async {
Future<void> runDdc(List<String> args) async {
if (debug) {
// Use unbuilt script. This only works from a source checkout.
var vmServicePort = options.wasParsed('vm-service-port')
@ -188,14 +188,14 @@ void main(List<String> args) async {
'--pause-isolates-on-start',
],
'--enable-asserts',
p.join(ddcPath, 'bin', '$command.dart')
p.join(ddcPath, 'bin', 'dartdevc.dart')
]);
command = dartBinary;
} else {
// Use built snapshot.
command = p.join(dartSdk, 'bin', command);
args.insertAll(
0, [p.join(dartSdk, 'bin', 'snapshots', 'dartdevc.dart.snapshot')]);
}
var process = await startProcess('DDC', command, args, <String, String>{
var process = await startProcess('DDC', dartBinary, args, <String, String>{
if (options['compile-vm-options'] != null)
'DART_VM_OPTIONS': options['compile-vm-options'] as String
});
@ -249,7 +249,7 @@ void main(List<String> args) async {
out,
entry
];
await runDdc('dartdevc', ddcArgs);
await runDdc(ddcArgs);
}
if (run) {

View file

@ -90,11 +90,7 @@ declare_args() {
# Scripts that go under bin/
_platform_sdk_scripts = [ "dartanalyzer" ]
_full_sdk_scripts = [
"dart2js",
"dartanalyzer",
"dartdevc",
]
_full_sdk_scripts = [ "dartanalyzer" ]
# Snapshots that go under bin/snapshots
_platform_sdk_snapshots = [

View file

@ -1,58 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2012, 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.
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"
SNAPSHOT_DIR="$BIN_DIR/snapshots"
SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot"
unset EXTRA_OPTIONS
declare -a EXTRA_OPTIONS
if test -t 1; then
# Stdout is a terminal.
if test 8 -le `tput colors`; then
# Stdout has at least 8 colors, so enable colors.
EXTRA_OPTIONS+=('--enable-diagnostic-colors')
fi
fi
unset EXTRA_VM_OPTIONS
declare -a EXTRA_VM_OPTIONS
if test -f "$SNAPSHOT"; then
EXTRA_OPTIONS+=("--libraries-spec=$SDK_DIR/lib/libraries.json")
fi
case $0 in
*_developer)
EXTRA_VM_OPTIONS+=('--enable-asserts')
;;
esac
# We allow extra vm options to be passed in through an environment variable.
if [[ $DART_VM_OPTIONS ]]; then
read -a OPTIONS <<< "$DART_VM_OPTIONS"
EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
fi
exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@"

View file

@ -1,57 +0,0 @@
@echo off
REM Copyright (c) 2012, 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.
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
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%
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\dart2js.dart.snapshot
set EXTRA_OPTIONS=
set EXTRA_VM_OPTIONS=
if _%DART2JS_DEVELOPER_MODE%_ == _1_ (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --enable-asserts
)
if exist "%SNAPSHOT%" (
set EXTRA_OPTIONS=%EXTRA_OPTIONS% "--libraries-spec=%SDK_DIR%\lib\libraries.json"
)
rem We allow extra vm options to be passed in through an environment variable.
if not "_%DART_VM_OPTIONS%_" == "__" (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% %DART_VM_OPTIONS%
)
"%DART%" %EXTRA_VM_OPTIONS% "%SNAPSHOT%" %EXTRA_OPTIONS% %*
endlocal
exit /b %errorlevel%
: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,41 +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 dev compiler on the Dart VM. This script assumes the Dart SDK's
# directory structure.
echo "Warning: this 'dartdevc' script is deprecated and will be removed. " 1>&2
echo "More details at https://github.com/dart-lang/sdk/issues/46100." 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)"
SNAPSHOT="$BIN_DIR/snapshots/dartdevc.dart.snapshot"
# We are running the snapshot in the built SDK.
DART="$BIN_DIR/dart"
unset EXTRA_VM_OPTIONS
declare -a EXTRA_VM_OPTIONS
# We allow extra vm options to be passed in through an environment variable.
if [[ $DART_VM_OPTIONS ]]; then
read -a OPTIONS <<< "$DART_VM_OPTIONS"
EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
fi
exec "$DART" --enable_experiment=non-nullable "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "$@"

View file

@ -1,62 +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: this 'dartdevc' script is deprecated and will be removed. 1>&2
echo More details at https://github.com/dart-lang/sdk/issues/46100. 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\dartdevc.dart.snapshot
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%
set SDK_ARG=--dart-sdk=%SDK_DIR%
set EXTRA_VM_OPTIONS=
rem We allow extra vm options to be passed in through an environment variable.
if not "_%DART_VM_OPTIONS%_" == "__" (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% %DART_VM_OPTIONS%
)
"%DART%" %EXTRA_VM_OPTIONS% "%SNAPSHOT%" "%SDK_ARG%" %*
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