Revert "[flutter_tools] move engine unpack to the flutter tool (#50707)" (#51076)

This reverts commit 0a623e879c.
This commit is contained in:
Francisco Magdaleno
2020-02-19 13:55:48 -08:00
committed by GitHub
parent 0a623e879c
commit 6815e72086
3 changed files with 20 additions and 140 deletions

View File

@@ -19,69 +19,6 @@ import 'assets.dart';
import 'dart.dart';
import 'icon_tree_shaker.dart';
/// Copy the Flutter.framework and podspec from the engine cache.
class UnpackIOSEngine extends Target {
const UnpackIOSEngine();
@override
List<String> get depfiles => <String>['ios_engine.d'];
@override
List<Target> get dependencies => const <Target>[];
@override
List<Source> get inputs => const <Source>[];
@override
String get name => 'unpack_ios_engine';
@override
List<Source> get outputs => <Source>[];
@override
Future<void> build(Environment environment) async {
if (environment.defines[kBuildMode] == null) {
throw MissingDefineException(kBuildMode, 'aot_assembly');
}
final FlutterProject flutterProject = FlutterProject.current();
final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]);
final String iosFramework = globals.artifacts
.getArtifactPath(Artifact.flutterFramework, mode: buildMode, platform: TargetPlatform.ios);
final String iosPodfile = globals.fs.directory(iosFramework)
.parent.childFile('Flutter.podspec').path;
final List<File> inputs = globals.fs.directory(iosFramework)
.listSync(recursive: true)
.whereType<File>()
.toList()..add(globals.fs.file(iosPodfile));
Directory outputDirectory = environment.outputDir;
if (flutterProject.isModule) {
outputDirectory = environment.outputDir.childDirectory('engine')
..createSync(recursive: true);
}
await globals.processManager.run(<String>[
'cp',
'-r',
'--',
iosFramework,
outputDirectory.path,
]);
await globals.processManager.run(<String>[
'cp',
'-r',
'--',
iosPodfile,
outputDirectory.path,
]);
final List<File> outputs = outputDirectory
.listSync(recursive: true)
.whereType<File>()
.toList();
final Depfile depfile = Depfile(inputs, outputs);
depfile.writeToFile(environment.buildDir.childFile('ios_engine.d'));
}
}
/// Supports compiling a dart kernel file to an assembly file.
///
/// If more than one iOS arch is provided, then this rule will
@@ -295,7 +232,6 @@ abstract class IosAssetBundle extends Target {
@override
List<Target> get dependencies => const <Target>[
KernelSnapshot(),
UnpackIOSEngine(),
];
@override