Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: pkg/dev_compiler/tool/ddc

Issue 2815913002: add scripts to run/debug DDC output on simple test cases (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/tool/ddw » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/ddc
diff --git a/pkg/dev_compiler/tool/ddc b/pkg/dev_compiler/tool/ddc
new file mode 100755
index 0000000000000000000000000000000000000000..0fa6f37645699ee6987da21adcf69d8420bfe6cf
--- /dev/null
+++ b/pkg/dev_compiler/tool/ddc
@@ -0,0 +1,27 @@
+#!/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
+DDC_PATH=$( cd $( dirname "${BASH_SOURCE[0]}" )/.. && pwd )
+BASENAME=$( basename "${1%.*}")
+LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
+export NODE_PATH=$DDC_PATH/lib/js/common:$LIBROOT:$NODE_PATH
+dart -c $DDC_PATH/bin/dartdevc.dart --modules=node --library-root=$LIBROOT \
+ --dart-sdk-summary=$DDC_PATH/lib/sdk/ddc_sdk.sum \
+ -o $LIBROOT/$BASENAME.js $*
+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 sdk = require(\"dart_sdk\");
+ let main = require(\"$BASENAME\").$BASENAME.main;
+ sdk._isolate_helper.startRootIsolate(main, []);" \
+ > $LIBROOT/$BASENAME.run.js
+node $BASENAME.run.js
+popd > /dev/null
« no previous file with comments | « no previous file | pkg/dev_compiler/tool/ddw » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698