Search in sources :

Example 21 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class ActionScriptCompletionInTextFieldTest method doTestCustomScope.

private void doTestCustomScope(String activeBcName, String selectedBcName, int numberOfVariants) throws Exception {
    String filename = getTestName(false).replaceAll("\\d+", "");
    configureByFiles(null, BASE_PATH + filename + "_2.mxml", BASE_PATH + filename + "_3.mxml");
    final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        {
            final ModifiableFlexBuildConfiguration bc = e.getConfigurations(myModule)[0];
            bc.setName("Flex");
            bc.setNature(new BuildConfigurationNature(TargetPlatform.Web, false, OutputType.Application));
            FlexTestUtils.setSdk(bc, sdk);
        }
        {
            final ModifiableFlexBuildConfiguration bc = e.createConfiguration(myModule);
            bc.setName("AIR");
            bc.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
            FlexTestUtils.setSdk(bc, sdk);
        }
    });
    final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(myModule);
    manager.setActiveBuildConfiguration(manager.findConfigurationByName(activeBcName));
    final ModuleWithDependenciesScope scope = FlexUtils.getModuleWithDependenciesAndLibrariesScope(myModule, manager.findConfigurationByName(selectedBcName), false);
    PublicInheritorFilter filter = new PublicInheritorFilter(myProject, FlashRunConfigurationForm.SPRITE_CLASS_NAME, scope, true);
    PsiFile fragment = JSReferenceEditor.forClassName("", myProject, null, GlobalSearchScope.moduleScope(myModule), null, filter, "").getPsiFile();
    doTestForEditorTextField((JSExpressionCodeFragment) fragment, "", "js2", BASE_PATH + filename + ".txt");
    if (numberOfVariants == 0) {
        assertNull(myItems);
    } else {
        assertEquals(numberOfVariants, myItems.length);
    }
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) PublicInheritorFilter(com.intellij.lang.javascript.psi.impl.PublicInheritorFilter) FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) ModuleWithDependenciesScope(com.intellij.openapi.module.impl.scopes.ModuleWithDependenciesScope) PsiFile(com.intellij.psi.PsiFile) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 22 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlexHighlightingTest method testBadResolveOfSuperClass.

