Search in sources :

Example 1 with BuildConfigurationNature

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

the class FlexTestUtils method doSetupFlexSdk.

public static void doSetupFlexSdk(final Module module, final String flexSdkRootPath, final boolean air, final String sdkVersion) {
    WriteAction.run(() -> {
        final Sdk sdk = createSdk(flexSdkRootPath, sdkVersion);
        if (ModuleType.get(module) == FlexModuleType.getInstance()) {
            modifyBuildConfiguration(module, bc -> {
                bc.setNature(new BuildConfigurationNature(air ? TargetPlatform.Desktop : TargetPlatform.Web, false, OutputType.Application));
                bc.getDependencies().setSdkEntry(Factory.createSdkEntry(sdk.getName()));
            });
        }
        Disposer.register(module, new Disposable() {

            @Override
            public void dispose() {
                WriteAction.run(() -> {
                    final ProjectJdkTable projectJdkTable = ProjectJdkTable.getInstance();
                    projectJdkTable.removeJdk(sdk);
                });
            }
        });
    });
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) Disposable(com.intellij.openapi.Disposable) ProjectJdkTable(com.intellij.openapi.projectRoots.ProjectJdkTable) Sdk(com.intellij.openapi.projectRoots.Sdk)

Example 2 with BuildConfigurationNature

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

the class FlexBuildTargetType method computeAllTargets.

@NotNull
public List<FlexBuildTarget> computeAllTargets(@NotNull final JpsModel model) {
    final List<FlexBuildTarget> result = new ArrayList<>();
    final JpsProject project = model.getProject();
    for (JpsTypedRunConfiguration<JpsFlashRunnerParameters> runConfig : project.getRunConfigurations(JpsFlashRunConfigurationType.INSTANCE)) {
        ContainerUtilRt.addIfNotNull(result, FlexBuildTarget.create(project, runConfig.getType(), runConfig.getName()));
    }
    for (JpsTypedRunConfiguration<JpsFlexUnitRunnerParameters> runConfig : project.getRunConfigurations(JpsFlexUnitRunConfigurationType.INSTANCE)) {
        ContainerUtilRt.addIfNotNull(result, FlexBuildTarget.create(project, runConfig.getType(), runConfig.getName()));
    }
    for (JpsTypedModule<JpsFlexBuildConfigurationManager> module : project.getModules(JpsFlexModuleType.INSTANCE)) {
        for (JpsFlexBuildConfiguration bc : module.getProperties().getBuildConfigurations()) {
            result.add(FlexBuildTarget.create(bc, null));
            final BuildConfigurationNature nature = bc.getNature();
            if (nature.isApp() && (nature.isDesktopPlatform() || nature.isMobilePlatform())) {
                result.add(FlexBuildTarget.create(bc, Boolean.TRUE));
                result.add(FlexBuildTarget.create(bc, Boolean.FALSE));
            }
        }
    }
    return result;
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) JpsFlashRunnerParameters(com.intellij.flex.model.run.JpsFlashRunnerParameters) JpsFlexUnitRunnerParameters(com.intellij.flex.model.run.JpsFlexUnitRunnerParameters) JpsProject(org.jetbrains.jps.model.JpsProject) ArrayList(java.util.ArrayList) JpsFlexBuildConfiguration(com.intellij.flex.model.bc.JpsFlexBuildConfiguration) JpsFlexBuildConfigurationManager(com.intellij.flex.model.bc.JpsFlexBuildConfigurationManager) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with BuildConfigurationNature

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

the class Flexmojos3ImporterTest method test2Projects.

