Search in sources :

Example 1 with FlexBuildConfiguration

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

the class FlexmojosImporterTestBase method checkBC.

protected FlexBuildConfiguration checkBC(final String moduleName, final String bcName, final BuildConfigurationNature nature, final String mainClass, final String outputFileName, final String outputFolderRelPath, final String sdkVersion, final String locales, final String configFileRelPath) {
    final Module module = ModuleManager.getInstance(myProject).findModuleByName(moduleName);
    assertNotNull("Module '" + moduleName + "' not found", module);
    final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(module).findConfigurationByName(bcName);
    assertNotNull("Build configuration '" + bcName + "' not found", bc);
    checkLibrariesOfFlexType(module, bc);
    assertEquals(nature, bc.getNature());
    assertEquals(mainClass, bc.getMainClass());
    assertEquals(outputFileName, bc.getOutputFileName());
    assertEquals(PathUtil.getParentPath(module.getModuleFilePath()) + (outputFolderRelPath.isEmpty() ? "" : "/") + outputFolderRelPath, bc.getOutputFolder());
    assertFalse(bc.isUseHtmlWrapper());
    assertFalse(bc.isSkipCompile());
    assertEquals(locales, bc.getCompilerOptions().getOption("compiler.locale"));
    assertEquals(getConfigFilesBasePath(module) + "/" + configFileRelPath, bc.getCompilerOptions().getAdditionalConfigFilePath());
    final Sdk sdk = bc.getSdk();
    assertNotNull(sdk);
    assertInstanceOf(sdk.getSdkType(), FlexmojosSdkType.class);
    assertEquals(sdk.getName(), "Flexmojos SDK " + sdkVersion);
    assertEquals(sdk.getVersionString(), sdkVersion);
    return bc;
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module)

Example 2 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration 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 3 with FlexBuildConfiguration

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

the class AirPackageDialog method checkPasswords.

private boolean checkPasswords(final Collection<Pair<Module, FlexBuildConfiguration>> selectedBCs) {
    final Collection<AirPackagingOptions> allPackagingOptions = new ArrayList<>();
    for (Pair<Module, FlexBuildConfiguration> moduleAndBC : selectedBCs) {
        final FlexBuildConfiguration bc = moduleAndBC.second;
        if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
            if (myDesktopTypeCombo.getSelectedItem() != DesktopPackageType.Airi) {
                allPackagingOptions.add(bc.getAirDesktopPackagingOptions());
            }
        } else {
            if (bc.getAndroidPackagingOptions().isEnabled()) {
                allPackagingOptions.add(bc.getAndroidPackagingOptions());
            }
            if (bc.getIosPackagingOptions().isEnabled()) {
                allPackagingOptions.add(bc.getIosPackagingOptions());
            }
        }
    }
    myPasswords = AirPackageAction.getPasswords(myProject, allPackagingOptions);
    return myPasswords != null;
}
Also used : AirPackagingOptions(com.intellij.lang.javascript.flex.projectStructure.model.AirPackagingOptions) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module)

Example 4 with FlexBuildConfiguration

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

the class AirPackageDialog method saveParameters.

private void saveParameters() {
    final AirPackageProjectParameters params = AirPackageProjectParameters.getInstance(myProject);
    params.desktopPackageType = (DesktopPackageType) myDesktopTypeCombo.getSelectedItem();
    params.androidPackageType = (AndroidPackageType) myAndroidTypeCombo.getSelectedItem();
    params.apkCaptiveRuntime = myApkCaptiveRuntimeCheckBox.isSelected();
    try {
        final String portValue = myApkDebugPortTextField.getText().trim();
        final int port = portValue.isEmpty() ? AirPackageUtil.DEBUG_PORT_DEFAULT : Integer.parseInt(portValue);
        if (port > 0 && port <= 65535) {
            params.apkDebugListenPort = port;
        }
    } catch (NumberFormatException e) {
    /*ignore*/
    }
    //final String host = myApkDebugHostTextField.getText().trim();
    //params.apkDebugConnectHost = host.equals(myOwnIpAddress) ? "" : host;
    params.iosPackageType = (IOSPackageType) myIOSTypeCombo.getSelectedItem();
    params.iosFastPackaging = myIosFastPackagingCheckBox.isSelected();
    final Collection<Pair<Module, FlexBuildConfiguration>> deselectedBCs = myTree.getDeselectedBCs();
    final StringBuilder buf = new StringBuilder();
    for (Pair<Module, FlexBuildConfiguration> moduleAndBC : deselectedBCs) {
        if (buf.length() > 0)
            buf.append('\n');
        buf.append(moduleAndBC.first.getName()).append('\t').append(moduleAndBC.second.getName());
    }
    params.deselectedBCs = buf.toString();
}
Also used : AirPackageProjectParameters(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageProjectParameters) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module) Pair(com.intellij.openapi.util.Pair)

Example 5 with FlexBuildConfiguration

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

the class AirPackageDialog method updateControlsEnabledState.

private void updateControlsEnabledState() {
    boolean desktopPresent = false;
    boolean androidPresent = false;
    boolean iosPresent = false;
    for (Pair<Module, FlexBuildConfiguration> moduleAndBC : getSelectedBCs()) {
        final FlexBuildConfiguration bc = moduleAndBC.second;
        final BuildConfigurationNature nature = bc.getNature();
        if (nature.isDesktopPlatform())
            desktopPresent = true;
        if (nature.isMobilePlatform() && bc.getAndroidPackagingOptions().isEnabled())
            androidPresent = true;
        if (nature.isMobilePlatform() && bc.getIosPackagingOptions().isEnabled())
            iosPresent = true;
        if (desktopPresent && androidPresent && iosPresent)
            break;
    }
    myDesktopTypeLabel.setEnabled(desktopPresent);
    myDesktopTypeCombo.setEnabled(desktopPresent);
    myAndroidTypeLabel.setEnabled(androidPresent);
    myAndroidTypeCombo.setEnabled(androidPresent);
    myApkCaptiveRuntimeCheckBox.setEnabled(androidPresent);
    UIUtil.setEnabled(myApkDebugPortPanel, androidPresent, true);
    //UIUtil.setEnabled(myApkDebugHostPanel, androidPresent, true);
    myIosTypeLabel.setEnabled(iosPresent);
    myIOSTypeCombo.setEnabled(iosPresent);
    myIosFastPackagingCheckBox.setEnabled(iosPresent);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module)

Aggregations

FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)52 Module (com.intellij.openapi.module.Module)30 Sdk (com.intellij.openapi.projectRoots.Sdk)9 Pair (com.intellij.openapi.util.Pair)7 ArrayList (java.util.ArrayList)7 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)6 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)5 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)5 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)5 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Project (com.intellij.openapi.project.Project)4 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)3 FlexUnitRunConfiguration (com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)3 FlashRunConfiguration (com.intellij.lang.javascript.flex.run.FlashRunConfiguration)3 FlashRunnerParameters (com.intellij.lang.javascript.flex.run.FlashRunnerParameters)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 ProjectStructureConfigurable (com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)3 CheckedTreeNode (com.intellij.ui.CheckedTreeNode)3 Place (com.intellij.ui.navigation.Place)3