public void testBadResolveOfSuperClass() throws Exception {
    final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    WriteAction.run(() -> FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk);
        final ModifiableFlexBuildConfiguration bc2 = editor.createConfiguration(myModule);
        bc2.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
        bc2.setName("2");
        FlexTestUtils.setSdk(bc2, sdk);
    }));
    doTestFor(true, getTestName(false) + ".mxml");
}
Also used : InjectedLanguageManager(com.intellij.lang.injection.InjectedLanguageManager) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) THashSet(gnu.trove.THashSet) AnnotationBackedDescriptor(com.intellij.lang.javascript.flex.AnnotationBackedDescriptor) JSAttributeListOwner(com.intellij.lang.javascript.psi.ecmal4.JSAttributeListOwner) PsiTreeUtil(com.intellij.psi.util.PsiTreeUtil) CheckXmlFileWithXercesValidatorInspection(com.intellij.xml.util.CheckXmlFileWithXercesValidatorInspection) DumbServiceImpl(com.intellij.openapi.project.DumbServiceImpl) WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) ActionScriptDaemonAnalyzerTestCase(com.intellij.flex.util.ActionScriptDaemonAnalyzerTestCase) Module(com.intellij.openapi.module.Module) com.intellij.lang.javascript(com.intellij.lang.javascript) JavaScriptIndex(com.intellij.lang.javascript.index.JavaScriptIndex) UnterminatedStatementJSInspection(com.intellij.lang.javascript.inspections.UnterminatedStatementJSInspection) JSAttributeList(com.intellij.lang.javascript.psi.ecmal4.JSAttributeList) Extensions(com.intellij.openapi.extensions.Extensions) CssUnknownPropertyInspection(com.intellij.psi.css.inspections.CssUnknownPropertyInspection) StdModuleTypes(com.intellij.openapi.module.StdModuleTypes) IncorrectOperationException(com.intellij.util.IncorrectOperationException) XmlHighlighterColors(com.intellij.openapi.editor.XmlHighlighterColors) PsiTestUtil(com.intellij.testFramework.PsiTestUtil) JSUseNamespaceDirective(com.intellij.lang.javascript.psi.ecmal4.JSUseNamespaceDirective) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) ModuleOrProjectCompilerOptions(com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions) JSUnusedGlobalSymbolsInspection(com.intellij.lang.javascript.inspections.JSUnusedGlobalSymbolsInspection) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) HighlightInfoFilter(com.intellij.codeInsight.daemon.impl.HighlightInfoFilter) CssInvalidHtmlTagReferenceInspection(com.intellij.psi.css.inspections.invalid.CssInvalidHtmlTagReferenceInspection) VfsUtilCore.urlToPath(com.intellij.openapi.vfs.VfsUtilCore.urlToPath) java.util(java.util) FlexProjectLevelCompilerOptionsHolder(com.intellij.lang.javascript.flex.projectStructure.FlexProjectLevelCompilerOptionsHolder) HighlightInfo(com.intellij.codeInsight.daemon.impl.HighlightInfo) FlexUnitLibs(com.intellij.flex.util.FlexUnitLibs) CssDialect(com.intellij.lang.css.CssDialect) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) CssNoGenericFontNameInspection(com.intellij.psi.css.inspections.bugs.CssNoGenericFontNameInspection) XmlNSDescriptorImpl(com.intellij.xml.impl.dtd.XmlNSDescriptorImpl) ModuleType(com.intellij.openapi.module.ModuleType) CssBundle(com.intellij.psi.css.CssBundle) JSUnusedLocalSymbolsInspection(com.intellij.lang.javascript.inspections.JSUnusedLocalSymbolsInspection) PropertiesBundle(com.intellij.lang.properties.PropertiesBundle) FileTemplateManager(com.intellij.ide.fileTemplates.FileTemplateManager) JSResolveUtil(com.intellij.lang.javascript.psi.resolve.JSResolveUtil) StringUtil(com.intellij.openapi.util.text.StringUtil) FlexSchemaHandler(com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler) XmlNSDescriptor(com.intellij.xml.XmlNSDescriptor) IOException(java.io.IOException) Target(java.lang.annotation.Target) JSPsiImplUtils(com.intellij.lang.javascript.psi.impl.JSPsiImplUtils) Sdk(com.intellij.openapi.projectRoots.Sdk) File(java.io.File) JarFileSystem(com.intellij.openapi.vfs.JarFileSystem) FileTemplateUtil(com.intellij.ide.fileTemplates.FileTemplateUtil) XmlAttributeDescriptor(com.intellij.xml.XmlAttributeDescriptor) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) JSFunctionsSearch(com.intellij.lang.javascript.search.JSFunctionsSearch) DaemonCodeAnalyzerImpl(com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl) CssUnknownTargetInspection(com.intellij.psi.css.inspections.invalid.CssUnknownTargetInspection) VfsRootAccess(com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess) JSMethodCanBeStaticInspection(com.intellij.lang.javascript.inspections.JSMethodCanBeStaticInspection) EXTENSION_POINT_NAME(com.intellij.codeInsight.daemon.impl.HighlightInfoFilter.EXTENSION_POINT_NAME) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) SpellCheckingInspection(com.intellij.spellchecker.inspections.SpellCheckingInspection) FlexStylesIndexableSetContributor(com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor) CssDialectMappings(com.intellij.lang.css.CssDialectMappings) Disposer(com.intellij.openapi.util.Disposer) FlexCSSDialect(com.intellij.javascript.flex.css.FlexCSSDialect) XmlAttributeValue(com.intellij.psi.xml.XmlAttributeValue) Method(java.lang.reflect.Method) ReferencesSearch(com.intellij.psi.search.searches.ReferencesSearch) DumbService(com.intellij.openapi.project.DumbService) XmlUnusedNamespaceInspection(com.intellij.codeInsight.daemon.impl.analysis.XmlUnusedNamespaceInspection) FlexUnitTestCreator(com.intellij.lang.javascript.flex.flexunit.FlexUnitTestCreator) CssInvalidFunctionInspection(com.intellij.psi.css.inspections.invalid.CssInvalidFunctionInspection) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) VfsUtilCore.convertFromUrl(com.intellij.openapi.vfs.VfsUtilCore.convertFromUrl) ApplicationManager(com.intellij.openapi.application.ApplicationManager) CssNegativeValueInspection(com.intellij.psi.css.inspections.CssNegativeValueInspection) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) FlexMxmlNSDescriptor(com.intellij.javascript.flex.mxml.schema.FlexMxmlNSDescriptor) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) JSInheritanceUtil(com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil) Ref(com.intellij.openapi.util.Ref) CssUnusedSymbolInspection(com.intellij.psi.css.inspections.CssUnusedSymbolInspection) NavigationItem(com.intellij.navigation.NavigationItem) CodeInsightTestUtil(com.intellij.testFramework.fixtures.CodeInsightTestUtil) OutputType(com.intellij.flex.model.bc.OutputType) WriteAction(com.intellij.openapi.application.WriteAction) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) NonNls(org.jetbrains.annotations.NonNls) ContainerUtil(com.intellij.util.containers.ContainerUtil) XmlPathReferenceInspection(com.intellij.codeInsight.daemon.impl.analysis.XmlPathReferenceInspection) ExpectedHighlightingData(com.intellij.testFramework.ExpectedHighlightingData) Retention(java.lang.annotation.Retention) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) com.intellij.openapi.roots(com.intellij.openapi.roots) CssUnitlessNumberInspection(com.intellij.psi.css.inspections.bugs.CssUnitlessNumberInspection) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) ImplementationSearcher(com.intellij.codeInsight.navigation.ImplementationSearcher) BadExpressionStatementJSInspection(com.sixrr.inspectjs.validity.BadExpressionStatementJSInspection) FlexTestUtils(com.intellij.flex.util.FlexTestUtils) InjectedLanguageUtil(com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor) CodeInsightTestFixtureImpl(com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl) JSFieldCanBeLocalInspection(com.intellij.lang.javascript.inspections.actionscript.JSFieldCanBeLocalInspection) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) XmlAttribute(com.intellij.psi.xml.XmlAttribute) JSDialectSpecificHandlersFactory(com.intellij.lang.javascript.dialects.JSDialectSpecificHandlersFactory) com.intellij.lang.javascript.psi(com.intellij.lang.javascript.psi) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) JSUntypedDeclarationInspection(com.intellij.lang.javascript.inspections.actionscript.JSUntypedDeclarationInspection) ElementType(java.lang.annotation.ElementType) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) JSClassResolver(com.intellij.lang.javascript.psi.resolve.JSClassResolver) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator) CssInvalidElementInspection(com.intellij.psi.css.inspections.CssInvalidElementInspection) CssInvalidPropertyValueInspection(com.intellij.psi.css.inspections.invalid.CssInvalidPropertyValueInspection) RetentionPolicy(java.lang.annotation.RetentionPolicy) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 23 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class AddBuildConfigurationDialog method getNature.

