Search in sources :

Example 6 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class JstdRunConfigurationVerifier method verifyTestCase.

@Nullable
private static TestFileStructurePack verifyTestCase(@NotNull Project project, @NotNull JstdRunSettings runSettings) throws RuntimeConfigurationException {
    verifyJSFileType(runSettings);
    if (runSettings.getTestCaseName().isEmpty()) {
        throw new RuntimeConfigurationError("Test case name is empty.");
    }
    VirtualFile jsTestVirtualFile = VfsUtil.findFileByIoFile(new File(runSettings.getJsFilePath()), false);
    if (jsTestVirtualFile == null) {
        throw new RuntimeConfigurationWarning("Can't find JavaScript test file.");
    }
    JSFile jsFile = ObjectUtils.tryCast(PsiManager.getInstance(project).findFile(jsTestVirtualFile), JSFile.class);
    if (jsFile == null) {
        throw new RuntimeConfigurationWarning("Wrong JavaScript test file.");
    }
    TestFileStructurePack pack = TestFileStructureManager.fetchTestFileStructurePackByJsFile(jsFile);
    if (pack != null) {
        boolean found = pack.contains(runSettings.getTestCaseName(), null, JstdTestMethodNameRefiner.INSTANCE);
        if (!found) {
            throw new RuntimeConfigurationWarning("Can't find test case with name '" + runSettings.getTestCaseName() + "'.");
        }
        return pack;
    }
    return null;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TestFileStructurePack(com.intellij.javascript.testFramework.TestFileStructurePack) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) JSFile(com.intellij.lang.javascript.psi.JSFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) JSFile(com.intellij.lang.javascript.psi.JSFile) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class DartRemoteDebugConfiguration method checkConfiguration.

