Skip to content

Commit fbfb5bb

Browse files
authored
[CQ] stop blocking on FlutterStudioStartupActivity startup (#8093)
See: #8089 Tested on Meerkat, Mac OS. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
1 parent dc1de57 commit fbfb5bb

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

flutter-studio/src/io/flutter/FlutterStudioStartupActivity.java

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,42 @@
55
*/
66
package io.flutter;
77

8+
import com.intellij.openapi.application.ReadAction;
89
import com.intellij.openapi.project.Project;
910
import com.intellij.openapi.startup.StartupActivity;
11+
import com.intellij.util.concurrency.AppExecutorUtil;
1012
import io.flutter.android.AndroidModuleLibraryManager;
11-
//import io.flutter.project.FlutterProjectCreator;
13+
import io.flutter.dart.FlutterDartAnalysisServer;
1214
import io.flutter.settings.FlutterSettings;
1315
import io.flutter.utils.AddToAppUtils;
1416
import io.flutter.utils.AndroidUtils;
1517
import io.flutter.utils.GradleUtils;
1618
import org.jetbrains.annotations.NotNull;
1719

1820
public class FlutterStudioStartupActivity implements StartupActivity {
19-
20-
@Override
21-
public void runActivity(@NotNull Project project) {
21+
private static Void doNonBlockingStartup(@NotNull Project project) {
2222
if (AndroidUtils.isAndroidProject(project)) {
2323
GradleUtils.addGradleListeners(project);
2424
}
2525
if (!AddToAppUtils.initializeAndDetectFlutter(project)) {
26-
return;
26+
return null;
2727
}
28-
2928
// Unset this flag for all projects, mainly to ease the upgrade from 3.0.1 to 3.1.
3029
// TODO(messick) Delete once 3.0.x has 0 7DA's.
3130
//FlutterProjectCreator.disableUserConfig(project);
3231
// Monitor Android dependencies.
33-
if (FlutterSettings.getInstance().isSyncingAndroidLibraries() ||
32+
FlutterSettings flutterSettings = FlutterSettings.getInstance();
33+
if (flutterSettings != null && flutterSettings.isSyncingAndroidLibraries() ||
3434
System.getProperty("flutter.android.library.sync", null) != null) {
3535
// TODO(messick): Remove the flag once this sync mechanism is stable.
3636
AndroidModuleLibraryManager.startWatching(project);
3737
}
38+
return null;
39+
}
40+
41+
@Override
42+
public void runActivity(@NotNull Project project) {
43+
ReadAction.nonBlocking(() -> doNonBlockingStartup(project)).expireWith(FlutterDartAnalysisServer.getInstance(project))
44+
.submit(AppExecutorUtil.getAppExecutorService());
3845
}
3946
}

0 commit comments

Comments
 (0)