/*
  public void testConfiguringRuntimeLocalesForLibrary() throws Exception {
    importProject(mavenProjectDescription("project", "swc") +
                  "<build>" +
                  "  <plugins>" +
                  "    <plugin>" +
                  flexmojosPlugin() +
                  "      <configuration>" +
                  "        <runtimeLocales>" +
                  "          <locale>en_US</locale>" +
                  "          <locale>ru_RU</locale>" +
                  "        </runtimeLocales>" +
                  "      </configuration>" +
                  "    </plugin>" +
                  "  </plugins>" +
                  "</build>");

    checkBC(findResourceFacet("project", "en_US"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "project-1.0-en_US.rb.swc",
            "target/locales/project-1.0-en_US-config-report.xml",
            FlexmojosSdkType.getInstance());

    checkBC(findResourceFacet("project", "ru_RU"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "project-1.0-ru_RU.rb.swc",
            "target/locales/project-1.0-ru_RU-config-report.xml",
            FlexmojosSdkType.getInstance());
  }

  public void testConfiguringRuntimeLocalesAndRuntimeLocaleOutputPathForLibrary() throws Exception {
    importProject(mavenProjectDescription("project", "swc") +
                  "<build>" +
                  "  <plugins>" +
                  "    <plugin>" +
                  flexmojosPlugin() +
                  "      <configuration>" +
                  "        <runtimeLocaleOutputPath>/{contextRoot}/locales/foo-{artifactId}-{version}-{locale}.{extension}</runtimeLocaleOutputPath>" +
                  "        <runtimeLocales>" +
                  "          <locale>en_US</locale>" +
                  "          <locale>ru_RU</locale>" +
                  "        </runtimeLocales>" +
                  "      </configuration>" +
                  "    </plugin>" +
                  "  </plugins>" +
                  "</build>");

    checkBC(findResourceFacet("project", "en_US"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "foo-project-1.0-en_US.rb.swc",
            "target/locales/foo-project-1.0-en_US-config-report.xml",
            FlexmojosSdkType.getInstance());

    checkBC(findResourceFacet("project", "ru_RU"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "foo-project-1.0-ru_RU.rb.swc",
            "target/locales/foo-project-1.0-ru_RU-config-report.xml",
            FlexmojosSdkType.getInstance());
  }

  public void testConfiguringRuntimeLocalesForApplication() throws Exception {
    importProject(mavenProjectDescription("project", "swf") +
                  "<build>" +
                  "  <plugins>" +
                  "    <plugin>" +
                  flexmojosPlugin() +
                  "      <configuration>" +
                  "        <runtimeLocales>" +
                  "          <locale>en_US</locale>" +
                  "          <locale>ru_RU</locale>" +
                  "        </runtimeLocales>" +
                  "      </configuration>" +
                  "    </plugin>" +
                  "  </plugins>" +
                  "</build>");

    checkBC(findResourceFacet("project", "en_US"),
            FlexBuildConfiguration.APPLICATION,
            "target/locales",
            "project-1.0-en_US.swf",
            "target/locales/project-1.0-en_US-config-report.xml",
            FlexmojosSdkType.getInstance());

    checkBC(findResourceFacet("project", "ru_RU"),
            FlexBuildConfiguration.APPLICATION,
            "target/locales",
            "project-1.0-ru_RU.swf",
            "target/locales/project-1.0-ru_RU-config-report.xml",
            FlexmojosSdkType.getInstance());
  }

  public void testDeletingUnnecessaryLocalesAfterReimport() throws Exception {
    importProject(mavenProjectDescription("project", "swc") +
                  "<build>" +
                  "  <plugins>" +
                  "    <plugin>" +
                  flexmojosPlugin() +
                  "      <configuration>" +
                  "        <runtimeLocales>" +
                  "          <locale>en_US</locale>" +
                  "          <locale>ru_RU</locale>" +
                  "        </runtimeLocales>" +
                  "      </configuration>" +
                  "    </plugin>" +
                  "  </plugins>" +
                  "</build>");

    assertNotNull(findResourceFacet("project", "en_US"));
    assertNotNull(findResourceFacet("project", "ru_RU"));

    createProjectPom("<groupId>test</groupId>" +
                     "<artifactId>project</artifactId>" +
                     "<version>1</version>" +
                     "<packaging>swc</packaging>" +

                     "<build>" +
                     "  <plugins>" +
                     "    <plugin>" +
                     flexmojosPlugin() +
                     "      <configuration>" +
                     "        <runtimeLocales>" +
                     "          <locale>ru_RU</locale>" +
                     "          <locale>fr_FR</locale>" +
                     "        </runtimeLocales>" +
                     "      </configuration>" +
                     "    </plugin>" +
                     "  </plugins>" +
                     "</build>");

    importProject();

    assertNull(findResourceFacet("project", "en_US"));
    assertNotNull(findResourceFacet("project", "ru_RU"));
    assertNotNull(findResourceFacet("project", "fr_FR"));
  }
  */