public void checkConfiguration() throws RuntimeConfigurationError {
    final String path = myParameters.getDartProjectPath();
    if (path.isEmpty()) {
        throw new RuntimeConfigurationError("Dart project path is not specified");
    }
    final VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(path);
    if (dir == null || !dir.isDirectory()) {
        throw new RuntimeConfigurationError("Folder not found: " + FileUtil.toSystemDependentName(path));
    }
    if (!ProjectRootManager.getInstance(getProject()).getFileIndex().isInContent(dir)) {
        throw new RuntimeConfigurationError("Folder is not in project content: " + FileUtil.toSystemDependentName(path));
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 8 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class FlexUnitPrecompileTask method execute.

public boolean execute(CompileContext context) {
    final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(context.getCompileScope());
    if (!(runConfiguration instanceof FlexUnitRunConfiguration)) {
        return true;
    }
    final Ref<Boolean> isDumb = new Ref<>(false);
    final RuntimeConfigurationException validationError = ApplicationManager.getApplication().runReadAction((NullableComputable<RuntimeConfigurationException>) () -> {
        if (DumbService.getInstance(myProject).isDumb()) {
            isDumb.set(true);
            return null;
        }
        try {
            runConfiguration.checkConfiguration();
            return null;
        } catch (RuntimeConfigurationException e) {
            return e;
        }
    });
    if (isDumb.get()) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("dumb.mode.flex.unit.warning"), null, -1, -1);
        return false;
    }
    if (validationError != null) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("configuration.not.valid", validationError.getMessage()), null, -1, -1);
        return false;
    }
    int flexUnitPort = ServerConnectionBase.getFreePort(FLEX_UNIT_PORT_START, PORTS_ATTEMPT_NUMBER);
    if (flexUnitPort == -1) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("no.free.port"), null, -1, -1);
        return false;
    }
    final int socketPolicyPort;
    if (SystemInfo.isWindows && ServerConnectionBase.tryPort(SwfPolicyFileConnection.DEFAULT_PORT)) {
        socketPolicyPort = SwfPolicyFileConnection.DEFAULT_PORT;
    } else {
        socketPolicyPort = ServerConnectionBase.getFreePort(SWC_POLICY_PORT_START, PORTS_ATTEMPT_NUMBER);
    }
    if (socketPolicyPort == -1) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("no.free.port"), null, -1, -1);
        return false;
    }
    final FlexUnitRunnerParameters params = ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
    params.setPort(flexUnitPort);
    params.setSocketPolicyPort(socketPolicyPort);
    final Ref<Module> moduleRef = new Ref<>();
    final Ref<FlexBuildConfiguration> bcRef = new Ref<>();
    final Ref<FlexUnitSupport> supportRef = new Ref<>();
    ApplicationManager.getApplication().runReadAction(() -> {
        if (DumbService.getInstance(myProject).isDumb())
            return;
        try {
            final Pair<Module, FlexBuildConfiguration> moduleAndBC = params.checkAndGetModuleAndBC(myProject);
            moduleRef.set(moduleAndBC.first);
            bcRef.set(moduleAndBC.second);
            supportRef.set(FlexUnitSupport.getSupport(moduleAndBC.second, moduleAndBC.first));
        } catch (RuntimeConfigurationError e) {
            // already checked above, can't happen
            throw new RuntimeException(e);
        }
    });
    final Module module = moduleRef.get();
    final FlexBuildConfiguration bc = bcRef.get();
    final FlexUnitSupport support = supportRef.get();
    if (bc == null || support == null) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("dumb.mode.flex.unit.warning"), null, -1, -1);
        return false;
    }
    final GlobalSearchScope moduleScope = GlobalSearchScope.moduleScope(module);
    StringBuilder imports = new StringBuilder();
    StringBuilder code = new StringBuilder();
    final boolean flexUnit4;
    switch(params.getScope()) {
        case Class:
            {
                final Ref<Boolean> isFlexUnit1Suite = new Ref<>();
                final Ref<Boolean> isSuite = new Ref<>();
                Set<String> customRunners = ApplicationManager.getApplication().runReadAction((NullableComputable<Set<String>>) () -> {
                    if (DumbService.getInstance(myProject).isDumb())
                        return null;
                    Set<String> result = new THashSet<>();
                    final JSClass clazz = (JSClass) ActionScriptClassResolver.findClassByQNameStatic(params.getClassName(), moduleScope);
                    collectCustomRunners(result, clazz, support, null);
                    isFlexUnit1Suite.set(support.isFlexUnit1SuiteSubclass(clazz));
                    isSuite.set(support.isSuite(clazz));
                    return result;
                });
                if (customRunners == null) {
                    context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("dumb.mode.flex.unit.warning"), null, -1, -1);
                    return false;
                }
                // FlexUnit4 can't run FlexUnit1 TestSuite subclasses, fallback to FlexUnit1 runner
                flexUnit4 = support.flexUnit4Present && !isFlexUnit1Suite.get();
                generateImportCode(imports, params.getClassName(), customRunners);
                generateTestClassCode(code, params.getClassName(), customRunners, isSuite.get());
            }
            break;
        case Method:
            {
                Set<String> customRunners = ApplicationManager.getApplication().runReadAction((NullableComputable<Set<String>>) () -> {
                    if (DumbService.getInstance(myProject).isDumb())
                        return null;
                    Set<String> result = new THashSet<>();
                    final JSClass clazz = (JSClass) ActionScriptClassResolver.findClassByQNameStatic(params.getClassName(), moduleScope);
                    collectCustomRunners(result, clazz, support, null);
                    return result;
                });
                if (customRunners == null) {
                    context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("dumb.mode.flex.unit.warning"), null, -1, -1);
                    return false;
                }
                flexUnit4 = support.flexUnit4Present;
                generateImportCode(imports, params.getClassName(), customRunners);
                generateTestMethodCode(code, params.getClassName(), params.getMethodName(), customRunners);
            }
            break;
        case Package:
            {
                final Collection<Pair<String, Set<String>>> classes = ApplicationManager.getApplication().runReadAction((NullableComputable<Collection<Pair<String, Set<String>>>>) () -> {
                    if (DumbService.getInstance(myProject).isDumb())
                        return null;
                    final Collection<Pair<String, Set<String>>> result = new ArrayList<>();
                    JSPackageIndex.processElementsInScopeRecursive(params.getPackageName(), new JSPackageIndex.PackageQualifiedElementsProcessor() {

                        public boolean process(String qualifiedName, JSPackageIndexInfo.Kind kind, boolean isPublic) {
                            if (kind == JSPackageIndexInfo.Kind.CLASS) {
                                PsiElement clazz = ActionScriptClassResolver.findClassByQNameStatic(qualifiedName, moduleScope);
                                if (clazz instanceof JSClass && support.isTestClass((JSClass) clazz, false)) {
                                    Set<String> customRunners = new THashSet<>();
                                    collectCustomRunners(customRunners, (JSClass) clazz, support, null);
                                    result.add(Pair.create(((JSClass) clazz).getQualifiedName(), customRunners));
                                }
                            }
                            return true;
                        }
                    }, moduleScope, myProject);
                    return result;
                });
                if (classes == null) {
                    context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("dumb.mode.flex.unit.warning"), null, -1, -1);
                    return false;
                }
                if (classes.isEmpty()) {
                    String message = MessageFormat.format("No tests found in package ''{0}''", params.getPackageName());
                    context.addMessage(CompilerMessageCategory.WARNING, message, null, -1, -1);
                    return false;
                }
                flexUnit4 = support.flexUnit4Present;
                for (Pair<String, Set<String>> classAndRunner : classes) {
                    generateImportCode(imports, classAndRunner.first, classAndRunner.second);
                    generateTestClassCode(code, classAndRunner.first, classAndRunner.second, false);
                }
            }
            break;
        default:
            flexUnit4 = false;
            assert false : "Unknown scope: " + params.getScope();
    }
    if (!flexUnit4 && bc.isPureAs()) {
        context.addMessage(CompilerMessageCategory.ERROR, FlexBundle.message("cant.execute.flexunit1.for.pure.as.bc"), null, -1, -1);
    }
    String launcherText;
    try {
        launcherText = getLauncherTemplate(bc);
    } catch (IOException e) {
        context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
        return false;
    }
    final boolean desktop = bc.getTargetPlatform() == TargetPlatform.Desktop;
    if (desktop) {
        generateImportCode(imports, "flash.desktop.NativeApplication");
    }
    launcherText = replace(launcherText, "/*imports*/", imports.toString());
    launcherText = replace(launcherText, "/*test_runner*/", flexUnit4 ? FlexCommonUtils.FLEXUNIT_4_TEST_RUNNER : FlexCommonUtils.FLEXUNIT_1_TEST_RUNNER);
    launcherText = replace(launcherText, "/*code*/", code.toString());
    launcherText = replace(launcherText, "/*port*/", String.valueOf(flexUnitPort));
    launcherText = replace(launcherText, "/*socketPolicyPort*/", String.valueOf(socketPolicyPort));
    launcherText = replace(launcherText, "/*module*/", module.getName());
    if (!bc.isPureAs()) {
        final FlexUnitRunnerParameters.OutputLogLevel logLevel = params.getOutputLogLevel();
        launcherText = replace(launcherText, "/*isLogEnabled*/", logLevel != null ? "1" : "0");
        launcherText = replace(launcherText, "/*logLevel*/", logLevel != null ? logLevel.getFlexConstant() : FlexUnitRunnerParameters.OutputLogLevel.All.getFlexConstant());
    }
    final File tmpDir = new File(getPathToFlexUnitTempDirectory(myProject));
    boolean ok = true;
    if (tmpDir.isFile())
        ok &= FileUtil.delete(tmpDir);
    if (!tmpDir.isDirectory())
        ok &= tmpDir.mkdirs();
    if (!ok) {
        final String message = UIBundle.message("create.new.folder.could.not.create.folder.error.message", FileUtil.toSystemDependentName(tmpDir.getPath()));
        context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
        return false;
    }
    final String fileName = FlexCommonUtils.FLEX_UNIT_LAUNCHER + FlexCommonUtils.getFlexUnitLauncherExtension(bc.getNature());
    final File launcherFile = new File(tmpDir, fileName);
    FileUtil.delete(launcherFile);
    try {
        FileUtil.writeToFile(launcherFile, launcherText);
    } catch (IOException e) {
        context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
        return false;
    }
    context.putUserData(FILES_TO_DELETE, Collections.singletonList(launcherFile.getPath()));
    return true;
}
Also used : ComponentSet(com.intellij.flex.model.bc.ComponentSet) THashSet(gnu.trove.THashSet) Set(java.util.Set) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) JSPackageIndex(com.intellij.lang.javascript.index.JSPackageIndex) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) PsiElement(com.intellij.psi.PsiElement) IOException(java.io.IOException) THashSet(gnu.trove.THashSet) Collection(java.util.Collection) JSPackageIndexInfo(com.intellij.lang.javascript.index.JSPackageIndexInfo) Module(com.intellij.openapi.module.Module) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) File(java.io.File)

