Commit 011a9026 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Create and use a STILL_RECORDING shutdown stage (#8588)

parent b7f00a64
...@@ -147,7 +147,9 @@ abstract class IOSApp extends ApplicationPackage { ...@@ -147,7 +147,9 @@ abstract class IOSApp extends ApplicationPackage {
Directory bundleDir; Directory bundleDir;
try { try {
final Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_app_'); final Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_app_');
addShutdownHook(() async => await tempDir.delete(recursive: true)); addShutdownHook(() async {
await tempDir.delete(recursive: true);
}, ShutdownStage.STILL_RECORDING);
os.unzip(fs.file(applicationBinary), tempDir); os.unzip(fs.file(applicationBinary), tempDir);
final Directory payloadDir = fs.directory(fs.path.join(tempDir.path, 'Payload')); final Directory payloadDir = fs.directory(fs.path.join(tempDir.path, 'Payload'));
bundleDir = payloadDir.listSync().singleWhere(_isBundleDirectory); bundleDir = payloadDir.listSync().singleWhere(_isBundleDirectory);
......
...@@ -26,17 +26,21 @@ class ShutdownStage implements Comparable<ShutdownStage> { ...@@ -26,17 +26,21 @@ class ShutdownStage implements Comparable<ShutdownStage> {
/// The stage priority. Smaller values will be run before larger values. /// The stage priority. Smaller values will be run before larger values.
final int _priority; final int _priority;
/// The stage before the invocation recording (if one exists) is serialized
/// to disk. Tasks performed during this stage *will* be recorded.
static const ShutdownStage STILL_RECORDING = const ShutdownStage._(1);
/// The stage during which the invocation recording (if one exists) will be /// The stage during which the invocation recording (if one exists) will be
/// serialized to disk. Invocations performed after this stage will not be /// serialized to disk. Invocations performed after this stage will not be
/// recorded. /// recorded.
static const ShutdownStage SERIALIZE_RECORDING = const ShutdownStage._(1); static const ShutdownStage SERIALIZE_RECORDING = const ShutdownStage._(2);
/// The stage during which a serialized recording will be refined (e.g. /// The stage during which a serialized recording will be refined (e.g.
/// cleansed for tests, zipped up for bug reporting purposes, etc.). /// cleansed for tests, zipped up for bug reporting purposes, etc.).
static const ShutdownStage POST_PROCESS_RECORDING = const ShutdownStage._(2); static const ShutdownStage POST_PROCESS_RECORDING = const ShutdownStage._(3);
/// The stage during which temporary files and directories will be deleted. /// The stage during which temporary files and directories will be deleted.
static const ShutdownStage CLEANUP = const ShutdownStage._(3); static const ShutdownStage CLEANUP = const ShutdownStage._(4);
@override @override
int compareTo(ShutdownStage other) => _priority.compareTo(other._priority); int compareTo(ShutdownStage other) => _priority.compareTo(other._priority);
......
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