@@ -8,6 +8,7 @@ import 'package:built_collection/built_collection.dart';
8
8
import 'package:io/io.dart' ;
9
9
import 'package:package_config/package_config.dart' ;
10
10
11
+ import '../exceptions.dart' ;
11
12
import '../internal.dart' ;
12
13
import 'compiler.dart' ;
13
14
import 'depfiles.dart' ;
@@ -119,6 +120,7 @@ class Bootstrapper {
119
120
Future <void > _checkBuildSource ({required bool force}) async {
120
121
if (! force && buildSourceDepfile.outputIsUpToDate ()) {
121
122
buildLog.debug ('build script up to date' );
123
+ // Generate the build script anyway so warnings are issued.
122
124
buildYamlHasChanged = false ;
123
125
} else {
124
126
buildLog.debug ('build script update (force: $force )' );
@@ -145,7 +147,16 @@ class Bootstrapper {
145
147
buildDillHasChanged = true ;
146
148
147
149
final result = await compiler.compile ();
148
- if (! result.succeeded) throw 'failed: ${result .messages }' ;
150
+ if (! result.succeeded) {
151
+ if (result.messages != null ) {
152
+ buildLog.error (result.messages! );
153
+ }
154
+ buildLog.error (
155
+ 'Failed to compile build script. '
156
+ 'Check builder definitions and generated script $scriptLocation .' ,
157
+ );
158
+ throw const CannotBuildException ();
159
+ }
149
160
// TODO(davidmorgan): this is weird.
150
161
dillDepfile.loadDeps ();
151
162
dillDepfile.write ();
0 commit comments