use of io.flutter.run.LaunchState 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 MainFile main = MainFile.verify(launchFields.getEntryFile(), env.getProject()).get();
final RunMode mode = RunMode.fromEnv(env);
final Module module = ModuleUtil.findModuleForFile(main.getFile(), env.getProject());
final LaunchState.Callback callback = (device) -> {
if (device == null)
return null;
final GeneralCommandLine command = launchFields.getLaunchCommand(env.getProject(), device, mode);
return FlutterApp.start(env, env.getProject(), module, mode, device, command, StringUtil.capitalize(mode.mode()) + "BazelApp", "StopBazelApp");
};
return new LaunchState(env, main.getAppDir(), main.getFile(), this, callback);
}
Aggregations