Search in sources :

Example 1 with BuildConfigurationEntry

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

the class FlashPlayerTrustUtil method updateTrustedStatus.

public static void updateTrustedStatus(final Module module, final FlexBuildConfiguration bc, final boolean isDebug, final boolean isTrusted) {
    final Collection<String> paths = new ArrayList<>();
    try {
        paths.add(new File(PathUtil.getParentPath(bc.getActualOutputFilePath())).getCanonicalPath());
    } catch (IOException e) {
    /**/
    }
    for (DependencyEntry entry : bc.getDependencies().getEntries()) {
        if (entry instanceof BuildConfigurationEntry && entry.getDependencyType().getLinkageType() == LinkageType.LoadInRuntime) {
            final FlexBuildConfiguration dependencyBC = ((BuildConfigurationEntry) entry).findBuildConfiguration();
            if (dependencyBC != null) {
                try {
                    paths.add(new File(PathUtil.getParentPath(dependencyBC.getActualOutputFilePath())).getCanonicalPath());
                } catch (IOException e) {
                /**/
                }
            }
        }
    }
    updateTrustedStatus(module.getProject(), isTrusted, isDebug, paths.toArray(new String[paths.size()]));
}
Also used : BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) IOException(java.io.IOException) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) File(java.io.File)

Example 2 with BuildConfigurationEntry

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

the class FlexmojosImporter method process.

public void process(final IdeModifiableModelsProvider modelsProvider, final Module module, final MavenRootModelAdapter modelAdapter, final MavenProjectsTree mavenTree, final MavenProject mavenProject, final MavenProjectChanges changes, final Map<MavenProject, String> mavenProjectToModuleName, final List<MavenProjectsProcessorTask> postTasks) {
    expireNotification();
    final FlexProjectConfigurationEditor currentEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
    final boolean needToCommit = currentEditor == null;
    final LibraryTable.ModifiableModel projectLibrariesModel = modelsProvider.getModifiableProjectLibrariesModel();
    final Map<Module, ModifiableRootModel> moduleToModifiableModel = Collections.singletonMap(module, modelAdapter.getRootModel());
    final FlexProjectConfigurationEditor flexEditor = currentEditor != null ? currentEditor : new FlexProjectConfigurationEditor(module.getProject(), FlexProjectConfigurationEditor.createModelProvider(moduleToModifiableModel, projectLibrariesModel, null)) {

        @Nullable
        protected Module findModuleWithBC(final BuildConfigurationEntry bcEntry) {
            // don't check BC presence here because corresponding BC may appear later in next import cycle
            return modelAdapter.findModuleByName(bcEntry.getModuleName());
        }
    };
    final MavenPlugin flexmojosPlugin = getFlexmojosPlugin(mavenProject);
    final Flexmojos3Configurator configurator = StringUtil.compareVersionNumbers(flexmojosPlugin.getVersion(), "5") >= 0 ? new Flexmojos5Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this) : StringUtil.compareVersionNumbers(flexmojosPlugin.getVersion(), "4") >= 0 ? new Flexmojos4Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this) : new Flexmojos3Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this);
    configurator.configureAndAppendTasks(postTasks);
    if (needToCommit) {
        try {
            flexEditor.commit();
        } catch (ConfigurationException e) {
            // can't happen
            MavenLog.LOG.error(e);
        }
    }
}
Also used : MavenPlugin(org.jetbrains.idea.maven.model.MavenPlugin) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with BuildConfigurationEntry

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

the class FlexOrderEnumerationHandler method processModuleWithBuildConfiguration.

// configuration is null for root module (one for which scope is being computed)
private static void processModuleWithBuildConfiguration(@NotNull Module module, @Nullable FlexBuildConfiguration bc, Map<Module, ModuleData> modules2activeConfigurations, Set<FlexBuildConfiguration> processedConfigurations, boolean productionDependency) {
    if (ModuleType.get(module) != FlexModuleType.getInstance()) {
        return;
    }
    final boolean isRootModule = bc == null;
    if (isRootModule) {
        bc = getActiveConfiguration(module);
    }
    if (bc == null || !processedConfigurations.add(bc)) {
        return;
    }
    ModuleData moduleData = modules2activeConfigurations.get(module);
    if (moduleData == null) {
        modules2activeConfigurations.put(module, moduleData = new ModuleData());
    }
    moduleData.addBc(bc, productionDependency);
    for (DependencyEntry entry : bc.getDependencies().getEntries()) {
        if (!(entry instanceof BuildConfigurationEntry)) {
            continue;
        }
        final LinkageType linkageType = entry.getDependencyType().getLinkageType();
        if (linkageType == LinkageType.LoadInRuntime) {
            continue;
        }
        FlexBuildConfiguration dependencyBc = ((BuildConfigurationEntry) entry).findBuildConfiguration();
        if (dependencyBc == null || !FlexCommonUtils.checkDependencyType(bc.getOutputType(), dependencyBc.getOutputType(), linkageType)) {
            continue;
        }
        if (!isRootModule && !BCUtils.isTransitiveDependency(linkageType)) {
            continue;
        }
        Module dependencyModule = ((BuildConfigurationEntry) entry).findModule();
        if (dependencyModule == null || dependencyModule == module) {
            continue;
        }
        processModuleWithBuildConfiguration(dependencyModule, dependencyBc, modules2activeConfigurations, processedConfigurations, entry.getDependencyType().getLinkageType() != LinkageType.Test);
    }
}
Also used : BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) Module(com.intellij.openapi.module.Module) LinkageType(com.intellij.flex.model.bc.LinkageType)

Aggregations

BuildConfigurationEntry (com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry)3 DependencyEntry (com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry)2 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)2 Module (com.intellij.openapi.module.Module)2 LinkageType (com.intellij.flex.model.bc.LinkageType)1 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Nullable (org.jetbrains.annotations.Nullable)1 MavenPlugin (org.jetbrains.idea.maven.model.MavenPlugin)1