public BuildConfigurationNature getNature() {
    TargetPlatform targetPlatform = (TargetPlatform) myTargetPlatformCombo.getSelectedItem();
    boolean isPureAs = myPureActionScriptCheckBox.isSelected();
    OutputType outputType = (OutputType) myOutputTypeCombo.getSelectedItem();
    return new BuildConfigurationNature(targetPlatform, isPureAs, outputType);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) OutputType(com.intellij.flex.model.bc.OutputType)

Example 24 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlexProjectConfigurationEditor method resetNonApplicableValuesToDefaults.

public static void resetNonApplicableValuesToDefaults(final ModifiableFlexBuildConfiguration bc) {
    final FlexBuildConfiguration defaultConfiguration = new FlexBuildConfigurationImpl();
    final BuildConfigurationNature nature = bc.getNature();
    if (bc.getOutputType() != OutputType.RuntimeLoadedModule) {
        bc.setOptimizeFor(defaultConfiguration.getOptimizeFor());
    }
    if (nature.isLib()) {
        bc.setMainClass(defaultConfiguration.getMainClass());
    }
    if (!nature.isWebPlatform() || !nature.isApp()) {
        bc.setUseHtmlWrapper(defaultConfiguration.isUseHtmlWrapper());
        bc.setWrapperTemplatePath(defaultConfiguration.getWrapperTemplatePath());
    }
    if (!BCUtils.canHaveRLMsAndRuntimeStylesheets(bc)) {
        bc.setRLMs(defaultConfiguration.getRLMs());
        bc.setCssFilesToCompile(defaultConfiguration.getCssFilesToCompile());
    }
    if (!ArrayUtil.contains(bc.getDependencies().getFrameworkLinkage(), BCUtils.getSuitableFrameworkLinkages(nature))) {
        bc.getDependencies().setFrameworkLinkage(defaultConfiguration.getDependencies().getFrameworkLinkage());
    }
    if (!nature.isWebPlatform()) {
        bc.getDependencies().setTargetPlayer(defaultConfiguration.getDependencies().getTargetPlayer());
    }
    if (nature.isMobilePlatform() || bc.isPureAs()) {
        bc.getDependencies().setComponentSet(defaultConfiguration.getDependencies().getComponentSet());
    }
    for (Iterator<ModifiableDependencyEntry> i = bc.getDependencies().getModifiableEntries().iterator(); i.hasNext(); ) {
        final ModifiableDependencyEntry entry = i.next();
        if (entry instanceof BuildConfigurationEntry) {
            final FlexBuildConfiguration dependencyBC = ((BuildConfigurationEntry) entry).findBuildConfiguration();
            if (dependencyBC == null || !FlexCommonUtils.checkDependencyType(bc.getOutputType(), dependencyBC.getOutputType(), entry.getDependencyType().getLinkageType())) {
                i.remove();
            }
        }
    }
    if (bc.getTargetPlatform() != TargetPlatform.Desktop || bc.getOutputType() != OutputType.Application) {
        ((AirDesktopPackagingOptionsImpl) defaultConfiguration.getAirDesktopPackagingOptions()).applyTo(((AirDesktopPackagingOptionsImpl) bc.getAirDesktopPackagingOptions()));
    }
    if (bc.getTargetPlatform() != TargetPlatform.Mobile || bc.getOutputType() != OutputType.Application) {
        ((AndroidPackagingOptionsImpl) defaultConfiguration.getAndroidPackagingOptions()).applyTo(((AndroidPackagingOptionsImpl) bc.getAndroidPackagingOptions()));
        ((IosPackagingOptionsImpl) defaultConfiguration.getIosPackagingOptions()).applyTo(((IosPackagingOptionsImpl) bc.getIosPackagingOptions()));
    }
    if (!nature.isLib()) {
        bc.getCompilerOptions().setFilesToIncludeInSWC(Collections.emptyList());
    }
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature)

