Search in sources :

Example 21 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexExtractSuperTest method testInheritanceFromSdk.

@JSTestOptions(JSTestOption.WithGumboSdk)
public void testInheritanceFromSdk() throws Exception {
    final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
    doTest(new PerformAction() {

        @Override
        public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) throws Exception {
            FlexTestUtils.modifyConfigs(myProject, editor -> {
                ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
                bc1.setName("1");
                FlexTestUtils.setSdk(bc1, sdk);
            });
            FlexExtractSuperTest.this.performAction(false, "skins.MyNewSkin1", "skins.IMySkin", DocCommentPolicy.COPY, JSExtractSuperProcessor.Mode.ExtractSuperTurnRefs, new String[] { "updateDisplayList" }, ArrayUtil.EMPTY_STRING_ARRAY);
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsRootAccess(com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess) VfsUtilCore.urlToPath(com.intellij.openapi.vfs.VfsUtilCore.urlToPath) ArrayUtil(com.intellij.util.ArrayUtil) JSExtractSuperProcessor(com.intellij.lang.javascript.refactoring.extractSuper.JSExtractSuperProcessor) JSTestOption(com.intellij.lang.javascript.JSTestOption) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) VirtualFile(com.intellij.openapi.vfs.VirtualFile) JSMemberInfo(com.intellij.lang.javascript.refactoring.util.JSMemberInfo) DocCommentPolicy(com.intellij.refactoring.util.DocCommentPolicy) Computable(com.intellij.openapi.util.Computable) ActionScriptCreateClassOrInterfaceFix(com.intellij.lang.javascript.validation.fixes.ActionScriptCreateClassOrInterfaceFix) BaseRefactoringProcessor(com.intellij.refactoring.BaseRefactoringProcessor) ActionManager(com.intellij.openapi.actionSystem.ActionManager) LinkedHashMap(java.util.LinkedHashMap) FlexStylesIndexableSetContributor(com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor) Map(java.util.Map) PsiElement(com.intellij.psi.PsiElement) WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) Conditions(com.intellij.openapi.util.Conditions) ModuleType(com.intellij.openapi.module.ModuleType) FlexTestUtils(com.intellij.flex.util.FlexTestUtils) DataManager(com.intellij.ide.DataManager) StringUtil(com.intellij.openapi.util.text.StringUtil) MultiFileTestCase(com.intellij.refactoring.MultiFileTestCase) FlexSchemaHandler(com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) AnAction(com.intellij.openapi.actionSystem.AnAction) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk) TestActionEvent(com.intellij.testFramework.TestActionEvent) List(java.util.List) JSTestUtils(com.intellij.lang.javascript.JSTestUtils) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) VfsUtilCore.convertFromUrl(com.intellij.openapi.vfs.VfsUtilCore.convertFromUrl) JSTestOptions(com.intellij.lang.javascript.JSTestOptions) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) PsiDirectory(com.intellij.psi.PsiDirectory) NotNull(org.jetbrains.annotations.NotNull) PostprocessReformattingAspect(com.intellij.psi.impl.source.PostprocessReformattingAspect) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 22 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlashUmlTest method initSdk.

private void initSdk() {
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk45);
    });
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 23 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlashBuilderModuleImporter method setupBuildConfigs.

