| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert' show JSON; | 6 import 'dart:convert' show JSON; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 10 | 10 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 mainPath: findMainDartFile(target), | 546 mainPath: findMainDartFile(target), |
| 547 precompiledSnapshot: isAotBuildMode(buildMode), | 547 precompiledSnapshot: isAotBuildMode(buildMode), |
| 548 includeRobotoFonts: false); | 548 includeRobotoFonts: false); |
| 549 | 549 |
| 550 if (flxPath == null) | 550 if (flxPath == null) |
| 551 throwToolExit(null); | 551 throwToolExit(null); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // Build an AOT snapshot if needed. | 554 // Build an AOT snapshot if needed. |
| 555 if (isAotBuildMode(buildMode) && aotPath == null) { | 555 if (isAotBuildMode(buildMode) && aotPath == null) { |
| 556 aotPath = await buildAotSnapshot(findMainDartFile(target), platform, buildMo
de); | 556 String dartFile = findMainDartFile(target); |
| 557 if (aotPath == null) | 557 String dillFile = await buildDilFile(dartFile); |
| 558 aotPath = await buildAotSnapshot(dillFile != null ? dillFile : dartFile, pla
tform, buildMode); |
| 559 if (aotPath == null) { |
| 558 throwToolExit('Failed to build AOT snapshot'); | 560 throwToolExit('Failed to build AOT snapshot'); |
| 561 } |
| 559 } | 562 } |
| 560 | 563 |
| 561 if (aotPath != null) { | 564 if (aotPath != null) { |
| 562 if (!isAotBuildMode(buildMode)) | 565 if (!isAotBuildMode(buildMode)) |
| 563 throwToolExit('AOT snapshot can not be used in build mode $buildMode'); | 566 throwToolExit('AOT snapshot can not be used in build mode $buildMode'); |
| 564 if (!FileSystemEntity.isDirectorySync(aotPath)) | 567 if (!FileSystemEntity.isDirectorySync(aotPath)) |
| 565 throwToolExit('AOT snapshot does not exist: $aotPath'); | 568 throwToolExit('AOT snapshot does not exist: $aotPath'); |
| 566 for (String aotFilename in kAotSnapshotFiles) { | 569 for (String aotFilename in kAotSnapshotFiles) { |
| 567 String aotFilePath = path.join(aotPath, aotFilename); | 570 String aotFilePath = path.join(aotPath, aotFilename); |
| 568 if (!FileSystemEntity.isFileSync(aotFilePath)) | 571 if (!FileSystemEntity.isFileSync(aotFilePath)) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 } | 649 } |
| 647 | 650 |
| 648 String _getTargetBuildTypeToken(TargetPlatform platform, BuildMode buildMode, Fi
le outputBinary) { | 651 String _getTargetBuildTypeToken(TargetPlatform platform, BuildMode buildMode, Fi
le outputBinary) { |
| 649 String buildType = getNameForTargetPlatform(platform) + '-' + getModeName(buil
dMode); | 652 String buildType = getNameForTargetPlatform(platform) + '-' + getModeName(buil
dMode); |
| 650 if (tools.isLocalEngine) | 653 if (tools.isLocalEngine) |
| 651 buildType += ' [${tools.engineBuildPath}]'; | 654 buildType += ' [${tools.engineBuildPath}]'; |
| 652 if (outputBinary.existsSync()) | 655 if (outputBinary.existsSync()) |
| 653 buildType += ' [${outputBinary.lastModifiedSync().millisecondsSinceEpoch}]'; | 656 buildType += ' [${outputBinary.lastModifiedSync().millisecondsSinceEpoch}]'; |
| 654 return buildType; | 657 return buildType; |
| 655 } | 658 } |
| OLD | NEW |