use of io.flutter.utils.ProgressHelper in project flutter-intellij by flutter.
the class OpenInXcodeAction method openFile.
private static void openFile(@NotNull VirtualFile file) {
final Project project = ProjectUtil.guessProjectForFile(file);
final FlutterSdk sdk = project != null ? FlutterSdk.getFlutterSdk(project) : null;
if (sdk == null) {
FlutterSdkAction.showMissingSdkDialog(project);
return;
}
final PubRoot pubRoot = PubRoot.forFile(file);
if (pubRoot == null) {
FlutterMessages.showError("Error Opening Xcode", "Unable to run `flutter build` (no pub root found)");
return;
}
// Trigger an iOS build if necessary.
if (!hasBeenBuilt(pubRoot)) {
final ProgressHelper progressHelper = new ProgressHelper(project);
progressHelper.start("Building for iOS");
sdk.flutterBuild(pubRoot, "ios", "--debug").start(null, new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
progressHelper.done();
if (event.getExitCode() != 0) {
FlutterMessages.showError("Error Opening Xcode", "`flutter build` returned: " + event.getExitCode());
return;
}
openWithXcode(file.getPath());
}
});
} else {
openWithXcode(file.getPath());
}
}
Aggregations