Example 9 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class FlashRunnerParameters method reportWarnings.

public void reportWarnings(final Project project) throws RuntimeConfigurationWarning {
    try {
        final Pair<Module, FlexBuildConfiguration> moduleAndBC = super.checkAndGetModuleAndBC(project);
        final Module module = moduleAndBC.first;
        final FlexBuildConfiguration bc = moduleAndBC.second;
        final Ref<String> errorMessageRef = new Ref<>(null);
        final Consumer<FlashProjectStructureProblem> consumer = problem -> errorMessageRef.set(problem.errorMessage);
        if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAirDesktopPackagingOptions(), consumer, true, getBCName());
        } else if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
            switch(myMobileRunTarget) {
                case Emulator:
                    switch(myAppDescriptorForEmulator) {
                        case Android:
                            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
                            break;
                        case IOS:
                            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
                            break;
                    }
                    break;
                case AndroidDevice:
                    checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
                    break;
                case iOSSimulator:
                case iOSDevice:
                    checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
                    break;
            }
        }
        if (!errorMessageRef.isNull()) {
            throw new RuntimeConfigurationWarning(errorMessageRef.get());
        }
    } catch (RuntimeConfigurationError e) {
    /* should be already checked somewhere else */
    }
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) OutputType(com.intellij.flex.model.bc.OutputType) ArrayUtil(com.intellij.util.ArrayUtil) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ActionScriptClassResolver(com.intellij.javascript.flex.resolve.ActionScriptClassResolver) PsiManager(com.intellij.psi.PsiManager) FlexCommonUtils(com.intellij.flex.FlexCommonUtils) AirPackagingConfigurableBase(com.intellij.lang.javascript.flex.projectStructure.ui.AirPackagingConfigurableBase) BCUtils(com.intellij.lang.javascript.flex.projectStructure.options.BCUtils) Factory(com.intellij.lang.javascript.flex.projectStructure.model.impl.Factory) FlexmojosSdkType(com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType) PsiElement(com.intellij.psi.PsiElement) Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) FileUtil(com.intellij.openapi.util.io.FileUtil) FlexSdkUtils(com.intellij.lang.javascript.flex.sdk.FlexSdkUtils) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) FlexCommonBundle(com.intellij.flex.FlexCommonBundle) EnumSet(java.util.EnumSet) XmlTag(com.intellij.psi.xml.XmlTag) FlexSdkComboBoxWithBrowseButton(com.intellij.lang.javascript.flex.sdk.FlexSdkComboBoxWithBrowseButton) MalformedURLException(java.net.MalformedURLException) StringUtil(com.intellij.openapi.util.text.StringUtil) BrowserUtil(com.intellij.ide.BrowserUtil) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) com.intellij.lang.javascript.flex.projectStructure.model(com.intellij.lang.javascript.flex.projectStructure.model) Sdk(com.intellij.openapi.projectRoots.Sdk) SystemInfo(com.intellij.openapi.util.SystemInfo) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) LinkageType(com.intellij.flex.model.bc.LinkageType) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) Nullable(org.jetbrains.annotations.Nullable) AirPackageUtil(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageUtil) List(java.util.List) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) Pair(com.intellij.openapi.util.Pair) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Collections(java.util.Collections) Consumer(com.intellij.util.Consumer) Ref(com.intellij.openapi.util.Ref) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 10 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class FlashRunnerParameters method doCheck.

