"Reverting 41571"

BUG=

Review URL: https://codereview.chromium.org//703203002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41572 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
alanknight@google.com 2014-11-06 17:27:52 +00:00
parent b9be0df603
commit 57aede2e75
7 changed files with 81 additions and 99 deletions

View file

@ -62,8 +62,8 @@ void main(List<String> arguments) {
* Print help if we are passed the help option or invalid arguments.
*/
void _printHelpAndExit() {
print(_initArgParser().usage);
print('Usage: dartdocgen [OPTIONS] fooDir/barFile');
print(_initArgParser().getUsage());
print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile');
exit(0);
}

View file

@ -1,36 +0,0 @@
#!/bin/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.
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)"
unset SNAPSHOT
SNAPSHOT="$BIN_DIR/snapshots/utils_wrapper.dart.snapshot"
if test -f "$SNAPSHOT"; then
exec "$BIN_DIR"/dart \
"--package-root=$BIN_DIR/../packages/" "--old_gen_heap_size=1024" \
"$SNAPSHOT" \
docgen "--sdk=$SDK_DIR" "$@"
else
exec "$BIN_DIR"/dart \
"--package-root=$BIN_DIR/../packages/" "--old_gen_heap_size=1024" \
"$BIN_DIR/../../pkg/docgen/bin/docgen.dart" "--sdk=$SDK_DIR" "$@"
fi

View file

@ -1,49 +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.
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 DOCGEN=%SDK_DIR%\pkg\docgen\bin\docgen.dart
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot
if not defined DART_CONFIGURATION set DART_CONFIGURATION=ReleaseIA32
set BUILD_DIR=%SDK_DIR%\..\build\%DART_CONFIGURATION%
if exist "%SNAPSHOT%" (
"%DART%" "%SNAPSHOT%" "docgen" "--sdk=%SDK_DIR%" %*
) else (
"%BUILD_DIR%\dart-sdk\bin\dart" "--package-root=%BUILD_DIR%\packages" "%DOCGEN%" "--sdk=%SDK_DIR%" %*
)
endlocal
exit /b %errorlevel%
:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
^| find "> %~n1 ["') do (
set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof
:end

View file

@ -3,5 +3,34 @@
# 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.
echo "The 'docgen' name is deprecated. Prefer 'dartdocgen' instead."
dartdocgen "$@"
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)"
unset SNAPSHOT
SNAPSHOT="$BIN_DIR/snapshots/utils_wrapper.dart.snapshot"
if test -f "$SNAPSHOT"; then
exec "$BIN_DIR"/dart \
"--package-root=$BIN_DIR/../packages/" "--old_gen_heap_size=1024" \
"$SNAPSHOT" \
docgen "--sdk=$SDK_DIR" "$@"
else
exec "$BIN_DIR"/dart \
"--package-root=$BIN_DIR/../packages/" "--old_gen_heap_size=1024" \
"$BIN_DIR/../../pkg/docgen/bin/docgen.dart" "--sdk=$SDK_DIR" "$@"
fi

View file

@ -3,5 +3,47 @@ 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.
echo "The 'docgen.bat' name is deprecated. Prefer 'dartdocgen.bat' instead."
dartdocgen %*
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 DOCGEN=%SDK_DIR%\pkg\docgen\bin\docgen.dart
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot
if not defined DART_CONFIGURATION set DART_CONFIGURATION=ReleaseIA32
set BUILD_DIR=%SDK_DIR%\..\build\%DART_CONFIGURATION%
if exist "%SNAPSHOT%" (
"%DART%" "%SNAPSHOT%" "docgen" "--sdk=%SDK_DIR%" %*
) else (
"%BUILD_DIR%\dart-sdk\bin\dart" "--package-root=%BUILD_DIR%\packages" "%DOCGEN%" "--sdk=%SDK_DIR%" %*
)
endlocal
exit /b %errorlevel%
:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
^| find "> %~n1 ["') do (
set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof
:end

View file

@ -113,7 +113,7 @@ def CopyShellScript(src_file, dest_dir):
def CopyDartScripts(home, sdk_root):
for executable in ['dart2js_sdk', 'dartanalyzer_sdk', 'dartfmt', 'docgen',
'dartdocgen', 'pub_sdk']:
'pub_sdk']:
CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
os.path.join(sdk_root, 'bin'))

View file

@ -15,7 +15,7 @@
],
'targets': [
{
'target_name': 'dartdocgen',
'target_name': 'docgen',
'type': 'none',
'dependencies': [
'../../create_sdk.gyp:create_sdk_internal',
@ -63,12 +63,8 @@
'../../sdk/bin/dart.bat',
'../../sdk/bin/dart2js',
'../../sdk/bin/dart2js.bat',
# TODO(alanknight): The docgen name is deprecated in favour of
# dartdocgen, and should be removed eventually.
'../../sdk/bin/docgen',
'../../sdk/bin/dartdocgen',
'../../sdk/bin/docgen.bat',
'../../sdk/bin/dartdocgen.bat',
'../../tools/only_in_release_mode.py',
'<(PRODUCT_DIR)/dart-sdk/README',
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
@ -81,7 +77,7 @@
'../../tools/only_in_release_mode.py',
'<@(_outputs)',
'--',
'<(PRODUCT_DIR)/dart-sdk/bin/dartdocgen<(script_suffix)',
'<(PRODUCT_DIR)/dart-sdk/bin/docgen<(script_suffix)',
'--out=<(PRODUCT_DIR)/api_docs/docgen',
'--include-sdk',
'--no-include-dependent-packages',
@ -94,7 +90,7 @@
'--exclude-lib=try',
'../../pkg'
],
'message': 'Running dartdocgen: <(_action)',
'message': 'Running docgen: <(_action)',
},
],
}