Search in sources :

Example 1 with MainFile

use of io.flutter.run.MainFile 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);
}
Also used : RunMode(io.flutter.run.daemon.RunMode) XmlSerializer(com.intellij.util.xmlb.XmlSerializer) RunConfigurationWithSuppressedDefaultRunAction(com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction) ExecutionException(com.intellij.execution.ExecutionException) StringUtil(com.intellij.openapi.util.text.StringUtil) MainFile(io.flutter.run.MainFile) Executor(com.intellij.execution.Executor) InvalidDataException(com.intellij.openapi.util.InvalidDataException) com.intellij.execution.configurations(com.intellij.execution.configurations) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) ModuleUtil(com.intellij.openapi.module.ModuleUtil) SkipDefaultValuesSerializationFilters(com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters) LaunchState(io.flutter.run.LaunchState) Project(com.intellij.openapi.project.Project) Module(com.intellij.openapi.module.Module) WriteExternalException(com.intellij.openapi.util.WriteExternalException) NotNull(org.jetbrains.annotations.NotNull) Element(org.jdom.Element) SettingsEditor(com.intellij.openapi.options.SettingsEditor) FlutterApp(io.flutter.run.daemon.FlutterApp) MainFile(io.flutter.run.MainFile) RunMode(io.flutter.run.daemon.RunMode) LaunchState(io.flutter.run.LaunchState) ExecutionException(com.intellij.execution.ExecutionException) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 Executor (com.intellij.execution.Executor)1 com.intellij.execution.configurations (com.intellij.execution.configurations)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 RunConfigurationWithSuppressedDefaultRunAction (com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction)1 Module (com.intellij.openapi.module.Module)1 ModuleUtil (com.intellij.openapi.module.ModuleUtil)1 SettingsEditor (com.intellij.openapi.options.SettingsEditor)1 Project (com.intellij.openapi.project.Project)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 WriteExternalException (com.intellij.openapi.util.WriteExternalException)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 SkipDefaultValuesSerializationFilters (com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters)1 XmlSerializer (com.intellij.util.xmlb.XmlSerializer)1 LaunchState (io.flutter.run.LaunchState)1 MainFile (io.flutter.run.MainFile)1 FlutterApp (io.flutter.run.daemon.FlutterApp)1 RunMode (io.flutter.run.daemon.RunMode)1 Element (org.jdom.Element)1 NotNull (org.jetbrains.annotations.NotNull)1