Skip to content

Commit 93a2d07

Browse files
petrhosekabarth
authored andcommitted
Use prebuilt Dart snapshot when assembling bundle (flutter#6660)
This is causing issues when integratting Flutter into GN as the generated depfile refers to snapshot as the target instead of the bundle. We instead use a separate GN action to generate the snapshot use the Flutter compiler to only assemble the bundle.
1 parent 223f416 commit 93a2d07

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

packages/flutter_tools/bin/fuchsia_builder.dart

+1-12
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,26 @@ import '../lib/src/cache.dart';
1313
import '../lib/src/flx.dart';
1414
import '../lib/src/globals.dart';
1515

16-
const String _kOptionSnapshotter = 'snapshotter-path';
17-
const String _kOptionTarget = 'target';
1816
const String _kOptionPackages = 'packages';
1917
const String _kOptionOutput = 'output-file';
2018
const String _kOptionHeader = 'header';
2119
const String _kOptionSnapshot = 'snapshot';
22-
const String _kOptionDepfile = 'depfile';
2320
const String _kOptionWorking = 'working-dir';
2421
const List<String> _kOptions = const <String>[
25-
_kOptionSnapshotter,
26-
_kOptionTarget,
2722
_kOptionPackages,
2823
_kOptionOutput,
2924
_kOptionHeader,
3025
_kOptionSnapshot,
31-
_kOptionDepfile,
3226
_kOptionWorking,
3327
];
3428

3529
Future<Null> main(List<String> args) async {
3630
context[Logger] = new StdoutLogger();
3731
final ArgParser parser = new ArgParser()
38-
..addOption(_kOptionSnapshotter, help: 'The snapshotter executable')
39-
..addOption(_kOptionTarget, help: 'The entry point into the app')
4032
..addOption(_kOptionPackages, help: 'The .packages file')
4133
..addOption(_kOptionOutput, help: 'The generated flx file')
4234
..addOption(_kOptionHeader, help: 'The header of the flx file')
4335
..addOption(_kOptionSnapshot, help: 'The generated snapshot file')
44-
..addOption(_kOptionDepfile, help: 'The generated dependency file')
4536
..addOption(_kOptionWorking,
4637
help: 'The directory where to put temporary files');
4738
final ArgResults argResults = parser.parse(args);
@@ -52,13 +43,11 @@ Future<Null> main(List<String> args) async {
5243
Cache.flutterRoot = Platform.environment['FLUTTER_ROOT'];
5344
String outputPath = argResults[_kOptionOutput];
5445
final int buildResult = await build(
55-
snapshotterPath: argResults[_kOptionSnapshotter],
56-
mainPath: argResults[_kOptionTarget],
5746
outputPath: outputPath,
5847
snapshotPath: argResults[_kOptionSnapshot],
59-
depfilePath: argResults[_kOptionDepfile],
6048
workingDirPath: argResults[_kOptionWorking],
6149
packagesPath: argResults[_kOptionPackages],
50+
precompiledSnapshot: true,
6251
includeRobotoFonts: true,
6352
);
6453
if (buildResult != 0) {

packages/flutter_tools/lib/src/flx.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ Future<int> build({
9090
depfilePath ??= defaultDepfilePath;
9191
workingDirPath ??= getAssetBuildDirectory();
9292
packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
93-
File snapshotFile;
9493

9594
if (!precompiledSnapshot) {
9695
ensureDirectoryExists(snapshotPath);
@@ -108,10 +107,10 @@ Future<int> build({
108107
printError('Failed to run the Flutter compiler. Exit code: $result');
109108
return result;
110109
}
111-
112-
snapshotFile = new File(snapshotPath);
113110
}
114111

112+
File snapshotFile = new File(snapshotPath);
113+
115114
return assemble(
116115
manifestPath: manifestPath,
117116
snapshotFile: snapshotFile,

0 commit comments

Comments
 (0)