Unverified Commit 99176578 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Fix handling --preview-dart-2 for ios (#14016)

* Fix handling --preview-dart-2 for ios

* final var
parent ccc0d294
......@@ -69,7 +69,7 @@ Future<Null> build({
}
DevFSContent kernelContent;
if (!precompiledSnapshot && previewDart2) {
if (previewDart2) {
final String kernelBinaryFilename = await compile(
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
incrementalCompilerByteStorePath: fs.path.absolute(getIncrementalCompilerByteStoreDirectory()),
......
......@@ -306,7 +306,7 @@ class IOSSimulator extends Device {
printTrace('Building ${app.name} for $id.');
try {
await _setupUpdatedApplicationBundle(app, debuggingOptions.buildInfo.flavor);
await _setupUpdatedApplicationBundle(app, debuggingOptions.buildInfo);
} on ToolExit catch (e) {
printError(e.message);
return new LaunchResult.failed();
......@@ -322,7 +322,7 @@ class IOSSimulator extends Device {
if (!prebuiltApplication) {
args.addAll(<String>[
'--flutter-assets-dir=${fs.path.absolute(getAssetBuildDirectory())}',
'--dart-main=${fs.path.absolute(mainPath)}',
'--dart-main=${fs.path.absolute(mainPath)}${debuggingOptions.buildInfo.previewDart2?".dill":""}',
'--packages=${fs.path.absolute('.packages')}',
]);
}
......@@ -379,17 +379,25 @@ class IOSSimulator extends Device {
return criteria.reduce((bool a, bool b) => a && b);
}
Future<Null> _setupUpdatedApplicationBundle(ApplicationPackage app, String flavor) async {
await _sideloadUpdatedAssetsForInstalledApplicationBundle(app);
Future<Null> _setupUpdatedApplicationBundle(ApplicationPackage app, BuildInfo buildInfo) async {
await _sideloadUpdatedAssetsForInstalledApplicationBundle(app, buildInfo);
if (!await _applicationIsInstalledAndRunning(app))
return _buildAndInstallApplicationBundle(app, flavor);
return _buildAndInstallApplicationBundle(app, buildInfo);
}
Future<Null> _buildAndInstallApplicationBundle(ApplicationPackage app, String flavor) async {
Future<Null> _buildAndInstallApplicationBundle(ApplicationPackage app, BuildInfo buildInfo) async {
// Step 1: Build the Xcode project.
// The build mode for the simulator is always debug.
final XcodeBuildResult buildResult = await buildXcodeProject(app: app, buildInfo: new BuildInfo(BuildMode.debug, flavor), buildForDevice: false);
final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor,
previewDart2: buildInfo.previewDart2,
strongMode: buildInfo.strongMode,
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
preferSharedLibrary: buildInfo.preferSharedLibrary);
final XcodeBuildResult buildResult = await buildXcodeProject(app: app, buildInfo: debugBuildInfo, buildForDevice: false);
if (!buildResult.success)
throwToolExit('Could not build the application for the simulator.');
......@@ -404,8 +412,8 @@ class IOSSimulator extends Device {
await SimControl.instance.install(id, fs.path.absolute(bundle.path));
}
Future<Null> _sideloadUpdatedAssetsForInstalledApplicationBundle(ApplicationPackage app) =>
flx.build(precompiledSnapshot: true);
Future<Null> _sideloadUpdatedAssetsForInstalledApplicationBundle(ApplicationPackage app, BuildInfo buildInfo) =>
flx.build(precompiledSnapshot: true, previewDart2: buildInfo.previewDart2, strongMode: buildInfo.strongMode);
@override
Future<bool> stopApp(ApplicationPackage app) async {
......
......@@ -341,8 +341,10 @@ class FlutterCommandRunner extends CommandRunner<Null> {
throwToolExit('No Flutter engine build found at $engineBuildPath.', exitCode: 2);
}
final String hostLocalEngine = 'host_' + localEngine.substring(localEngine.indexOf('_') + 1);
final String engineHostBuildPath = fs.path.normalize(fs.path.join(enginePath, 'out', hostLocalEngine));
final String basename = fs.path.basename(engineBuildPath);
final String engineHostBuildPath = fs.path.normalize(fs.path.join(
fs.path.dirname(engineBuildPath),
'host_' + basename.substring(basename.indexOf('_') + 1)));
return new EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment