Search in sources :

Example 6 with LinkageType

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

the class FlexScopeTest method testTransitiveDependency.

public void testTransitiveDependency() throws Exception {
    final Module module2 = FlexTestUtils.createModule(myProject, "module2", getVirtualFile(getBasePath() + "m2"));
    final Module module3 = FlexTestUtils.createModule(myProject, "module3", getVirtualFile(getBasePath() + "m3"));
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        final ModifiableFlexBuildConfiguration bc2 = editor.getConfigurations(module2)[0];
        bc2.setOutputType(OutputType.Library);
        final ModifiableFlexBuildConfiguration bc3 = editor.getConfigurations(module3)[0];
        bc3.setOutputType(OutputType.Library);
        final ModifiableFlexBuildConfiguration bc3a = editor.createConfiguration(module3);
        bc3a.setOutputType(OutputType.Library);
        bc3a.setName("bc3a");
        bc1.getDependencies().getModifiableEntries().add(editor.createBcEntry(bc1.getDependencies(), bc2, null));
        bc2.getDependencies().getModifiableEntries().add(editor.createBcEntry(bc2.getDependencies(), bc3, null));
        bc2.getDependencies().getModifiableEntries().add(editor.createBcEntry(bc2.getDependencies(), bc3a, null));
    });
    FlexTestUtils.addFlexLibrary(false, module2, "Flex Lib", true, FlexTestUtils.getTestDataPath("flexlib/"), "flexlib.swc", null, null);
    doHighlightingTest("_1");
    class Test implements ThrowableRunnable<Exception> {

        private final LinkageType myLinkageType1;

        private final LinkageType myLinkageType2;

        private final String mySuffix;

        Test(LinkageType linkageType1, LinkageType linkageType2, String suffix) {
            myLinkageType1 = linkageType1;
            myLinkageType2 = linkageType2;
            mySuffix = suffix;
        }

        public void run() throws Exception {
            FlexTestUtils.modifyConfigs(myProject, editor -> {
                final ModifiableFlexBuildConfiguration bc = editor.getConfigurations(module2)[0];
                final ModifiableDependencyEntry e1 = bc.getDependencies().getModifiableEntries().get(0);
                e1.getDependencyType().setLinkageType(myLinkageType1);
                final ModifiableDependencyEntry e2 = bc.getDependencies().getModifiableEntries().get(1);
                e2.getDependencyType().setLinkageType(myLinkageType2);
            });
            doHighlightingTest(mySuffix);
        }
    }
    new Test(LinkageType.Default, LinkageType.Default, "_1").run();
    new Test(LinkageType.External, LinkageType.Default, "_1").run();
    new Test(LinkageType.Include, LinkageType.Default, "_2").run();
    new Test(LinkageType.LoadInRuntime, LinkageType.Default, "_1").run();
    new Test(LinkageType.Merged, LinkageType.Default, "_1").run();
    new Test(LinkageType.RSL, LinkageType.Default, "_1").run();
    new Test(LinkageType.RSL, LinkageType.Include, "_2").run();
    new Test(LinkageType.Include, LinkageType.Include, "_2").run();
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc2 = editor.getConfigurations(module2)[0];
        final ModifiableDependencyEntry entry = bc2.getDependencies().getModifiableEntries().get(2);
        assert entry instanceof ModifiableModuleLibraryEntry;
        entry.getDependencyType().setLinkageType(LinkageType.Include);
    });
    new Test(LinkageType.Include, LinkageType.Include, "_3").run();
}
Also used : ThrowableRunnable(com.intellij.util.ThrowableRunnable) FlexNavigationTest(com.intellij.flex.codeInsight.FlexNavigationTest) Module(com.intellij.openapi.module.Module) LinkageType(com.intellij.flex.model.bc.LinkageType)

Aggregations

LinkageType (com.intellij.flex.model.bc.LinkageType)6 Module (com.intellij.openapi.module.Module)3 FlexNavigationTest (com.intellij.flex.codeInsight.FlexNavigationTest)1 ComponentSet (com.intellij.flex.model.bc.ComponentSet)1 JpsFlexDependencyEntry (com.intellij.flex.model.bc.JpsFlexDependencyEntry)1 BuildConfigurationEntry (com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry)1 DependencyEntry (com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry)1 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Place (com.intellij.ui.navigation.Place)1 ThrowableRunnable (com.intellij.util.ThrowableRunnable)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1