private void doCheck(final Pair<Module, FlexBuildConfiguration> moduleAndBC) throws RuntimeConfigurationError {
    final FlexBuildConfiguration bc = moduleAndBC.second;
    final Sdk sdk = bc.getSdk();
    if (sdk == null) {
        throw new RuntimeConfigurationError(FlexCommonBundle.message("sdk.not.set.for.bc.0.of.module.1", bc.getName(), moduleAndBC.first.getName()));
    }
    if (myOverrideMainClass) {
        if (myOverriddenMainClass.isEmpty()) {
            throw new RuntimeConfigurationError(FlexBundle.message("main.class.not.set"));
        }
        PsiElement clazz = ActionScriptClassResolver.findClassByQNameStatic(myOverriddenMainClass, moduleAndBC.first.getModuleScope(true));
        if (!(clazz instanceof JSClass)) {
            throw new RuntimeConfigurationError(FlexBundle.message("main.class.not.found", myOverriddenMainClass, bc.getName()));
        }
        if (myOverriddenOutputFileName.isEmpty()) {
            throw new RuntimeConfigurationError(FlexBundle.message("output.file.name.not.specified"));
        }
        if (!myOverriddenOutputFileName.toLowerCase().endsWith(".swf")) {
            throw new RuntimeConfigurationError(FlexBundle.message("output.file.must.have.swf.extension"));
        }
    } else {
        if (bc.getOutputType() != OutputType.Application) {
            throw new RuntimeConfigurationError(FlexBundle.message("bc.does.not.produce.app", getBCName(), getModuleName()));
        }
    }
    switch(bc.getTargetPlatform()) {
        case Web:
            if (myLaunchUrl) {
                if (myUrl.isEmpty())
                    throw new RuntimeConfigurationError(FlexBundle.message("flex.run.config.url.not.set"));
                try {
                    if (BrowserUtil.getURL(myUrl) == null)
                        throw new RuntimeConfigurationError(FlexBundle.message("flex.run.config.incorrect.url"));
                } catch (MalformedURLException e) {
                    throw new RuntimeConfigurationError(FlexBundle.message("flex.run.config.incorrect.url"));
                }
            //if (myLauncherParameters.getLauncherType() == LauncherParameters.LauncherType.Player) {
            //  throw new RuntimeConfigurationError(FlexBundle.message("flex.run.config.url.can.not.be.run.with.flash.player"));
            //}
            }
            if (myLauncherParameters.getLauncherType() == LauncherParameters.LauncherType.Player) {
                if (StringUtil.isEmptyOrSpaces(myLauncherParameters.getPlayerPath())) {
                    throw new RuntimeConfigurationError(FlexBundle.message("path.to.flash.player.not.set"));
                }
                if (!new File(myLauncherParameters.getPlayerPath()).exists()) {
                    throw new RuntimeConfigurationError(FlexBundle.message("flash.player.not.found", myLauncherParameters.getPresentableText()));
                }
            }
            checkDebuggerSdk();
            break;
        case Desktop:
            checkAdlAndAirRuntime(sdk);
            if (bc.getOutputType() == OutputType.Application) {
                checkCustomDescriptor(bc.getAirDesktopPackagingOptions(), getBCName(), getModuleName());
            }
            break;
        case Mobile:
            switch(myMobileRunTarget) {
                case Emulator:
                    checkAdlAndAirRuntime(sdk);
                    if (bc.getOutputType() == OutputType.Application) {
                        switch(myAppDescriptorForEmulator) {
                            case Android:
                                checkCustomDescriptor(bc.getAndroidPackagingOptions(), getBCName(), getModuleName());
                                break;
                            case IOS:
                                checkCustomDescriptor(bc.getIosPackagingOptions(), getBCName(), getModuleName());
                                break;
                        }
                    }
                    break;
                case AndroidDevice:
                    if (bc.getOutputType() == OutputType.Application) {
                        checkCustomDescriptor(bc.getAndroidPackagingOptions(), getBCName(), getModuleName());
                    }
                    break;
                case iOSSimulator:
                    if (bc.getOutputType() == OutputType.Application) {
                        checkCustomDescriptor(bc.getIosPackagingOptions(), getBCName(), getModuleName());
                    }
                    if (!SystemInfo.isMac) {
                        throw new RuntimeConfigurationError(FlexBundle.message("ios.simulator.on.mac.only.warning"));
                    }
                    if (myIOSSimulatorSdkPath.isEmpty()) {
                        throw new RuntimeConfigurationError(FlexBundle.message("ios.simulator.sdk.not.set"));
                    } else if (!new File(FileUtil.toSystemDependentName(myIOSSimulatorSdkPath)).isDirectory()) {
                        throw new RuntimeConfigurationError(FlexBundle.message("ios.simulator.sdk.not.found", FileUtil.toSystemDependentName(myIOSSimulatorSdkPath)));
                    }
                    break;
                case iOSDevice:
                    if (bc.getOutputType() == OutputType.Application) {
                        checkCustomDescriptor(bc.getIosPackagingOptions(), getBCName(), getModuleName());
                    }
                    break;
            }
            break;
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Sdk(com.intellij.openapi.projectRoots.Sdk) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File) PsiElement(com.intellij.psi.PsiElement)

Aggregations

RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)23 VirtualFile (com.intellij.openapi.vfs.VirtualFile)16 Module (com.intellij.openapi.module.Module)7 File (java.io.File)7 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)4 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Sdk (com.intellij.openapi.projectRoots.Sdk)4 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 JSFile (com.intellij.lang.javascript.psi.JSFile)3 Project (com.intellij.openapi.project.Project)3 PsiElement (com.intellij.psi.PsiElement)3 PsiFile (com.intellij.psi.PsiFile)3 NotNull (org.jetbrains.annotations.NotNull)3 ExecutionException (com.intellij.execution.ExecutionException)2 RunProfile (com.intellij.execution.configurations.RunProfile)2 XmlFile (com.intellij.psi.xml.XmlFile)2 Consumer (com.intellij.util.Consumer)2 DartRunConfigurationBase (com.jetbrains.lang.dart.ide.runner.base.DartRunConfigurationBase)2 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)2