Search in sources :

Example 11 with BuildConfigurationNature

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

the class Flexmojos3ImporterTest method testConfiguringCompiledLocalesAsSourceFolders.

public void testConfiguringCompiledLocalesAsSourceFolders() throws Exception {
    createProjectSubDirs("src/main/locales/en_US", "src/main/locales/ru_RU", "src/main/locales/fr_FR");
    importProject(mavenProjectDescription("project", "swc") + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <compiledLocales>" + "          <locale>en_US</locale>" + "          <locale>ru_RU</locale>" + "        </compiledLocales>" + "      </configuration>" + "    </plugin>" + "  </plugins>" + "</build>" + flexFrameworkDependency("3.2.0.3958"));
    assertSources("project", "src/main/locales/en_US", "src/main/locales/ru_RU");
    checkBCCount("project", 1);
    checkBC("project", "project", new BuildConfigurationNature(Web, false, Library), "", "project-1.0.swc", "target", "3.2.0.3958", "en_US\nru_RU", "target/project-1.0-config-report.xml");
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature)

Example 12 with BuildConfigurationNature

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

the class Flexmojos3ImporterTest method testConfiguringCompiledLocalesFromCustomDirAsSourceFolders.

public void testConfiguringCompiledLocalesFromCustomDirAsSourceFolders() throws Exception {
    createProjectSubDirs("locales/en_US");
    importProject(mavenProjectDescription("project", "swc") + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <resourceBundlePath>${basedir}/locales/{locale}</resourceBundlePath>" + "        <compiledLocales>" + "          <locale>en_US</locale>" + "        </compiledLocales>" + "      </configuration>" + "    </plugin>" + "  </plugins>" + "</build>" + flexFrameworkDependency("3.2.0.3958"));
    assertSources("project", "locales/en_US");
    checkBCCount("project", 1);
    checkBC("project", "project", new BuildConfigurationNature(Web, false, Library), "", "project-1.0.swc", "target", "3.2.0.3958", "en_US", "target/project-1.0-config-report.xml");
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature)

Example 13 with BuildConfigurationNature

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

the class AirPackageDialog method doValidate.

protected ValidationInfo doValidate() {
    final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCs = getSelectedBCs();
    if (modulesAndBCs.isEmpty())
        return new ValidationInfo("Please select one or more build configurations");
    if (myApkDebugPortTextField.isVisible() && myApkDebugPortPanel.isEnabled()) {
        try {
            final String portValue = myApkDebugPortTextField.getText().trim();
            final int port = portValue.isEmpty() ? AirPackageUtil.DEBUG_PORT_DEFAULT : Integer.parseInt(portValue);
            if (port <= 0 || port > 65535)
                return new ValidationInfo("Incorrect port", myApkDebugPortPanel);
        } catch (NumberFormatException e) {
            return new ValidationInfo("Incorrect port", myApkDebugPortTextField);
        }
    }
    for (Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCs) {
        final FlexBuildConfiguration bc = moduleAndBC.second;
        if (bc.isSkipCompile() && LocalFileSystem.getInstance().findFileByPath(bc.getActualOutputFilePath()) == null) {
            return new ValidationInfo(FlexBundle.message("can.not.package.bc", bc.getName(), FlexBundle.message("compilation.is.switched.off")));
        }
        final BuildConfigurationNature nature = bc.getNature();
        if (nature.isMobilePlatform()) {
            if (!bc.getAndroidPackagingOptions().isEnabled() && !bc.getIosPackagingOptions().isEnabled()) {
                return new ValidationInfo(FlexBundle.message("can.not.package.bc", bc.getName(), "both Android and iOS packaging disabled"));
            }
            if (bc.getAndroidPackagingOptions().isEnabled() && bc.getIosPackagingOptions().isEnabled()) {
                final AndroidPackageType androidPackage = (AndroidPackageType) myAndroidTypeCombo.getSelectedItem();
                final IOSPackageType iosPackage = (IOSPackageType) myIOSTypeCombo.getSelectedItem();
                final boolean androidDebug = androidPackage != AndroidPackageType.Release;
                final boolean iosDebug = iosPackage == IOSPackageType.DebugOverNetwork;
                if (androidDebug != iosDebug) {
                    return new ValidationInfo(FlexBundle.message("can.not.package.bc", bc.getName(), FlexBundle.message("different.debug.settings", androidDebug ? 1 : 2)));
                }
            }
        }
        final Ref<String> firstErrorRef = new Ref<>();
        ValidateFlashConfigurationsPrecompileTask.checkPackagingOptions(moduleAndBC.first, bc, problem -> {
            if (problem.severity == ProjectStructureProblemType.Severity.ERROR && firstErrorRef.isNull()) {
                firstErrorRef.set(problem.errorMessage);
            }
        });
        // todo better error reporting. May be just mention that errors exist in some BC and provide link to Project Structure
        if (!firstErrorRef.isNull()) {
            return new ValidationInfo(FlexBundle.message("can.not.package.bc", bc.getName(), firstErrorRef.get()));
        }
    }
    return null;
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ValidationInfo(com.intellij.openapi.ui.ValidationInfo) Ref(com.intellij.openapi.util.Ref) Module(com.intellij.openapi.module.Module) Pair(com.intellij.openapi.util.Pair)

Example 14 with BuildConfigurationNature

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

the class AirPackageDialog method createUIComponents.

private void createUIComponents() {
    myTree = new FlexBCTree(myProject, bc -> {
        final BuildConfigurationNature nature = bc.getNature();
        return nature.isApp() && !nature.isWebPlatform();
    });
    myTree.addToggleCheckBoxListener(new ChangeListener() {

        public void stateChanged(final ChangeEvent e) {
            updateControlsEnabledState();
        }
    });
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) ActionListener(java.awt.event.ActionListener) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) ChangeListener(javax.swing.event.ChangeListener) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) ValidationInfo(com.intellij.openapi.ui.ValidationInfo) ChangeEvent(javax.swing.event.ChangeEvent) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) ValidateFlashConfigurationsPrecompileTask(com.intellij.lang.javascript.flex.build.ValidateFlashConfigurationsPrecompileTask) ActionEvent(java.awt.event.ActionEvent) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) AirPackageProjectParameters(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageProjectParameters) AirPackagingOptions(com.intellij.lang.javascript.flex.projectStructure.model.AirPackagingOptions) Pair(com.intellij.openapi.util.Pair) Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ChangeEvent(javax.swing.event.ChangeEvent) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) ChangeListener(javax.swing.event.ChangeListener)

Example 15 with BuildConfigurationNature

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

the class AirPackageAction method update.

public void update(final AnActionEvent e) {
    final Project project = e.getProject();
    boolean flexModulePresent = false;
    boolean airAppPresent = false;
    if (project != null) {
        final FlexModuleType flexModuleType = FlexModuleType.getInstance();
        MODULES_LOOP: for (Module module : ModuleManager.getInstance(project).getModules()) {
            if (ModuleType.get(module) == flexModuleType) {
                flexModulePresent = true;
                for (FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
                    final BuildConfigurationNature nature = bc.getNature();
                    if (nature.isApp() && !nature.isWebPlatform()) {
                        airAppPresent = true;
                        break MODULES_LOOP;
                    }
                }
            }
        }
    }
    e.getPresentation().setVisible(flexModulePresent);
    e.getPresentation().setEnabled(airAppPresent && !CompilerManager.getInstance(project).isCompilationActive() && !AirPackageProjectParameters.getInstance(project).isPackagingInProgress());
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) Project(com.intellij.openapi.project.Project) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) Module(com.intellij.openapi.module.Module)

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