Skip to content

Commit

Permalink
Make a fork of sdk/lib for use by NNBD.
Browse files Browse the repository at this point in the history
Change-Id: I7f5892d66f9e7bd08ca064fb2df329794a56faf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116527
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
  • Loading branch information
stereotype441 authored and commit-bot@chromium.org committed Sep 10, 2019
1 parent ca7baa4 commit 004d49b
Show file tree
Hide file tree
Showing 322 changed files with 165,262 additions and 0 deletions.
1,069 changes: 1,069 additions & 0 deletions sdk_nnbd/BUILD.gn

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions sdk_nnbd/api_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Welcome to the Dart API reference documentation, covering the core Dart API
libraries. Some of the most fundamental Dart libraries include:

* [dart:core](dart-core/dart-core-library.html): Core functionality such as
strings, numbers, collections, errors, dates, and URIs.
* [dart:html](dart-html/dart-html-library.html): DOM manipulation for web apps
(available only to web apps).
* [dart:io](dart-io/dart-io-library.html): I/O for non-web apps.

Except for `dart:core`, you must import a library before you can use it. Here's
an example of importing `dart:async` and `dart:math`:

```dart
import 'dart:async';
import 'dart:math';
```

You can install more libraries using the
[pub package manager](https://dart.dev/guides/packages).

The main site for learning and using Dart is
[dart.dev](https://dart.dev). Check out these pages:

* [Platforms](https://dart.dev/platforms)
* [Language tour](https://dart.dev/guides/language/language-tour)
* [Library tour](https://dart.dev/guides/libraries/library-tour)
* [Sample code](https://dart.dev/samples)

This API reference is automatically generated from source code in the [Dart
SDK project](https://github.com/dart-lang/sdk).
If you'd like to give feedback or edit this documentation, see
[Contributing](https://github.com/dart-lang/sdk/wiki/Contributing).
57 changes: 57 additions & 0 deletions sdk_nnbd/bin/dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/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.
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"

if [[ `uname` == 'Darwin' ]];
then
OUT_DIR="$CUR_DIR"/../../xcodebuild/
else
OUT_DIR="$CUR_DIR"/../../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"
"DebugARM" "DebugARM64" "DebugARMV5TE")
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

BIN_DIR="$OUT_DIR$DART_CONFIGURATION"

exec "$BIN_DIR"/dart "$@"
16 changes: 16 additions & 0 deletions sdk_nnbd/bin/dart.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@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.

set SCRIPTPATH=%~dp0

REM Does the path have a trailing slash? If so, remove it.
if %SCRIPTPATH:~-1%== set SCRIPTPATH=%SCRIPTPATH:~0,-1%

REM DART_CONFIGURATION defaults to ReleaseX64
if "%DART_CONFIGURATION%"=="" set DART_CONFIGURATION=ReleaseX64

set arguments=%*

"%SCRIPTPATH%\..\..\out\%DART_CONFIGURATION%\dart.exe" %arguments%
111 changes: 111 additions & 0 deletions sdk_nnbd/bin/dart2aot
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/usr/bin/env bash
# Copyright (c) 2019, 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.

# Script for generating AOT snapshot in two steps:
# - Compilation to kernel with additional AOT specific transformations.
# - Compilation of kernel into snapshot using gen_snapshot.

# Parse incoming arguments and extract the value of --packages option if any
# was passed. Split options (--xyz) and non-options into two separate arrays.
# All options will be passed to gen_snapshot, while --packages will be
# passed to the CFE (Common Front-End).

set -e

OPTIONS=()
GEN_KERNEL_OPTIONS=()
PACKAGES=
BUILD_ELF=0

ARGV=()
for arg in "$@"; do
case $arg in
--packages=*)
PACKAGES="$arg"
;;
--enable-asserts)
GEN_KERNEL_OPTIONS+=("$arg")
OPTIONS+=("$arg")
;;
--tfa | \
--no-tfa | \
-D* )
GEN_KERNEL_OPTIONS+=("$arg")
;;
--build-elf)
BUILD_ELF=1
;;
--*)
OPTIONS+=("$arg")
;;
*)
ARGV+=("$arg")
;;
esac
done

if [ "${#ARGV[@]}" -ne 2 ]; then
echo "Usage: $0 [options] <dart-source-file> <dart-aot-file>"
echo ""
echo "Dart AOT (ahead-of-time) compile Dart source code into native machine code."
exit 1
fi

SOURCE_FILE="${ARGV[0]}"
SNAPSHOT_FILE="${ARGV[1]}"

if [ $BUILD_ELF -eq 1 ]; then
GEN_SNAPSHOT_OPTION="--snapshot-kind=app-aot-assembly"
GEN_SNAPSHOT_FILENAME="--assembly=${SNAPSHOT_FILE}.S"
else
GEN_SNAPSHOT_OPTION="--snapshot-kind=app-aot-blobs"
GEN_SNAPSHOT_FILENAME="--blobs_container_filename=${SNAPSHOT_FILE}"
fi

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"
GEN_SNAPSHOT="$BIN_DIR/utils/gen_snapshot"

SNAPSHOT_DIR="$BIN_DIR/snapshots"
SNAPSHOT="$SNAPSHOT_DIR/gen_kernel.dart.snapshot"

# Step 1: Generate Kernel binary from the input Dart source.
"$DART" \
"${SNAPSHOT}" \
--platform "${SDK_DIR}/lib/_internal/vm_platform_strong.dill" \
--aot \
-Ddart.vm.product=true \
"${GEN_KERNEL_OPTIONS[@]}" \
$PACKAGES \
-o "$SNAPSHOT_FILE.dill" \
"$SOURCE_FILE"

# Step 2: Generate snapshot from the Kernel binary.
"$GEN_SNAPSHOT" \
"$GEN_SNAPSHOT_OPTION" \
"$GEN_SNAPSHOT_FILENAME" \
"${OPTIONS[@]}" \
"$SNAPSHOT_FILE.dill"

# Step 3: Assemble the assembly file into an ELF object.
if [ $BUILD_ELF -eq 1 ]; then
gcc -shared -o "$SNAPSHOT_FILE" "${SNAPSHOT_FILE}.S"
fi
58 changes: 58 additions & 0 deletions sdk_nnbd/bin/dart2aot.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@echo off
REM Copyright (c) 2019, 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%

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 DART=%BIN_DIR%\dart.exe
set GEN_KERNEL=%BIN_DIR%\snapshots\gen_kernel.dart.snapshot
set VM_PLATFORM_STRONG=%SDK_DIR%\lib\_internal\vm_platform_strong.dill
set GEN_SNAPSHOT=%BIN_DIR%\utils\gen_snapshot.exe

set SOURCE_FILE=%1
set SNAPSHOT_FILE=%2
set GEN_SNAPSHOT_OPTION=--snapshot-kind=app-aot-blobs
set GEN_SNAPSHOT_FILENAME=--blobs_container_filename=%SNAPSHOT_FILE%

REM Step 1: Generate Kernel binary from the input Dart source.
%DART% %GEN_KERNEL% --platform %VM_PLATFORM_STRONG% --aot -Ddart.vm.product=true -o %SNAPSHOT_FILE%.dill %SOURCE_FILE%

REM Step 2: Generate snapshot from the Kernel binary.
%GEN_SNAPSHOT% %GEN_SNAPSHOT_OPTION% %GEN_SNAPSHOT_FILENAME% %SNAPSHOT_FILE%.dill

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
55 changes: 55 additions & 0 deletions sdk_nnbd/bin/dart2js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/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"

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

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

DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"

DART2JS="package:compiler/src/dart2js.dart"

exec "$DART" "--packages=$DART_ROOT/.packages" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@"
60 changes: 60 additions & 0 deletions sdk_nnbd/bin/dart2js.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@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 EXTRA_OPTIONS=
set EXTRA_VM_OPTIONS=

if _%DART2JS_DEVELOPER_MODE%_ == _1_ (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --enable-asserts
)

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 DART2JS=%DART_ROOT%\pkg\compiler\lib\src\dart2js.dart

"%DART%" "--packages=%DART_ROOT%\.packages" %EXTRA_VM_OPTIONS% "%DART2JS%" %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
Loading

0 comments on commit 004d49b

Please sign in to comment.