private void setupBuildConfigs(final ModuleRootModel rootModel, final FlashBuilderProject fbProject) {
    final Sdk sdk = fbProject.isSdkUsed() ? mySdkFinder.findSdk(fbProject) : null;
    final ModifiableFlexBuildConfiguration[] configurations = myFlexConfigEditor.getConfigurations(rootModel.getModule());
    assert configurations.length == 1;
    final ModifiableFlexBuildConfiguration mainBC = configurations[0];
    final String bcName = suggestMainBCName(fbProject);
    mainBC.setName(bcName);
    final TargetPlatform targetPlatform = fbProject.getTargetPlatform();
    mainBC.setTargetPlatform(targetPlatform);
    mainBC.setPureAs(fbProject.isPureActionScript());
    mainBC.setOutputType(fbProject.getOutputType());
    final Map<String, String> compilerOptions = new THashMap<>();
    if (fbProject.getOutputType() == OutputType.Application) {
        mainBC.setMainClass(fbProject.getMainAppClassName());
        final String shortClassName = StringUtil.getShortName(fbProject.getMainAppClassName());
        mainBC.setOutputFileName(shortClassName + ".swf");
        if (!mainBC.isPureAs() && fbProject.getThemeDirPathRaw() != null && sdk != null) {
            setupTheme(fbProject.getThemeDirPathRaw(), mainBC.getNature(), sdk, mainBC.getDependencies().getComponentSet(), compilerOptions);
        }
        switch(targetPlatform) {
            case Web:
                if (fbProject.isUseHtmlWrapper()) {
                    mainBC.setUseHtmlWrapper(true);
                    mainBC.setWrapperTemplatePath(fbProject.getProjectRootPath() + "/" + CreateHtmlWrapperTemplateDialog.HTML_TEMPLATE_FOLDER_NAME);
                }
                break;
            case Desktop:
                setupAirDescriptor(mainBC, rootModel);
                mainBC.getAirDesktopPackagingOptions().setPackageFileName(shortClassName);
                if (!StringUtil.isEmpty(fbProject.getDesktopCertPath())) {
                    mainBC.getAirDesktopPackagingOptions().getSigningOptions().setUseTempCertificate(false);
                    mainBC.getAirDesktopPackagingOptions().getSigningOptions().setKeystorePath(fbProject.getDesktopCertPath());
                }
                FilesToPackageUtil.setupFilesToPackage(mainBC.getAirDesktopPackagingOptions(), fbProject.getPathsExcludedFromDesktopPackaging(), rootModel);
                break;
            case Mobile:
                setupAirDescriptor(mainBC, rootModel);
                mainBC.getAndroidPackagingOptions().setEnabled(fbProject.isAndroidSupported());
                mainBC.getAndroidPackagingOptions().setPackageFileName(shortClassName);
                if (!StringUtil.isEmpty(fbProject.getAndroidCertPath())) {
                    mainBC.getAndroidPackagingOptions().getSigningOptions().setUseTempCertificate(false);
                    mainBC.getAndroidPackagingOptions().getSigningOptions().setKeystorePath(fbProject.getAndroidCertPath());
                }
                FilesToPackageUtil.setupFilesToPackage(mainBC.getAndroidPackagingOptions(), fbProject.getPathsExcludedFromAndroidPackaging(), rootModel);
                mainBC.getIosPackagingOptions().setEnabled(fbProject.isIosSupported());
                mainBC.getIosPackagingOptions().setPackageFileName(shortClassName);
                mainBC.getIosPackagingOptions().getSigningOptions().setProvisioningProfilePath(StringUtil.notNullize(fbProject.getIOSProvisioningPath()));
                mainBC.getIosPackagingOptions().getSigningOptions().setKeystorePath(StringUtil.notNullize(fbProject.getIOSCertPath()));
                FilesToPackageUtil.setupFilesToPackage(mainBC.getIosPackagingOptions(), fbProject.getPathsExcludedFromIOSPackaging(), rootModel);
                break;
        }
    } else {
        mainBC.setOutputFileName(fbProject.getName() + ".swc");
    }
    mainBC.setOutputFolder(getAbsolutePathWithLinksHandled(fbProject, fbProject.getOutputFolderPath()));
    setupRLMsAndCSSFilesToCompile(mainBC, fbProject);
    if (sdk != null) {
        mainBC.getDependencies().setSdkEntry(Factory.createSdkEntry(sdk.getName()));
        final String sdkHome = sdk.getHomePath();
        if (targetPlatform == TargetPlatform.Web && sdkHome != null) {
            mainBC.getDependencies().setTargetPlayer(FlexSdkUtils.getTargetPlayer(fbProject.getTargetPlayerVersion(), sdkHome));
        }
    }
    // todo dependencies.setFrameworkLinkage();
    setupDependencies(mainBC, fbProject);
    final String fbOptions = fbProject.getAdditionalCompilerOptions();
    setupLocales(fbOptions, compilerOptions);
    setupNamespacesAndManifests(rootModel, fbProject, compilerOptions);
    setupFilesToIncludeInSwc(rootModel, mainBC, fbProject.getFilesIncludedInSwc());
    mainBC.getCompilerOptions().setAllOptions(compilerOptions);
    // todo parse options, replace "-a b" to "-a=b", move some to dedicated fields
    final String ideaOptions = FlexCommonUtils.removeOptions(fbOptions, "locale", "compiler.locale", "source-path", "compiler.source-path");
    mainBC.getCompilerOptions().setAdditionalOptions(ideaOptions);
    if (mainBC.getOutputType() == OutputType.Application) {
        FlexModuleBuilder.createRunConfiguration(rootModel.getModule(), mainBC);
    }
    setupOtherAppsAndModules(rootModel, mainBC, fbProject);
}
Also used : THashMap(gnu.trove.THashMap) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 24 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlashBuilderModuleImporter method setupModules.

