| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 set -e | 6 set -e |
| 7 | 7 |
| 8 REPO_DIR="$(git rev-parse --show-toplevel)" | 8 REPO_DIR="$(git rev-parse --show-toplevel)" |
| 9 | 9 |
| 10 # TODO(ahe): We currently rely on the Dart VM wrapper script to define | 10 # TODO(ahe): We currently rely on the Dart VM wrapper script to define |
| 11 # DART_CONFIGURATION for locating platform.dill. | 11 # DART_CONFIGURATION for locating platform.dill. |
| 12 DART_VM="${REPO_DIR}/sdk/bin/dart" | 12 DART_VM="${REPO_DIR}/sdk/bin/dart" |
| 13 | 13 |
| 14 TOOL_DIR="${REPO_DIR}/pkg/front_end/tool/_fasta" | 14 TOOL_DIR="${REPO_DIR}/pkg/front_end/tool/_fasta" |
| 15 | 15 |
| 16 KERNEL_BIN="${REPO_DIR}/pkg/kernel/bin" | 16 KERNEL_BIN="${REPO_DIR}/pkg/kernel/bin" |
| 17 | 17 |
| 18 function stop { | 18 function stop { |
| 19 echo "$@" >&2 | 19 echo "$@" >&2 |
| 20 exit 1 | 20 exit 1 |
| 21 } | 21 } |
| 22 | 22 |
| 23 DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64} |
| 24 |
| 23 case "${1//_/-}" in | 25 case "${1//_/-}" in |
| 24 abcompile) SCRIPT="${TOOL_DIR}/abcompile.dart";; | 26 abcompile) SCRIPT="${TOOL_DIR}/abcompile.dart";; |
| 25 analyzer-compile) SCRIPT="${TOOL_DIR}/analyzer_compile.dart";; | 27 analyzer-compile) SCRIPT="${TOOL_DIR}/analyzer_compile.dart";; |
| 26 compile) SCRIPT="${TOOL_DIR}/compile.dart";; | 28 compile) SCRIPT="${TOOL_DIR}/compile.dart";; |
| 27 compile-platform) SCRIPT="${TOOL_DIR}/compile_platform.dart";; | 29 compile-platform) SCRIPT="${TOOL_DIR}/compile_platform.dart";; |
| 28 compile-platform-dartk) | 30 compile-platform-dartk) |
| 29 SCRIPT="${TOOL_DIR}/compile_platform_dartk.dart" | 31 SCRIPT="${TOOL_DIR}/compile_platform_dartk.dart" |
| 30 if [ "$#" != "2" ]; then | 32 if [ "$#" != "2" ]; then |
| 31 stop "Usage: $1 file" | 33 stop "Usage: $1 file" |
| 32 fi | 34 fi |
| 33 ;; | 35 ;; |
| 34 log) SCRIPT="${TOOL_DIR}/log_analyzer.dart";; | 36 log) SCRIPT="${TOOL_DIR}/log_analyzer.dart";; |
| 35 logd) SCRIPT="${TOOL_DIR}/log_collector.dart";; | 37 logd) SCRIPT="${TOOL_DIR}/log_collector.dart";; |
| 36 outline) SCRIPT="${TOOL_DIR}/outline.dart";; | 38 outline) SCRIPT="${TOOL_DIR}/outline.dart";; |
| 37 parser) SCRIPT="${TOOL_DIR}/parser.dart";; | 39 parser) SCRIPT="${TOOL_DIR}/parser.dart";; |
| 38 run) SCRIPT="${TOOL_DIR}/run.dart";; | 40 run) SCRIPT="${TOOL_DIR}/run.dart";; |
| 39 scanner) SCRIPT="${TOOL_DIR}/scanner.dart";; | 41 scanner) SCRIPT="${TOOL_DIR}/scanner.dart";; |
| 40 dump-ir) | 42 dump-ir) |
| 41 SCRIPT="${KERNEL_BIN}/dump.dart" | 43 SCRIPT="${KERNEL_BIN}/dump.dart" |
| 42 if [ "$#" = "2" ]; then | 44 if [ "$#" = "2" ]; then |
| 43 # Write to stdout if no target is given. | 45 # Write to stdout if no target is given. |
| 44 set -- "$@" /dev/fd/1 | 46 set -- "$@" /dev/fd/1 |
| 45 fi | 47 fi |
| 46 if [ "$#" != "3" ]; then | 48 if [ "$#" != "3" ]; then |
| 47 stop "Usage: $1 dillfile [output]" | 49 stop "Usage: $1 dillfile [output]" |
| 48 fi | 50 fi |
| 49 ;; | 51 ;; |
| 50 kernel-service) | 52 kernel-service) |
| 51 shift | 53 shift |
| 54 PATCHED_SDK_DIR=$( |
| 55 ls -d {xcodebuild,out}/${DART_CONFIGURATION}/patched_sdk 2>/dev/null \ |
| 56 | head -1) |
| 52 exec "${DART_VM}" -c -DDFE_VERBOSE=true \ | 57 exec "${DART_VM}" -c -DDFE_VERBOSE=true \ |
| 58 --platform=${PATCHED_SDK_DIR}/platform.dill \ |
| 53 --dfe="${REPO_DIR}/utils/kernel-service/kernel-service.dart" "$@" | 59 --dfe="${REPO_DIR}/utils/kernel-service/kernel-service.dart" "$@" |
| 54 ;; | 60 ;; |
| 55 testing) | 61 testing) |
| 56 SCRIPT="${REPO_DIR}/pkg/testing/bin/testing.dart" | 62 SCRIPT="${REPO_DIR}/pkg/testing/bin/testing.dart" |
| 57 set -- "$@" "--config=${REPO_DIR}/pkg/front_end/test/fasta/testing.json" | 63 set -- "$@" "--config=${REPO_DIR}/pkg/front_end/test/fasta/testing.json" |
| 58 ;; | 64 ;; |
| 59 generate-messages) SCRIPT="${TOOL_DIR}/generate_messages.dart";; | 65 generate-messages) SCRIPT="${TOOL_DIR}/generate_messages.dart";; |
| 60 *) | 66 *) |
| 61 stop "'$1' isn't a valid subcommand." | 67 stop "'$1' isn't a valid subcommand." |
| 62 ;; | 68 ;; |
| 63 esac | 69 esac |
| 64 | 70 |
| 65 shift | 71 shift |
| 66 | 72 |
| 67 DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64} exec "${DART_VM}" -c "${SCR
IPT}" "$@" | 73 exec "${DART_VM}" -c "${SCRIPT}" "$@" |
| OLD | NEW |