Example 25 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class FlexCompilerDependenciesCache method cacheBC.

public void cacheBC(final Module module, final FlexBuildConfiguration bc, final List<VirtualFile> configFiles) {
    Collection<BCInfo> infosForModule = myCache.get(module);
    if (infosForModule == null) {
        infosForModule = new ArrayList<>();
        myCache.put(module, infosForModule);
    } else {
        final BCInfo existingInfo = findCacheForBC(infosForModule, bc);
        if (existingInfo != null) {
            infosForModule.remove(existingInfo);
        }
    }
    final VirtualFile outputFile = FlexCompilationManager.refreshAndFindFileInWriteAction(bc.getActualOutputFilePath());
    if (outputFile == null)
        return;
    final BCInfo bcInfo = new BCInfo(Factory.getCopy(bc), ModuleRootManager.getInstance(module).getSourceRootUrls());
    infosForModule.add(bcInfo);
    bcInfo.addFileDependency(outputFile.getPath());
    final String workDirPath = FlexUtils.getFlexCompilerWorkDirPath(module.getProject(), null);
    for (VirtualFile configFile : configFiles) {
        addFileDependencies(bcInfo, configFile, workDirPath);
    }
    if (bc.isTempBCForCompilation() && !bc.getCompilerOptions().getAdditionalConfigFilePath().isEmpty()) {
        bcInfo.addFileDependency(bc.getCompilerOptions().getAdditionalConfigFilePath());
    }
    final BuildConfigurationNature nature = bc.getNature();
    if (nature.isApp() && !nature.isWebPlatform()) {
        if (nature.isDesktopPlatform()) {
            if (!bc.getAirDesktopPackagingOptions().isUseGeneratedDescriptor()) {
                bcInfo.addFileDependency(bc.getAirDesktopPackagingOptions().getCustomDescriptorPath());
            }
        } else {
            if (bc.getAndroidPackagingOptions().isEnabled() && !bc.getAndroidPackagingOptions().isUseGeneratedDescriptor()) {
                bcInfo.addFileDependency(bc.getAndroidPackagingOptions().getCustomDescriptorPath());
            }
            if (bc.getIosPackagingOptions().isEnabled() && !bc.getIosPackagingOptions().isUseGeneratedDescriptor()) {
                bcInfo.addFileDependency(bc.getIosPackagingOptions().getCustomDescriptorPath());
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature)

Aggregations

BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)36 Module (com.intellij.openapi.module.Module)11 Sdk (com.intellij.openapi.projectRoots.Sdk)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)4 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)4 NotNull (org.jetbrains.annotations.NotNull)4 OutputType (com.intellij.flex.model.bc.OutputType)3 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)3 WriteAction (com.intellij.openapi.application.WriteAction)3 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)3 FlexTestUtils (com.intellij.flex.util.FlexTestUtils)2 FlexStylesIndexableSetContributor (com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor)2 FlexSchemaHandler (com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler)2 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)2 ModuleType (com.intellij.openapi.module.ModuleType)2 Project (com.intellij.openapi.project.Project)2 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)2 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)2