mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
Add dev_compiler to the SDK build process.
Also update DEPS to bring the latest dev_compiler into the SDK. This is a second attempt at https://codereview.chromium.org/1777173003, with the following fixes: - Added .bat files for Windows. - Added missing dependency: create_sdk_internal depends on dartdevc.dart.snapshot. - Used pkg_files.stamp to note the source code dependency for dartdevc, so that we don't go beyond xcodebuild's input length limit. R=jmesserly@google.com Review URL: https://codereview.chromium.org/1818543002 .
This commit is contained in:
parent
9c3378d56a
commit
b73e02db49
9 changed files with 294 additions and 3 deletions
2
DEPS
2
DEPS
|
@ -41,7 +41,7 @@ vars = {
|
|||
"dartdoc_tag" : "@v0.9.0",
|
||||
"dart_services_rev" : "@7aea2574e6f3924bf409a80afb8ad52aa2be4f97",
|
||||
"dart_style_tag": "@0.2.4",
|
||||
"dev_compiler_rev": "@0.1.9",
|
||||
"dev_compiler_rev": "@0c5dd2d1e999c421d978a478e267aac6279e087a",
|
||||
"glob_rev": "@704cf75e4f26b417505c5c611bdaacd8808467dd",
|
||||
"html_tag" : "@0.12.1+1",
|
||||
"http_tag" : "@0.11.3+3",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
'utils/dartdoc/dartdoc.gyp:dartdoc',
|
||||
'utils/analysis_server/analysis_server.gyp:analysis_server',
|
||||
'utils/dartanalyzer/dartanalyzer.gyp:dartanalyzer',
|
||||
'utils/dartdevc/dartdevc.gyp:dartdevc',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
|
@ -38,6 +39,7 @@
|
|||
'<(SHARED_INTERMEDIATE_DIR)/utils_wrapper.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dartanalyzer.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dartdevc.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dartfmt.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/analysis_server.dart.snapshot',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dartdoc.dart.snapshot',
|
||||
|
|
8
dart.gyp
8
dart.gyp
|
@ -12,6 +12,7 @@
|
|||
'create_sdk',
|
||||
'dart2js',
|
||||
'dartanalyzer',
|
||||
'dartdevc',
|
||||
'packages',
|
||||
'runtime',
|
||||
'samples',
|
||||
|
@ -57,6 +58,13 @@
|
|||
'utils/dartanalyzer/dartanalyzer.gyp:dartanalyzer',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'dartdevc',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'utils/dartdevc/dartdevc.gyp:dartdevc',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'dartfmt',
|
||||
'type': 'none',
|
||||
|
|
86
sdk/bin/dartdevc
Executable file
86
sdk/bin/dartdevc
Executable file
|
@ -0,0 +1,86 @@
|
|||
#!/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 repo'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"
|
||||
}
|
||||
|
||||
# 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)"
|
||||
|
||||
SDK_ARG="--dart-sdk=$SDK_DIR"
|
||||
|
||||
DART="$BIN_DIR/dart"
|
||||
|
||||
unset EXTRA_VM_OPTIONS
|
||||
declare -a EXTRA_VM_OPTIONS
|
||||
|
||||
case $0 in
|
||||
*_developer)
|
||||
EXTRA_VM_OPTIONS+=('--checked')
|
||||
;;
|
||||
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
|
||||
|
||||
DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
|
||||
|
||||
DEV_COMPILER="$DART_ROOT/third_party/pkg/dev_compiler/bin/dartdevc.dart"
|
||||
|
||||
if [[ `uname` == 'Darwin' ]];
|
||||
then
|
||||
OUT_DIR="$DART_ROOT/xcodebuild/"
|
||||
else
|
||||
OUT_DIR="$DART_ROOT/out/"
|
||||
fi
|
||||
|
||||
if [ -z "$DART_CONFIGURATION" ];
|
||||
then
|
||||
DIRS=$( ls "$OUT_DIR" )
|
||||
# list of possible configurations in decreasing desirability
|
||||
CONFIGS=("ReleaseX64" "ReleaseIA32" "DebugX64" "DebugIA32"
|
||||
"ReleaseARM" "ReleaseARM64" "ReleaseARMV5TE" "ReleaseMIPS"
|
||||
"DebugARM" "DebugARM64" "DebugARMV5TE" "DebugMIPS")
|
||||
DART_CONFIGURATION="None"
|
||||
for CONFIG in ${CONFIGS[*]}
|
||||
do
|
||||
for DIR in $DIRS;
|
||||
do
|
||||
if [ "$CONFIG" = "$DIR" ];
|
||||
then
|
||||
# choose most desirable configuration that is available and break
|
||||
DART_CONFIGURATION="$DIR"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
if [ "$DART_CONFIGURATION" = "None" ]
|
||||
then
|
||||
echo "No valid dart configuration found in $OUT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
BUILD_DIR="$OUT_DIR$DART_CONFIGURATION"
|
||||
|
||||
PACKAGE_ROOT="$BUILD_DIR/packages/"
|
||||
|
||||
exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$DEV_COMPILER" "$SDK_ARG" "$@"
|
73
sdk/bin/dartdevc.bat
Normal file
73
sdk/bin/dartdevc.bat
Normal file
|
@ -0,0 +1,73 @@
|
|||
@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.
|
||||
|
||||
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%
|
||||
|
||||
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%
|
||||
)
|
||||
|
||||
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 DEV_COMPILER=%DART_ROOT%\third_party\pkg\dev_compiler\bin\dartdevc.dart
|
||||
|
||||
rem DART_CONFIGURATION defaults to ReleaseX64
|
||||
if "%DART_CONFIGURATION%"=="" set DART_CONFIGURATION=ReleaseX64
|
||||
|
||||
set BUILD_DIR=%DART_ROOT%\build\%DART_CONFIGURATION%
|
||||
|
||||
set PACKAGE_ROOT=%BUILD_DIR%\packages
|
||||
|
||||
"%DART%" %EXTRA_VM_OPTIONS% "--package-root=%PACKAGE_ROOT%" "DEV_COMPILER%" "%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\build\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 ^
|
||||
^| find "> %~n1 ["`) do (
|
||||
set current=%%i
|
||||
)
|
||||
if not "%current%"=="" call :follow_links "%current%", result
|
||||
endlocal & set %~2=%result%
|
||||
goto :eof
|
||||
|
||||
:end
|
31
sdk/bin/dartdevc_sdk
Executable file
31
sdk/bin/dartdevc_sdk
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/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.
|
||||
|
||||
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)"
|
||||
|
||||
SDK_ARG="--dart-sdk=$SDK_DIR"
|
||||
|
||||
SNAPSHOT="$BIN_DIR/snapshots/dartdevc.dart.snapshot"
|
||||
|
||||
# We are running the snapshot in the built SDK.
|
||||
DART="$BIN_DIR/dart"
|
||||
exec "$DART" "$SNAPSHOT" "$SDK_ARG" "$@"
|
52
sdk/bin/dartdevc_sdk.bat
Normal file
52
sdk/bin/dartdevc_sdk.bat
Normal file
|
@ -0,0 +1,52 @@
|
|||
@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.
|
||||
|
||||
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%
|
||||
|
||||
"%DART%" "%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\build\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 ^
|
||||
^| find "> %~n1 ["`) do (
|
||||
set current=%%i
|
||||
)
|
||||
if not "%current%"=="" call :follow_links "%current%", result
|
||||
endlocal & set %~2=%result%
|
||||
goto :eof
|
||||
|
||||
:end
|
|
@ -19,6 +19,7 @@
|
|||
# ......dartfmt
|
||||
# ......dart2js
|
||||
# ......dartanalyzer
|
||||
# ......dartdevc
|
||||
# ......pub
|
||||
# ......snapshots/
|
||||
# ........analysis_server.dart.snapshot
|
||||
|
@ -26,6 +27,7 @@
|
|||
# ........dartanalyzer.dart.snapshot
|
||||
# ........dartdoc.dart.snapshot
|
||||
# ........dartfmt.dart.snapshot
|
||||
# ........dartdevc.dart.snapshot
|
||||
# ........pub.dart.snapshot
|
||||
# ........utils_wrapper.dart.snapshot
|
||||
#.........resources/
|
||||
|
@ -129,14 +131,14 @@ def CopyShellScript(src_file, dest_dir):
|
|||
|
||||
def CopyDartScripts(home, sdk_root):
|
||||
for executable in ['dart2js_sdk', 'dartanalyzer_sdk', 'dartfmt_sdk',
|
||||
'pub_sdk', 'dartdoc']:
|
||||
'pub_sdk', 'dartdoc', 'dartdevc_sdk']:
|
||||
CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
|
||||
os.path.join(sdk_root, 'bin'))
|
||||
|
||||
|
||||
def CopySnapshots(snapshots, sdk_root):
|
||||
for snapshot in ['analysis_server', 'dart2js', 'dartanalyzer', 'dartfmt',
|
||||
'utils_wrapper', 'pub', 'dartdoc']:
|
||||
'utils_wrapper', 'pub', 'dartdoc', 'dartdevc']:
|
||||
snapshot += '.dart.snapshot'
|
||||
copyfile(join(snapshots, snapshot),
|
||||
join(sdk_root, 'bin', 'snapshots', snapshot))
|
||||
|
|
37
utils/dartdevc/dartdevc.gyp
Normal file
37
utils/dartdevc/dartdevc.gyp
Normal file
|
@ -0,0 +1,37 @@
|
|||
# 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.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'dartdevc',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'../../runtime/dart-runtime.gyp:dart',
|
||||
'../../pkg/pkg.gyp:pkg_packages',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'generate_dartdevc_snapshot',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
|
||||
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg/dev_compiler/bin"])',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
|
||||
],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/dartdevc.dart.snapshot',
|
||||
],
|
||||
'action': [
|
||||
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
|
||||
'--snapshot=<(SHARED_INTERMEDIATE_DIR)/dartdevc.dart.snapshot',
|
||||
'--package-root=<(PRODUCT_DIR)/packages/',
|
||||
'../../third_party/pkg/dev_compiler/bin/dartdevc.dart'
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
Loading…
Reference in a new issue