[ddc] delete unused/unsupported internal scripts to run ddc.

All internal development uses pkg/dev_compiler/tool/ddb instead

Change-Id: I1a3cd9cef48063be16b2aa0c3bcb950e4c2b248d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229305
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2022-01-27 21:13:41 +00:00 committed by Commit Bot
parent 5173fd2d22
commit 93e87899f4
4 changed files with 24 additions and 259 deletions

View file

@ -10,22 +10,21 @@ import 'dart:io';
import 'package:bazel_worker/bazel_worker.dart';
import 'package:bazel_worker/testing.dart';
import 'package:path/path.dart' show dirname, join, joinAll;
import 'package:test/test.dart';
Directory tmp = Directory.systemTemp.createTempSync('ddc_worker_test');
File file(String path) => File(join(tmp.path, joinAll(path.split('/'))));
File file(String path) => File.fromUri(tmp.uri.resolve(path));
void main() {
var baseArgs = <String>[];
final binDir = dirname(Platform.resolvedExecutable);
// Note, the bots use the dart binary in the top-level build directory.
// On windows, this is a .bat file.
final dartdevc = 'dartdevc${Platform.isWindows ? ".bat" : ""}';
final executable = binDir.endsWith('bin')
? join(binDir, dartdevc)
: join(binDir, 'dart-sdk', 'bin', dartdevc);
final executableArgs = <String>[];
final executableArgs = <String>[
Platform.script.resolve('../../bin/dartdevc.dart').path,
'--sound-null-safety',
'--dart-sdk-summary',
Uri.parse(Platform.resolvedExecutable)
.resolve('ddc_outline_sound.dill')
.path
];
group('DDC: Hello World', () {
final argsFile = file('hello_world.args');
final inputDartFile = file('hello_world.dart');
@ -54,7 +53,7 @@ void main() {
test('can compile in worker mode', () async {
var args = executableArgs.toList()..add('--persistent_worker');
var process = await Process.start(executable, args);
var process = await Process.start(Platform.executable, args);
var messageGrouper = AsyncMessageGrouper(process.stdout);
var request = WorkRequest();
@ -97,7 +96,7 @@ void main() {
test('can compile in basic mode', () {
var args = executableArgs.toList()..addAll(compilerArgs);
var result = Process.runSync(executable, args);
var result = Process.runSync(Platform.executable, args);
expect(result.exitCode, EXIT_CODE_OK);
expect(result.stdout, isEmpty);
@ -109,7 +108,7 @@ void main() {
var args = List<String>.from(executableArgs)
..add('--does-not-exist')
..addAll(compilerArgs);
var result = Process.runSync(executable, args);
var result = Process.runSync(Platform.executable, args);
expect(result.exitCode, 64);
expect(result.stdout,
@ -123,7 +122,7 @@ void main() {
..add('--does-not-exist')
..add('--ignore-unrecognized-flags')
..addAll(compilerArgs);
var result = Process.runSync(executable, args);
var result = Process.runSync(Platform.executable, args);
expect(result.exitCode, EXIT_CODE_OK);
expect(result.stdout, isEmpty);
@ -135,7 +134,7 @@ void main() {
argsFile.createSync();
argsFile.writeAsStringSync(compilerArgs.join('\n'));
var args = executableArgs.toList()..add('@${argsFile.path}');
var process = await Process.start(executable, args);
var process = await Process.start(Platform.executable, args);
await stderr.addStream(process.stderr);
var futureProcessOutput = process.stdout.map(utf8.decode).toList();
@ -149,7 +148,7 @@ void main() {
..add('--modules')
..add('legacy')
..addAll(compilerArgs);
var result = Process.runSync(executable, args);
var result = Process.runSync(Platform.executable, args);
expect(result.exitCode, EXIT_CODE_OK);
expect(result.stdout, isEmpty);
@ -187,7 +186,7 @@ void main() {
test('can compile in basic mode', () {
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -203,7 +202,7 @@ void main() {
expect(greetingSummary.existsSync(), isTrue);
result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -223,7 +222,7 @@ void main() {
test('reports error on overlapping summaries', () {
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -239,7 +238,7 @@ void main() {
expect(greetingSummary.existsSync(), isTrue);
result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -255,7 +254,7 @@ void main() {
expect(greeting2Summary.existsSync(), isTrue);
result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -289,7 +288,7 @@ void main() {
test('incorrect usage', () {
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -304,7 +303,7 @@ void main() {
test('compile errors', () {
badFileDart.writeAsStringSync('main() => "hello world"');
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -340,7 +339,7 @@ void main() {
test('works if part and library supplied', () {
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[
@ -359,7 +358,7 @@ void main() {
test('works if part is not supplied', () {
var result = Process.runSync(
executable,
Platform.executable,
executableArgs +
baseArgs +
[

View file

@ -1,120 +0,0 @@
#!/bin/bash
#
# Compiles code with DDC and runs the resulting code in node.js.
#
# The first script supplied should be the one with `main()`.
#
# Saves the output in the same directory as the sources for convenient
# inspection, modification or rerunning the code.
set -e
function follow_links() {
file="$1"
while [ -h "$file" ]; do
file="$(readlink "$file")"
done
echo "$file"
}
PROG_NAME="$(follow_links "$BASH_SOURCE")"
SDK_DIR="$( cd "${PROG_NAME%/*}/../../.."; pwd -P)"
if [[ `uname` == 'Darwin' ]];
then
OUT_DIR="$SDK_DIR"/xcodebuild
else
OUT_DIR="$SDK_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" "DebugARM" "DebugARM64")
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
ROOT_OUT_DIR="$OUT_DIR"/"$DART_CONFIGURATION"
GEN_DIR="$ROOT_OUT_DIR"/gen/utils/dartdevc
KERNEL=false
if [ "$1" = "-k" ]; then
KERNEL=true
shift
fi
BASENAME=$( basename "${1%.*}")
LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
if [ "$KERNEL" = true ]; then
if [ ! -e $ROOT_OUT_DIR/ddc_sdk.dill ]; then
echo "DDC SDK must be built first, please run:"
echo " pushd $SDKDIR"
echo " ./tools/build.py -m release dartdevc_kernel_sdk"
exit 1
fi
NODE_PATH=$GEN_DIR/kernel/common:$LIBROOT:$NODE_PATH
$SDK_DIR/sdk/bin/dartdevc --kernel --modules=node \
--dart-sdk-summary=$ROOT_OUT_DIR/ddc_sdk.dill \
-o $LIBROOT/$BASENAME.js $*
else
if [ ! -e $GEN_DIR/ddc_sdk.sum ]; then
echo "DDC SDK must be built first, please run:"
echo " pushd $SDKDIR"
echo " ./tools/build.py -m release dartdevc_sdk"
exit 1
fi
NODE_PATH=$GEN_DIR/js/common:$LIBROOT:$NODE_PATH
$SDK_DIR/sdk/bin/dartdevc --modules=node \
--library-root=$LIBROOT --dart-sdk-summary=$GEN_DIR/ddc_sdk.sum \
-o $LIBROOT/$BASENAME.js $*
fi
export NODE_PATH
pushd $LIBROOT > /dev/null
# TODO(jmesserly): we could have this output the same content as the devtool
# script, so you could debug the output without recompiling?
echo "
let source_maps;
try {
source_maps = require('source-map-support');
source_maps.install();
} catch(e) {
}
let sdk = require(\"dart_sdk\");
let main = require(\"./$BASENAME\").$BASENAME.main;
try {
sdk._isolate_helper.startRootIsolate(main, []);
} catch(e) {
if (!source_maps) {
console.log('For Dart source maps: npm install source-map-support');
}
console.error(e);
process.exit(1);
}" \
> $LIBROOT/$BASENAME.run.js
node $BASENAME.run.js || exit 1
popd > /dev/null

View file

@ -1,48 +0,0 @@
#!/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/pkg/dev_compiler/bin/dartdevc.dart"
exec "$DART" "--packages=$DART_ROOT/.packages" --enable_experiment=non-nullable "${EXTRA_VM_OPTIONS[@]}" "$DEV_COMPILER" "$SDK_ARG" "$@"

View file

@ -1,66 +0,0 @@
@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
"%DART%" "--packages=%DART_ROOT%\.packages" %EXTRA_VM_OPTIONS% "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\out\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 ^
^| %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