use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineServerModel method checkConfiguration.
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
if (artifactPointer == null || artifactPointer.getArtifact() == null) {
throw new RuntimeConfigurationError(GctBundle.message("appengine.run.server.artifact.missing"));
}
// do not check SDK if it supports dynamic install - the deployment runner will block itself
// until installation is done.
CloudSdkService cloudSdkService = CloudSdkService.getInstance();
SdkStatus sdkStatus = cloudSdkService.getStatus();
if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) {
if (!CloudSdkValidator.getInstance().isValidCloudSdk()) {
throw new RuntimeConfigurationError(GctBundle.message("appengine.run.server.sdk.misconfigured.panel.message"));
}
}
if (ProjectRootManager.getInstance(commonModel.getProject()).getProjectSdk() == null) {
throw new RuntimeConfigurationError(GctBundle.getString("appengine.run.server.nosdk"));
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.
the class TestLaunchState method create.
static TestLaunchState create(@NotNull ExecutionEnvironment env, @NotNull TestConfig config) throws ExecutionException {
final TestFields fields = config.getFields();
try {
fields.checkRunnable(env.getProject());
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
FileDocumentManager.getInstance().saveAllDocuments();
final VirtualFile fileOrDir = fields.getFileOrDir();
assert (fileOrDir != null);
final PubRoot pubRoot = fields.getPubRoot(env.getProject());
assert (pubRoot != null);
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(env.getProject());
assert (sdk != null);
final boolean testConsoleEnabled = sdk.getVersion().flutterTestSupportsMachineMode();
final TestLaunchState launcher = new TestLaunchState(env, config, fileOrDir, pubRoot, testConsoleEnabled);
DaemonConsoleView.install(launcher, env, pubRoot.getRoot());
return launcher;
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.
the class SdkAttachConfig method getState.
@NotNull
@Override
public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
try {
checkRunnable(env.getProject());
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
final SdkFields launchFields = getFields();
final MainFile mainFile = MainFile.verify(launchFields.getFilePath(), env.getProject()).get();
final Project project = env.getProject();
final RunMode mode = RunMode.fromEnv(env);
final Module module = ModuleUtilCore.findModuleForFile(mainFile.getFile(), env.getProject());
final LaunchState.CreateAppCallback createAppCallback = (@Nullable FlutterDevice device) -> {
if (device == null)
return null;
final GeneralCommandLine command = getCommand(env, device);
final FlutterApp app = FlutterApp.start(env, project, module, mode, device, command, StringUtil.capitalize(mode.mode()) + "App", "StopApp");
// Stop the app if the Flutter SDK changes.
final FlutterSdkManager.Listener sdkListener = new FlutterSdkManager.Listener() {
@Override
public void flutterSdkRemoved() {
app.shutdownAsync();
}
};
FlutterSdkManager.getInstance(project).addListener(sdkListener);
Disposer.register(project, () -> FlutterSdkManager.getInstance(project).removeListener(sdkListener));
return app;
};
final LaunchState launcher = new AttachState(env, mainFile.getAppDir(), mainFile.getFile(), this, createAppCallback);
addConsoleFilters(launcher, env, mainFile, module);
return launcher;
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.
the class BazelFields method getLaunchCommand.
/**
* Returns the command to use to launch the Flutter app. (Via running the Bazel target.)
*/
GeneralCommandLine getLaunchCommand(@NotNull Project project, @Nullable FlutterDevice device, @NotNull RunMode mode) throws ExecutionException {
try {
checkRunnable(project);
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
final Workspace workspace = getWorkspace(project);
final String launchingScript = getRunScriptFromWorkspace(project);
// already checked
assert launchingScript != null;
// if the workspace is null, then so is the launching script, therefore this was already checked.
assert workspace != null;
final String target = getTarget();
// already checked
assert target != null;
final String additionalArgs = getAdditionalArgs();
final GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(workspace.getRoot().getPath());
commandLine.setCharset(StandardCharsets.UTF_8);
commandLine.setExePath(FileUtil.toSystemDependentName(launchingScript));
final String inputBazelArgs = StringUtil.notNullize(bazelArgs);
if (!inputBazelArgs.isEmpty()) {
commandLine.addParameter(String.format("--bazel-options=%s", inputBazelArgs));
}
// Potentially add the flag related to build mode.
if (enableReleaseMode) {
commandLine.addParameter("--release");
} else if (mode.equals(PROFILE)) {
commandLine.addParameter("--profile");
}
// Tell the flutter command-line tools that we want a machine interface on stdio.
commandLine.addParameter("--machine");
// Pause the app at startup in order to set breakpoints.
if (!enableReleaseMode && mode == DEBUG) {
commandLine.addParameter("--start-paused");
}
// User specified additional target arguments.
final CommandLineTokenizer additionalArgsTokenizer = new CommandLineTokenizer(StringUtil.notNullize(additionalArgs));
while (additionalArgsTokenizer.hasMoreTokens()) {
commandLine.addParameter(additionalArgsTokenizer.nextToken());
}
final String enableBazelHotRestartParam = "--enable-google3-hot-reload";
final String disableBazelHotRestartParam = "--no-enable-google3-hot-reload";
final boolean hasEnabledArg = StringUtil.notNullize(additionalArgs).contains(enableBazelHotRestartParam);
final boolean hasDisabledArg = StringUtil.notNullize(additionalArgs).contains(disableBazelHotRestartParam);
if (!FlutterSettings.getInstance().isEnableBazelHotRestart() && hasDisabledArg) {
final Notification notification = new Notification(FlutterMessages.FLUTTER_NOTIFICATION_GROUP_ID, "Google3-specific hot restart is disabled by default", "You can now remove this flag from your configuration's additional args: " + disableBazelHotRestartParam, NotificationType.INFORMATION);
Notifications.Bus.notify(notification, project);
} else if (FlutterSettings.getInstance().isEnableBazelHotRestart() && !hasEnabledArg && !hasDisabledArg) {
commandLine.addParameter(enableBazelHotRestartParam);
}
// Send in the deviceId.
if (device != null) {
commandLine.addParameter("-d");
commandLine.addParameter(device.deviceId());
}
try {
final ProgressManager progress = ProgressManager.getInstance();
final CompletableFuture<DevToolsInstance> devToolsFuture = new CompletableFuture<>();
progress.runProcessWithProgressSynchronously(() -> {
progress.getProgressIndicator().setIndeterminate(true);
try {
final DevToolsService service = this.devToolsService == null ? DevToolsService.getInstance(project) : this.devToolsService;
devToolsFuture.complete(service.getDevToolsInstance().get(30, TimeUnit.SECONDS));
} catch (Exception e) {
LOG.error(e);
}
}, "Starting DevTools", false, project);
final DevToolsInstance instance = devToolsFuture.get();
commandLine.addParameter("--devtools-server-address=http://" + instance.host + ":" + instance.port);
} catch (Exception e) {
LOG.error(e);
}
commandLine.addParameter(target);
return commandLine;
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.
the class BazelTestFields method getLaunchCommand.
/**
* Returns the command to use to launch the Flutter app. (Via running the Bazel target.)
*/
@NotNull
GeneralCommandLine getLaunchCommand(@NotNull final Project project, @NotNull final RunMode mode) throws ExecutionException {
try {
checkRunnable(project);
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
final Workspace workspace = getWorkspace(project);
final String launchingScript = getTestScriptFromWorkspace(project);
// already checked
assert launchingScript != null;
final GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(workspace.getRoot().getPath());
commandLine.setCharset(StandardCharsets.UTF_8);
commandLine.setExePath(FileUtil.toSystemDependentName(launchingScript));
final String nonNullArgs = StringUtil.notNullize(additionalArgs);
// User specified additional target arguments.
final CommandLineTokenizer testArgsTokenizer = new CommandLineTokenizer(nonNullArgs);
while (testArgsTokenizer.hasMoreTokens()) {
commandLine.addParameter(testArgsTokenizer.nextToken());
}
commandLine.addParameter(Flags.noColor);
// If the user did not turn the --machine flag off, we will pass it to the test runner.
if (!nonNullArgs.contains(Flags.noMachine)) {
commandLine.addParameter(Flags.machine);
}
final String relativeEntryFilePath = entryFile == null ? null : FileUtil.getRelativePath(workspace.getRoot().getPath(), entryFile, '/');
switch(getScope(project)) {
case NAME:
commandLine.addParameters(Flags.name, testName);
commandLine.addParameter(relativeEntryFilePath);
break;
case FILE:
commandLine.addParameter(relativeEntryFilePath);
break;
case TARGET_PATTERN:
commandLine.addParameter(bazelTarget);
break;
}
if (mode == RunMode.DEBUG) {
commandLine.addParameters(Flags.separator, Flags.enableDebugging);
}
return commandLine;
}
Aggregations