File tree Expand file tree Collapse file tree 6 files changed +44
-2
lines changed
Expand file tree Collapse file tree 6 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ class CompileJSCommand extends DartdevCommand<int> {
6565
6666 @override
6767 FutureOr <int > run () async {
68+ if (! Sdk .checkSnapshotExists (sdk.dart2js)) {
69+ return 255 ;
70+ }
6871 // We expect a single rest argument; the dart entry point.
6972 if (argResults.rest.length != 1 ) {
7073 log.stderr ('Missing Dart entry point.' );
@@ -176,6 +179,10 @@ Remove debugging information from the output and save it separately to the speci
176179
177180 @override
178181 FutureOr <int > run () async {
182+ if (! Sdk .checkSnapshotExists (genKernel) ||
183+ ! Sdk .checkSnapshotExists (genSnapshot)) {
184+ return 255 ;
185+ }
179186 // We expect a single rest argument; the dart entry point.
180187 if (argResults.rest.length != 1 ) {
181188 log.stderr ('Missing Dart entry point.' );
Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ class CreateCommand extends DartdevCommand {
9696 );
9797
9898 if (argResults['pub' ]) {
99+ if (! Sdk .checkSnapshotExists (sdk.pub)) {
100+ return 255 ;
101+ }
99102 log.stdout ('' );
100103 var progress = log.progress ('Running pub get' );
101104 var process = await startProcess (
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ class PubCommand extends DartdevCommand<int> {
2222 // Override [printUsage] for invocations of 'dart help pub' which won't
2323 // execute [run] below. Without this, the 'dart help pub' reports the
2424 // command pub with no commands or flags.
25+ if (! Sdk .checkSnapshotExists (sdk.pub)) {
26+ return ;
27+ }
2528 final command = sdk.pub;
2629 final args = ['help' ];
2730
@@ -42,6 +45,9 @@ class PubCommand extends DartdevCommand<int> {
4245
4346 @override
4447 FutureOr <int > run () async {
48+ if (! Sdk .checkSnapshotExists (sdk.pub)) {
49+ return 255 ;
50+ }
4551 final command = sdk.pub;
4652 var args = argResults.arguments;
4753
Original file line number Diff line number Diff line change @@ -122,7 +122,9 @@ Run a Dart file.''');
122122 _DebuggingSession debugSession;
123123 if (launchDds) {
124124 debugSession = _DebuggingSession ();
125- await debugSession.start ();
125+ if (! await debugSession.start ()) {
126+ return 255 ;
127+ }
126128 }
127129
128130 final script = Directory .current.uri
@@ -135,8 +137,14 @@ Run a Dart file.''');
135137}
136138
137139class _DebuggingSession {
138- Future <void > start () async {
140+ Future <bool > start () async {
139141 final serviceInfo = await Service .getInfo ();
142+ final ddsSnapshot = (dirname (sdk.dart).endsWith ('bin' ))
143+ ? sdk.ddsSnapshot
144+ : absolute (dirname (sdk.dart), 'gen' , 'dds.dart.snapshot' );
145+ if (! Sdk .checkSnapshotExists (ddsSnapshot)) {
146+ return false ;
147+ }
140148 final process = await Process .start (
141149 sdk.dart,
142150 [
@@ -157,5 +165,6 @@ class _DebuggingSession {
157165 });
158166
159167 await completer.future;
168+ return true ;
160169 }
161170}
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ class TestCommand extends DartdevCommand<int> {
1919
2020 @override
2121 void printUsage () {
22+ if (! Sdk .checkSnapshotExists (sdk.pub)) {
23+ return ;
24+ }
2225 final command = sdk.pub;
2326 final args = ['run' , 'test' , '--help' ];
2427
@@ -42,6 +45,9 @@ class TestCommand extends DartdevCommand<int> {
4245
4346 @override
4447 FutureOr <int > run () async {
48+ if (! Sdk .checkSnapshotExists (sdk.pub)) {
49+ return 255 ;
50+ }
4551 final command = sdk.pub;
4652 final testArgs = argResults.arguments.toList ();
4753
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import 'dart:io';
66
77import 'package:path/path.dart' as path;
88
9+ import 'core.dart' ;
10+
911final Sdk sdk = Sdk ();
1012
1113String get _computeSdkPath {
@@ -59,4 +61,13 @@ class Sdk {
5961
6062 static String _binName (String base ) =>
6163 Platform .isWindows ? '$base .bat' : base ;
64+
65+ static bool checkSnapshotExists (String snapshotPath) {
66+ if (! File (snapshotPath).existsSync ()) {
67+ log.stderr ('Could not find $snapshotPath . Have you built the full '
68+ 'Dart SDK?' );
69+ return false ;
70+ }
71+ return true ;
72+ }
6273}
You can’t perform that action at this time.
0 commit comments