From e8e9d4633c28fb0c62e7b19ba4dce170d7f464a8 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 24 May 2016 16:29:13 -0700 Subject: [PATCH] Workaround https://github.com/dart-lang/sdk/issues/26362 (#4171) When building AOT, we now run `pub get` instead of printing an error telling the user to run `pub get`. We can remove this code once the bug reference above is fixed (should be a couple days). --- packages/flutter_tools/lib/src/commands/build_aot.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart index e012ddd124..6940183ca7 100644 --- a/packages/flutter_tools/lib/src/commands/build_aot.dart +++ b/packages/flutter_tools/lib/src/commands/build_aot.dart @@ -9,6 +9,7 @@ import 'package:path/path.dart' as path; import '../base/process.dart'; import '../build_info.dart'; +import '../dart/sdk.dart'; import '../globals.dart'; import '../runner/flutter_command.dart'; import 'run.dart'; @@ -118,6 +119,12 @@ String buildAotSnapshot( String vmEntryPoints = path.join(entryPointsDir, 'dart_vm_entry_points.txt'); String packagesPath = path.absolute(Directory.current.path, 'packages'); + if (!FileSystemEntity.isDirectorySync(packagesPath)) { + printStatus('Missing packages directory. Running `pub get` to work around\n' + + 'https://github.com/dart-lang/sdk/issues/26362'); + // We don't use [pubGet] because we explicitly want to avoid --no-package-symlinks. + runCheckedSync([sdkBinaryName('pub'), 'get', '--no-precompile']); + } if (!FileSystemEntity.isDirectorySync(packagesPath)) { printError('Could not find packages directory: $packagesPath\n' + 'Did you run `pub get` in this directory?');