use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexProjectConfigTest method testBcDependency.
public void testBcDependency() throws ConfigurationException {
final Module module2 = createModule("module2");
assertFalse(doesDepend(myModule, module2));
assertFalse(doesDepend(module2, myModule));
FlexTestUtils.modifyConfigs(myProject, editor -> {
ModifiableFlexBuildConfiguration module1Config = editor.getConfigurations(myModule)[0];
ModifiableFlexBuildConfiguration module2Config = editor.getConfigurations(module2)[0];
ModifiableBuildConfigurationEntry entry = editor.createBcEntry(module1Config.getDependencies(), module2Config, null);
editor.setEntries(module1Config.getDependencies(), Collections.singletonList(entry));
});
assertTrue(doesDepend(myModule, module2));
assertFalse(doesDepend(module2, myModule));
FlexTestUtils.modifyConfigs(myProject, editor -> {
ModifiableFlexBuildConfiguration module1Config = editor.getConfigurations(myModule)[0];
editor.setEntries(module1Config.getDependencies(), new ArrayList<>());
});
assertFalse(doesDepend(myModule, module2));
assertFalse(doesDepend(module2, myModule));
final Module module3 = createModule("module3");
final Module module4 = createModule("module4");
FlexTestUtils.modifyConfigs(myProject, editor -> {
ModifiableFlexBuildConfiguration m1bc1 = editor.getConfigurations(myModule)[0];
ModifiableFlexBuildConfiguration m1bc2 = createConfiguration(editor, myModule);
ModifiableFlexBuildConfiguration m1bc3 = createConfiguration(editor, myModule);
ModifiableFlexBuildConfiguration m1bc4 = createConfiguration(editor, myModule);
ModifiableFlexBuildConfiguration m2bc1 = editor.getConfigurations(module2)[0];
ModifiableFlexBuildConfiguration m3bc1 = editor.getConfigurations(module3)[0];
ModifiableFlexBuildConfiguration m2bc2 = createConfiguration(editor, module2);
ModifiableBuildConfigurationEntry e1 = editor.createBcEntry(m1bc1.getDependencies(), m2bc1, null);
editor.setEntries(m1bc1.getDependencies(), Collections.singletonList(e1));
ModifiableBuildConfigurationEntry e2 = editor.createBcEntry(m1bc2.getDependencies(), m2bc2, null);
ModifiableBuildConfigurationEntry e3 = editor.createBcEntry(m1bc2.getDependencies(), m3bc1, null);
editor.setEntries(m1bc1.getDependencies(), Arrays.asList(e2, e3));
});
assertTrue(doesDepend(myModule, module2));
assertTrue(doesDepend(myModule, module3));
assertFalse(doesDepend(myModule, module4));
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class ActionScriptCompletionInTextFieldTest method doTestCustomScope.
private void doTestCustomScope(String activeBcName, String selectedBcName, int numberOfVariants) throws Exception {
String filename = getTestName(false).replaceAll("\\d+", "");
configureByFiles(null, BASE_PATH + filename + "_2.mxml", BASE_PATH + filename + "_3.mxml");
final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
FlexTestUtils.modifyConfigs(myProject, e -> {
{
final ModifiableFlexBuildConfiguration bc = e.getConfigurations(myModule)[0];
bc.setName("Flex");
bc.setNature(new BuildConfigurationNature(TargetPlatform.Web, false, OutputType.Application));
FlexTestUtils.setSdk(bc, sdk);
}
{
final ModifiableFlexBuildConfiguration bc = e.createConfiguration(myModule);
bc.setName("AIR");
bc.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
FlexTestUtils.setSdk(bc, sdk);
}
});
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(myModule);
manager.setActiveBuildConfiguration(manager.findConfigurationByName(activeBcName));
final ModuleWithDependenciesScope scope = FlexUtils.getModuleWithDependenciesAndLibrariesScope(myModule, manager.findConfigurationByName(selectedBcName), false);
PublicInheritorFilter filter = new PublicInheritorFilter(myProject, FlashRunConfigurationForm.SPRITE_CLASS_NAME, scope, true);
PsiFile fragment = JSReferenceEditor.forClassName("", myProject, null, GlobalSearchScope.moduleScope(myModule), null, filter, "").getPsiFile();
doTestForEditorTextField((JSExpressionCodeFragment) fragment, "", "js2", BASE_PATH + filename + ".txt");
if (numberOfVariants == 0) {
assertNull(myItems);
} else {
assertEquals(numberOfVariants, myItems.length);
}
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class ActionScriptCompletionTest method testTwoSdks.
public void testTwoSdks() throws Exception {
final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
FlexTestUtils.modifyConfigs(myProject, new Consumer<FlexProjectConfigurationEditor>() {
public void consume(final FlexProjectConfigurationEditor editor) {
ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
bc1.setName("1");
FlexTestUtils.setSdk(bc1, sdk45);
ModifiableFlexBuildConfiguration bc2 = editor.createConfiguration(myModule);
bc2.setName("2");
FlexTestUtils.setSdk(bc2, sdk46);
}
});
final FlexBuildConfigurationManager m = FlexBuildConfigurationManager.getInstance(myModule);
class TestZZ implements ThrowableRunnable<Exception> {
private final String myBcName;
private final String myExpectedTypeText;
TestZZ(final String bcName, final String expectedTypeText) {
myBcName = bcName;
myExpectedTypeText = expectedTypeText;
}
@Override
public void run() throws Exception {
m.setActiveBuildConfiguration(m.findConfigurationByName(myBcName));
defaultTest();
for (LookupElement item : myItems) {
final LookupElementPresentation p = new LookupElementPresentation();
item.renderElement(p);
assertEquals(myExpectedTypeText, p.getTypeText());
}
}
}
new TestZZ("1", sdk45.getName()).run();
new TestZZ("2", sdk46.getName()).run();
new TestZZ("1", sdk45.getName()).run();
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexUnitRunnerParameters method checkAndGetModuleAndBC.
public Pair<Module, FlexBuildConfiguration> checkAndGetModuleAndBC(final Project project) throws RuntimeConfigurationError {
final Pair<Module, FlexBuildConfiguration> moduleAndBC = super.checkAndGetModuleAndBC(project);
doCheck(project, moduleAndBC);
final ModifiableFlexBuildConfiguration overriddenBC = Factory.getTemporaryCopyForCompilation(moduleAndBC.second);
overriddenBC.setOutputType(OutputType.Application);
overriddenBC.setMainClass(FlexCommonUtils.FLEX_UNIT_LAUNCHER);
overriddenBC.setOutputFileName("_flexunit.swf");
overriddenBC.setOutputFolder(VfsUtilCore.urlToPath(CompilerModuleExtension.getInstance(moduleAndBC.first).getCompilerOutputUrlForTests()));
overriddenBC.setUseHtmlWrapper(false);
overriddenBC.setRLMs(Collections.emptyList());
overriddenBC.setCssFilesToCompile(Collections.emptyList());
overriddenBC.setSkipCompile(false);
overriddenBC.getDependencies().setFrameworkLinkage(LinkageType.Merged);
for (ModifiableDependencyEntry entry : overriddenBC.getDependencies().getModifiableEntries()) {
if (entry.getDependencyType().getLinkageType() == LinkageType.External) {
entry.getDependencyType().setLinkageType(LinkageType.Merged);
}
}
return Pair.create(moduleAndBC.first, ((FlexBuildConfiguration) overriddenBC));
}
use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexBCConfigurator method copy.
public void copy(final CompositeConfigurable configurable, final Runnable treeNodeNameUpdater) {
try {
configurable.apply();
} catch (ConfigurationException ignored) {
/**/
}
ModifiableFlexBuildConfiguration existingBC = myConfigurablesMap.getKeysByValue(configurable).get(0);
FlexBCConfigurable unwrapped = FlexBCConfigurable.unwrap(configurable);
final String title = FlexBundle.message("copy.build.configuration", existingBC.getName(), unwrapped.getModule().getName());
Module module = unwrapped.getModule();
AddBuildConfigurationDialog dialog = new AddBuildConfigurationDialog(module.getProject(), title, getUsedNames(module), existingBC.getNature(), true);
dialog.reset("", existingBC.getAndroidPackagingOptions().isEnabled(), existingBC.getIosPackagingOptions().isEnabled());
if (!dialog.showAndGet()) {
return;
}
final String newBCName = dialog.getBCName();
final String fileName = PathUtil.suggestFileName(newBCName);
final BuildConfigurationNature newNature = dialog.getNature();
ModifiableFlexBuildConfiguration newBC = myConfigEditor.copyConfiguration(existingBC, newNature);
newBC.setName(newBCName);
newBC.setOutputFileName(fileName + (newBC.getOutputType() == OutputType.Library ? ".swc" : ".swf"));
updatePackageFileName(newBC, fileName);
if (newNature.isApp() && newNature.isMobilePlatform()) {
newBC.getAndroidPackagingOptions().setEnabled(dialog.isAndroidEnabled());
newBC.getIosPackagingOptions().setEnabled(dialog.isIOSEnabled());
}
createConfigurableNode(newBC, unwrapped.getModule(), treeNodeNameUpdater);
}
Aggregations