use of io.flutter.run.common.RunMode in project flutter-intellij by flutter.
the class BazelRunConfig method getState.
@NotNull
@Override
public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
final BazelFields launchFields = fields.copy();
try {
launchFields.checkRunnable(env.getProject());
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
final Workspace workspace = fields.getWorkspace(getProject());
final VirtualFile workspaceRoot = workspace.getRoot();
final RunMode mode = RunMode.fromEnv(env);
final Module module = ModuleUtil.findModuleForFile(workspaceRoot, env.getProject());
final LaunchState.CreateAppCallback createAppCallback = (@Nullable FlutterDevice device) -> {
if (device == null)
return null;
final GeneralCommandLine command = getCommand(env, device);
return FlutterApp.start(env, env.getProject(), module, mode, device, command, StringUtil.capitalize(mode.mode()) + "BazelApp", "StopBazelApp");
};
return new LaunchState(env, workspaceRoot, workspaceRoot, this, createAppCallback);
}
Aggregations