public void test2Projects() throws Exception {
    createProjectPom(mavenProjectDescription("project", "pom") + "<modules>" + "  <module>m1</module>" + "  <module>m2</module>" + "</modules>");
    createModulePom("m1", mavenProjectDescription("m1", "swf") + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <runtimeLocales>" + "          <locale>en_US</locale>" + "          <locale>ru_RU</locale>" + "        </runtimeLocales>" + "      </configuration>" + "    </plugin>" + "  </plugins>" + "</build>" + flexFrameworkDependency("3.2.0.3958"));
    createModulePom("m2", mavenProjectDescription("m2", "swc") + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <runtimeLocales>" + "          <locale>en_US</locale>" + "          <locale>ru_RU</locale>" + "        </runtimeLocales>" + "      </configuration>" + "    </plugin>" + "  </plugins>" + "</build>" + flexFrameworkDependency("3.2.0.3958"));
    importProject();
    checkBCCount("m1", 1);
    checkBC("m1", "m1", new BuildConfigurationNature(Web, false, Application), "", "m1-1.0.swf", "target", "3.2.0.3958", "en_US", "target/m1-1.0-config-report.xml");
    /*checkBC(findResourceFacet("m1", "en_US"),
            FlexBuildConfiguration.APPLICATION,
            "target/locales",
            "m1-1.0-en_US.swf",
            "target/locales/m1-1.0-en_US-config-report.xml",
            FlexmojosSdkType.getInstance());

    checkBC(findResourceFacet("m1", "ru_RU"),
            FlexBuildConfiguration.APPLICATION,
            "target/locales",
            "m1-1.0-ru_RU.swf",
            "target/locales/m1-1.0-ru_RU-config-report.xml",
            FlexmojosSdkType.getInstance());*/
    checkBCCount("m2", 1);
    checkBC("m2", "m2", new BuildConfigurationNature(Web, false, Library), "", "m2-1.0.swc", "target", "3.2.0.3958", "", "target/m2-1.0-config-report.xml");
/*checkBC(findResourceFacet("m2", "en_US"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "m2-1.0-en_US.rb.swc",
            "target/locales/m2-1.0-en_US-config-report.xml",
            FlexmojosSdkType.getInstance());

    checkBC(findResourceFacet("m2", "ru_RU"),
            FlexBuildConfiguration.LIBRARY,
            "target/locales",
            "m2-1.0-ru_RU.rb.swc",
            "target/locales/m2-1.0-ru_RU-config-report.xml",
            FlexmojosSdkType.getInstance());*/
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature)

Example 4 with BuildConfigurationNature

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

the class Flexmojos3ImporterTest method testConfiguringCompiledLocalesSpecifiedByOldStyleLocalesOption.

public void testConfiguringCompiledLocalesSpecifiedByOldStyleLocalesOption() throws Exception {
    createProjectSubDirs("src/main/locales/en_US", "src/main/locales/ru_RU");
    importProject(mavenProjectDescription("project", "swc") + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <locales>" + "          <locale>en_US</locale>" + "          <param>ru_RU</param>" + "        </locales>" + "      </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 5 with BuildConfigurationNature

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

the class Flexmojos3ImporterTest method testAppWithModulesAndLib.

public void testAppWithModulesAndLib() throws Exception {
    final String pomContent = mavenProjectDescription("project", "swf") + "<properties>" + "  <my.suffix>zz</my.suffix>" + "</properties>" + "<build>" + "  <plugins>" + "    <plugin>" + flexmojosPlugin() + "      <configuration>" + "        <sourceFile>\n   pack\\pack2/Main.as\n   </sourceFile>" + "        <classifier>\n   ${my.suffix}\n   </classifier>" + "        <output>\n   output.swf\n   </output>" + "        <moduleFiles>" + "          <a>\n  Module1.mxml\n  </a>" + "          <moduleFile>ignore.txt</moduleFile>" + "          <moduleFile>\n  pack\\Module2.as\n  </moduleFile>" + "        </moduleFiles>" + "      </configuration>" + "     </plugin>" + "     <plugin>" + "       <groupId>org.codehaus.gmaven</groupId>" + "       <artifactId>gmaven-plugin</artifactId>" + "       <version>1.3</version>" + "     </plugin>" + "  </plugins>" + "</build>" + flexFrameworkDependency("3.2.0.3958");
    importProject(pomContent);
    checkBCCount("project", 3);
    checkBC("project", "project", new BuildConfigurationNature(Web, false, Application), "pack.pack2.Main", "output.swf", "", "3.2.0.3958", "en_US", "target/project-1.0-zz-config-report.xml");
    checkBC("project", "Module1", new BuildConfigurationNature(Web, false, RuntimeLoadedModule), "Module1", "project-1.0-Module1.swf", "target", "3.2.0.3958", "en_US", "target/project-1.0-Module1-config-report.xml");
    checkBC("project", "Module2", new BuildConfigurationNature(Web, false, RuntimeLoadedModule), "pack.Module2", "project-1.0-Module2.swf", "target", "3.2.0.3958", "en_US", "target/project-1.0-Module2-config-report.xml");
    final Module module = ModuleManager.getInstance(myProject).findModuleByName("project");
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        for (ModifiableFlexBuildConfiguration bc : editor.getConfigurations(module)) {
            bc.getCompilerOptions().setAdditionalOptions("custom options");
        }
    });
    importProject(pomContent.replace("swf", "swc"));
    checkBCCount("project", 3);
    checkBC("project", "project", new BuildConfigurationNature(Web, false, Library), "", "output.swc", "", "3.2.0.3958", "", "target/project-1.0-zz-config-report.xml");
    final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(module).findConfigurationByName("project");
    assertEquals("custom options", bc.getCompilerOptions().getAdditionalOptions());
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) 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