use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class FlexBuildTargetScopeProvider method getModulesAndBCsToCompile.
static Collection<Pair<Module, FlexBuildConfiguration>> getModulesAndBCsToCompile(final CompileScope scope) throws ConfigurationException {
final Collection<Pair<Module, FlexBuildConfiguration>> result = new HashSet<>();
final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile = FlexResourceBuildTargetScopeProvider.getBCsToCompileForPackaging(scope);
final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(scope);
if (modulesAndBCsToCompile != null) {
for (Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
if (!moduleAndBC.second.isSkipCompile()) {
final FlexBuildConfiguration bcWithForcedDebugStatus = forceDebugStatus(moduleAndBC.first.getProject(), moduleAndBC.second);
result.add(Pair.create(moduleAndBC.first, bcWithForcedDebugStatus));
appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
}
}
} else if (runConfiguration instanceof FlashRunConfiguration || runConfiguration instanceof FlexUnitRunConfiguration) {
final BCBasedRunnerParameters params = runConfiguration instanceof FlashRunConfiguration ? ((FlashRunConfiguration) runConfiguration).getRunnerParameters() : ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
final Pair<Module, FlexBuildConfiguration> moduleAndBC;
final Ref<RuntimeConfigurationError> exceptionRef = new Ref<>();
moduleAndBC = ApplicationManager.getApplication().runReadAction((NullableComputable<Pair<Module, FlexBuildConfiguration>>) () -> {
try {
return params.checkAndGetModuleAndBC(runConfiguration.getProject());
} catch (RuntimeConfigurationError e) {
exceptionRef.set(e);
return null;
}
});
if (!exceptionRef.isNull()) {
throw new ConfigurationException(exceptionRef.get().getMessage(), FlexBundle.message("run.configuration.0", runConfiguration.getName()));
}
if (!moduleAndBC.second.isSkipCompile()) {
result.add(moduleAndBC);
appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
}
} else {
for (final Module module : scope.getAffectedModules()) {
if (module.isDisposed() || ModuleType.get(module) != FlexModuleType.getInstance())
continue;
for (final FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
if (!bc.isSkipCompile()) {
result.add(Pair.create(module, bc));
}
}
}
}
return result;
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class DartTestRunningState method createConsole.
private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) {
final Project project = env.getProject();
final DartRunConfiguration runConfiguration = (DartRunConfiguration) env.getRunProfile();
final DartTestRunnerParameters runnerParameters = (DartTestRunnerParameters) runConfiguration.getRunnerParameters();
final TestConsoleProperties testConsoleProperties = new DartConsoleProperties(runConfiguration, env);
final ConsoleView consoleView = SMTestRunnerConnectionUtil.createConsole(DART_FRAMEWORK_NAME, testConsoleProperties);
try {
final VirtualFile dartFile = runnerParameters.getDartFileOrDirectory();
consoleView.addMessageFilter(new DartConsoleFilter(project, dartFile));
consoleView.addMessageFilter(new DartRelativePathsConsoleFilter(project, runnerParameters.computeProcessWorkingDirectory(project)));
consoleView.addMessageFilter(new UrlFilter());
} catch (RuntimeConfigurationError ignore) {
/* can't happen because already checked */
}
Disposer.register(project, consoleView);
return consoleView;
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class FlashRunnerParameters method checkAdlAndAirRuntime.
public static void checkAdlAndAirRuntime(@NotNull final Sdk sdk) throws RuntimeConfigurationError {
final String adlPath = FlexSdkUtils.getAdlPath(sdk);
if (StringUtil.isEmpty(adlPath)) {
throw new RuntimeConfigurationError(FlexBundle.message("adl.not.set.check.sdk.settings", sdk.getName()));
}
final VirtualFile adlFile = LocalFileSystem.getInstance().findFileByPath(adlPath);
if (adlFile == null || adlFile.isDirectory()) {
throw new RuntimeConfigurationError(sdk.getSdkType() instanceof FlexmojosSdkType ? FlexBundle.message("adl.not.found.check.sdk.settings", adlPath, sdk.getName()) : FlexBundle.message("adl.not.found.check.sdk.installation", adlPath, sdk.getName()));
}
if (sdk.getSdkType() instanceof FlexmojosSdkType) {
final String airRuntimePath = FlexSdkUtils.getAirRuntimePathForFlexmojosSdk(sdk);
if (StringUtil.isEmpty(airRuntimePath)) {
throw new RuntimeConfigurationError(FlexBundle.message("air.runtime.not.set.check.sdk.settings", sdk.getName()));
}
final VirtualFile airRuntimeDir = LocalFileSystem.getInstance().findFileByPath(airRuntimePath);
if (airRuntimeDir == null) {
throw new RuntimeConfigurationError(FlexBundle.message("air.runtime.not.found.check.sdk.settings", airRuntimePath, sdk.getName()));
}
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class FlashRunnerParameters method checkCustomDescriptor.
public static void checkCustomDescriptor(final AirPackagingOptions packagingOptions, final String bcName, final String moduleName) throws RuntimeConfigurationError {
final boolean android = packagingOptions instanceof AndroidPackagingOptions;
final boolean ios = packagingOptions instanceof IosPackagingOptions;
if (android && !((AndroidPackagingOptions) packagingOptions).isEnabled()) {
throw new RuntimeConfigurationError(FlexBundle.message("android.disabled.in.bc", bcName, moduleName));
}
if (ios && !((IosPackagingOptions) packagingOptions).isEnabled()) {
throw new RuntimeConfigurationError(FlexBundle.message("ios.disabled.in.bc", bcName, moduleName));
}
if (!packagingOptions.isUseGeneratedDescriptor()) {
if (packagingOptions.getCustomDescriptorPath().isEmpty()) {
final String key = android ? "bc.0.module.1.android.custom.descriptor.not.set" : ios ? "bc.0.module.1.ios.custom.descriptor.not.set" : "bc.0.module.1.custom.descriptor.not.set";
throw new RuntimeConfigurationError(FlexBundle.message(key, bcName, moduleName));
} else {
final VirtualFile descriptorFile = LocalFileSystem.getInstance().findFileByPath(packagingOptions.getCustomDescriptorPath());
if (descriptorFile == null || descriptorFile.isDirectory()) {
final String key = android ? "bc.0.module.1.android.custom.descriptor.not.found" : ios ? "bc.0.module.1.ios.custom.descriptor.not.found" : "bc.0.module.1.custom.descriptor.not.found";
throw new RuntimeConfigurationError(FlexBundle.message(key, bcName, moduleName, FileUtil.toSystemDependentName(packagingOptions.getCustomDescriptorPath())));
}
}
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-community by JetBrains.
the class TestCategory method checkConfiguration.
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(getConfiguration());
ProgramParametersUtil.checkWorkingDirectoryExist(getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
final String category = getConfiguration().getPersistentData().getCategory();
if (category == null || category.isEmpty()) {
throw new RuntimeConfigurationError("Category is not specified");
}
final JavaRunConfigurationModule configurationModule = getConfiguration().getConfigurationModule();
if (getSourceScope() == null) {
configurationModule.checkForWarning();
}
final Module module = configurationModule.getModule();
if (module != null) {
final PsiClass psiClass = JavaExecutionUtil.findMainClass(getConfiguration().getProject(), category, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
if (psiClass == null) {
throw new RuntimeConfigurationWarning(ExecutionBundle.message("class.not.found.in.module.error.message", category, configurationModule.getModuleName()));
}
}
}
Aggregations