private void setupModules(final ModuleRootModel rootModel, final Collection<ModifiableFlexBuildConfiguration> apps, final FlashBuilderProject fbProject) {
    for (final FlashBuilderProject.FBRLMInfo rlm : fbProject.getModules()) {
        ModifiableFlexBuildConfiguration hostApp = apps.iterator().next();
        if (rlm.OPTIMIZE) {
            final String hostAppMainClass = getMainClassFqn(fbProject, rlm.OPTIMIZE_FOR, rootModel.getSourceRootUrls());
            for (ModifiableFlexBuildConfiguration appBC : apps) {
                if (hostAppMainClass.equals(appBC.getMainClass())) {
                    hostApp = appBC;
                    break;
                }
            }
        }
        final Collection<FlexBuildConfiguration.RLMInfo> rlms = new ArrayList<>(hostApp.getRLMs());
        final String rlmMainClass = getMainClassFqn(fbProject, rlm.MAIN_CLASS_PATH, rootModel.getSourceRootUrls());
        rlms.add(new FlexBuildConfiguration.RLMInfo(rlmMainClass, rlm.OUTPUT_PATH, rlm.OPTIMIZE));
        hostApp.setRLMs(rlms);
    }
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 25 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexProjectConfigTest method testModuleLibrary2.

public void testModuleLibrary2() throws ConfigurationException {
    assertEquals(1, FlexBuildConfigurationManager.getInstance(myModule).getBuildConfigurations().length);
    final String libraryId = createModuleLibrary();
    FlexTestUtils.modifyConfigs(myProject, configEditor -> {
        ModifiableFlexBuildConfiguration[] configurations = configEditor.getConfigurations(myModule);
        assertEquals(1, configurations.length);
        ModifiableFlexBuildConfiguration c = configurations[0];
        final ModifiableModuleLibraryEntry e = configEditor.createModuleLibraryEntry(c.getDependencies(), libraryId);
        c.getDependencies().getModifiableEntries().add(e);
    });
    OrderEntry libraryEntry = findLibraryEntry(myModule, libraryId);
    assertNotNull(libraryEntry);
}
Also used : ModifiableModuleLibraryEntry(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableModuleLibraryEntry) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Aggregations

ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)31 Sdk (com.intellij.openapi.projectRoots.Sdk)16 Module (com.intellij.openapi.module.Module)8 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)5 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)4 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 LookupElement (com.intellij.codeInsight.lookup.LookupElement)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 IOException (java.io.IOException)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 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)2 SdkEntry (com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)2 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)2 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)2 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)2 ModuleType (com.intellij.openapi.module.ModuleType)2