diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart index 6b098e2f501..b1e8f0f4dc4 100644 --- a/packages/flutter_tools/lib/src/commands/build_apk.dart +++ b/packages/flutter_tools/lib/src/commands/build_apk.dart @@ -239,7 +239,7 @@ Future<_ApkComponents> _findApkComponents( await parseServiceConfigs(components.services, jars: components.jars); - for (File file in [ + for (File file in [ components.manifest, components.icuData, components.libSkyShell, components.debugKeystore ]..addAll(components.jars)) { if (!file.existsSync()) { diff --git a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart index 1a657a18856..5de3a942d79 100644 --- a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart @@ -13,7 +13,7 @@ import '../base/process.dart'; import '../globals.dart'; import '../runner/flutter_command_runner.dart'; -Future _inflateXcodeArchive(String directory, List archiveBytes) async { +bool _inflateXcodeArchive(String directory, List archiveBytes) { printStatus('Unzipping Xcode project to local directory...'); // We cannot use ArchiveFile because this archive contains files that are exectuable @@ -21,28 +21,33 @@ Future _inflateXcodeArchive(String directory, List archiveBytes) asyn // or after creation. See https://github.com/dart-lang/sdk/issues/15078. // So we depend on the platform to unzip the archive for us. - Directory tempDir = await Directory.systemTemp.create(); + Directory tempDir = Directory.systemTemp.createTempSync('flutter_xcode'); File tempFile = new File(path.join(tempDir.path, 'FlutterXcode.zip'))..createSync(); tempFile.writeAsBytesSync(archiveBytes); try { + Directory dir = new Directory(directory); + // Remove the old generated project if one is present - runCheckedSync(['/bin/rm', '-rf', directory]); + if (dir.existsSync()) + dir.deleteSync(recursive: true); + // Create the directory so unzip can write to it - runCheckedSync(['/bin/mkdir', '-p', directory]); + dir.createSync(recursive: true); + // Unzip the Xcode project into the new empty directory - runCheckedSync(['/usr/bin/unzip', tempFile.path, '-d', directory]); + runCheckedSync(['/usr/bin/unzip', tempFile.path, '-d', dir.path]); } catch (error) { + printTrace('$error'); return false; } // Cleanup the temp directory after unzipping - runSync(['/bin/rm', '-rf', tempDir.path]); + tempDir.deleteSync(recursive: true); // Verify that we have an Xcode project Directory flutterProj = new Directory(path.join(directory, 'FlutterApplication.xcodeproj')); - bool flutterProjExists = await flutterProj.exists(); - if (!flutterProjExists) { + if (!flutterProj.existsSync()) { printError("${flutterProj.path} does not exist"); return false; } @@ -108,7 +113,7 @@ Future setupXcodeProjectHarness(String flutterProjectPath) async { } // Step 2: Inflate the archive into the user project directory - bool result = await _inflateXcodeArchive(xcodeprojPath, archiveBytes); + bool result = _inflateXcodeArchive(xcodeprojPath, archiveBytes); if (!result) { printError('Could not inflate the Xcode project archive.'); return 1;