1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-03 00:08:46 +00:00

Reland "Reland "Remove the pub top-level""

This is a reland of 7bb6841815

Original change's description:
> Reland "Remove the pub top-level"
>
> This is a reland of 872ffa85c2
>
> Original change's description:
> > Remove the pub top-level
> >
> > The old pub toplevel interface is still reachable via
> >
> > ```
> >  $ dart __deprecated_pub
> > ```
> >
> > That is what `flutter pub` is using.
> >
> > Part of https://github.com/dart-lang/sdk/issues/46100
> >
> > Bug: https://github.com/dart-lang/pub/issues/3292
> > Change-Id: I97a14f2458d0f67c7bf98a90664d504cfaba0e98
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229541
> > Reviewed-by: Jonas Jensen <jonasfj@google.com>
> > Reviewed-by: Michael Thomsen <mit@google.com>
> > Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
>
> Bug: https://github.com/dart-lang/pub/issues/3292
> Change-Id: I45b5bf93f30c8abad4558cb15b61289c6c786f65
> Cq-Include-Trybots: luci.dart.try:flutter-engine-linux-try,flutter-engine-linux-web_tests-try,flutter-frontend-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231943
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Reviewed-by: Michael Thomsen <mit@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

Bug: https://github.com/dart-lang/pub/issues/3292
Change-Id: I132e965a7097cf438dd90e04012a782eb5489798
Cq-Include-Trybots: luci.dart.try:flutter-engine-linux-try,flutter-engine-linux-web_tests-try,flutter-frontend-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234283
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
This commit is contained in:
Sigurd Meldgaard 2022-03-07 12:16:28 +00:00 committed by Commit Bot
parent 4f5d82d312
commit 4cd91b983b
5 changed files with 9 additions and 159 deletions

View File

@ -162,6 +162,14 @@ in 2018, as it doesn't work with any Dart 2.x release.
[an issue]: https://github.com/dart-lang/sdk/issues/new
- **Breaking Change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
The deprecated standalone `pub` tool has been removed.
Its replacement is the `dart pub` command.
Should you find any issues, or missing features, in the replacement
command, kindly file [an issue][].
[an issue]: https://github.com/dart-lang/pub/issues/new
#### Pub
- Fixed race conditions in `dart pub get`, `dart run` and `dart pub global run`.

View File

@ -39,7 +39,6 @@ declare_args() {
# ......dartanalyzer
# ......dartdevc
# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32)
# ......pub
# ......snapshots/
# ........analysis_server.dart.snapshot
# ........dart2js.dart.snapshot
@ -88,16 +87,12 @@ declare_args() {
# ......api_readme.md
# Scripts that go under bin/
_platform_sdk_scripts = [
"dartanalyzer",
"pub",
]
_platform_sdk_scripts = [ "dartanalyzer" ]
_full_sdk_scripts = [
"dart2js",
"dartanalyzer",
"dartdevc",
"pub",
]
# Snapshots that go under bin/snapshots

View File

@ -1,56 +0,0 @@
@echo off
REM Copyright (c) 2014, 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.
rem Run pub.dart on the Dart VM. This script is only used when running pub from
rem within the Dart source repo. The shipped SDK instead uses "pub_sdk.bat",
rem which is renamed to "pub.bat" when the SDK is built.
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 VM_OPTIONS=
rem We allow extra vm options to be passed in through an environment variable.
if not "_%DART_VM_OPTIONS%_" == "__" (
set VM_OPTIONS=%VM_OPTIONS% %DART_VM_OPTIONS%
)
rem Use the Dart binary in the built SDK so pub can find the version file next
rem to it.
set BUILD_DIR=%SDK_DIR%\..\out\ReleaseX64
set DART=%BUILD_DIR%\dart-sdk\bin\dart
rem Run pub.
set PUB="%SDK_DIR%\..\third_party\pkg\pub\bin\pub.dart"
"%DART%" "--packages=%SDK_DIR%\..\.packages" %VM_OPTIONS% "%PUB%" %*
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,47 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2014, 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 pub.dart on the Dart VM. This script assumes the Dart SDK's directory
# structure.
function follow_links() {
file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
done
echo "$file"
}
function array_contains() {
local needle="$1"
local element
shift
for element; do [ "$element" = "$needle" ] && return 0; done
return 1
}
# 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)"
DART="$BIN_DIR/dart"
unset VM_OPTIONS
declare -a VM_OPTIONS
# Allow extra VM options to be passed in through an environment variable.
if [[ $DART_VM_OPTIONS ]]; then
read -a OPTIONS <<< "$DART_VM_OPTIONS"
VM_OPTIONS+=("${OPTIONS[@]}")
fi
if [ -t 2 ]; then # Only print warning when run in terminal.
>&2 echo 'The top level `pub` command is deprecated. Use `dart pub` instead.'
fi
# Forward to the `dart __deprecatedpub` command.
exec "$DART" "${VM_OPTIONS[@]}" __deprecated_pub "$@"

View File

@ -1,50 +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 VM_OPTIONS=
set USING_DART_1=
rem We allow extra vm options to be passed in through an environment variable.
if not "_%DART_VM_OPTIONS%_" == "__" (
set VM_OPTIONS=%VM_OPTIONS% %DART_VM_OPTIONS%
for %%o in (%DART_VM_OPTIONS%) do (
if "%%o" equ "--no-preview-dart-2" set USING_DART_1=y
)
)
echo "The top level `pub.bat` command is deprecated. Use `dart pub` instead." 1>&2
"%BIN_DIR%\dart" %VM_OPTIONS% __deprecated_pub %*
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