use of com.intellij.flex.model.bc.BuildConfigurationNature 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.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testBadResolveOfSuperClass.
public void testBadResolveOfSuperClass() throws Exception {
final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
WriteAction.run(() -> FlexTestUtils.modifyConfigs(myProject, editor -> {
final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
FlexTestUtils.setSdk(bc1, sdk);
final ModifiableFlexBuildConfiguration bc2 = editor.createConfiguration(myModule);
bc2.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
bc2.setName("2");
FlexTestUtils.setSdk(bc2, sdk);
}));
doTestFor(true, getTestName(false) + ".mxml");
}
use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.
the class AddBuildConfigurationDialog method getNature.
public BuildConfigurationNature getNature() {
TargetPlatform targetPlatform = (TargetPlatform) myTargetPlatformCombo.getSelectedItem();
boolean isPureAs = myPureActionScriptCheckBox.isSelected();
OutputType outputType = (OutputType) myOutputTypeCombo.getSelectedItem();
return new BuildConfigurationNature(targetPlatform, isPureAs, outputType);
}
use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.
the class FlexProjectConfigurationEditor method resetNonApplicableValuesToDefaults.
public static void resetNonApplicableValuesToDefaults(final ModifiableFlexBuildConfiguration bc) {
final FlexBuildConfiguration defaultConfiguration = new FlexBuildConfigurationImpl();
final BuildConfigurationNature nature = bc.getNature();
if (bc.getOutputType() != OutputType.RuntimeLoadedModule) {
bc.setOptimizeFor(defaultConfiguration.getOptimizeFor());
}
if (nature.isLib()) {
bc.setMainClass(defaultConfiguration.getMainClass());
}
if (!nature.isWebPlatform() || !nature.isApp()) {
bc.setUseHtmlWrapper(defaultConfiguration.isUseHtmlWrapper());
bc.setWrapperTemplatePath(defaultConfiguration.getWrapperTemplatePath());
}
if (!BCUtils.canHaveRLMsAndRuntimeStylesheets(bc)) {
bc.setRLMs(defaultConfiguration.getRLMs());
bc.setCssFilesToCompile(defaultConfiguration.getCssFilesToCompile());
}
if (!ArrayUtil.contains(bc.getDependencies().getFrameworkLinkage(), BCUtils.getSuitableFrameworkLinkages(nature))) {
bc.getDependencies().setFrameworkLinkage(defaultConfiguration.getDependencies().getFrameworkLinkage());
}
if (!nature.isWebPlatform()) {
bc.getDependencies().setTargetPlayer(defaultConfiguration.getDependencies().getTargetPlayer());
}
if (nature.isMobilePlatform() || bc.isPureAs()) {
bc.getDependencies().setComponentSet(defaultConfiguration.getDependencies().getComponentSet());
}
for (Iterator<ModifiableDependencyEntry> i = bc.getDependencies().getModifiableEntries().iterator(); i.hasNext(); ) {
final ModifiableDependencyEntry entry = i.next();
if (entry instanceof BuildConfigurationEntry) {
final FlexBuildConfiguration dependencyBC = ((BuildConfigurationEntry) entry).findBuildConfiguration();
if (dependencyBC == null || !FlexCommonUtils.checkDependencyType(bc.getOutputType(), dependencyBC.getOutputType(), entry.getDependencyType().getLinkageType())) {
i.remove();
}
}
}
if (bc.getTargetPlatform() != TargetPlatform.Desktop || bc.getOutputType() != OutputType.Application) {
((AirDesktopPackagingOptionsImpl) defaultConfiguration.getAirDesktopPackagingOptions()).applyTo(((AirDesktopPackagingOptionsImpl) bc.getAirDesktopPackagingOptions()));
}
if (bc.getTargetPlatform() != TargetPlatform.Mobile || bc.getOutputType() != OutputType.Application) {
((AndroidPackagingOptionsImpl) defaultConfiguration.getAndroidPackagingOptions()).applyTo(((AndroidPackagingOptionsImpl) bc.getAndroidPackagingOptions()));
((IosPackagingOptionsImpl) defaultConfiguration.getIosPackagingOptions()).applyTo(((IosPackagingOptionsImpl) bc.getIosPackagingOptions()));
}
if (!nature.isLib()) {
bc.getCompilerOptions().setFilesToIncludeInSWC(Collections.emptyList());
}
}
use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.
the class FlexCompilerDependenciesCache method cacheBC.
public void cacheBC(final Module module, final FlexBuildConfiguration bc, final List<VirtualFile> configFiles) {
Collection<BCInfo> infosForModule = myCache.get(module);
if (infosForModule == null) {
infosForModule = new ArrayList<>();
myCache.put(module, infosForModule);
} else {
final BCInfo existingInfo = findCacheForBC(infosForModule, bc);
if (existingInfo != null) {
infosForModule.remove(existingInfo);
}
}
final VirtualFile outputFile = FlexCompilationManager.refreshAndFindFileInWriteAction(bc.getActualOutputFilePath());
if (outputFile == null)
return;
final BCInfo bcInfo = new BCInfo(Factory.getCopy(bc), ModuleRootManager.getInstance(module).getSourceRootUrls());
infosForModule.add(bcInfo);
bcInfo.addFileDependency(outputFile.getPath());
final String workDirPath = FlexUtils.getFlexCompilerWorkDirPath(module.getProject(), null);
for (VirtualFile configFile : configFiles) {
addFileDependencies(bcInfo, configFile, workDirPath);
}
if (bc.isTempBCForCompilation() && !bc.getCompilerOptions().getAdditionalConfigFilePath().isEmpty()) {
bcInfo.addFileDependency(bc.getCompilerOptions().getAdditionalConfigFilePath());
}
final BuildConfigurationNature nature = bc.getNature();
if (nature.isApp() && !nature.isWebPlatform()) {
if (nature.isDesktopPlatform()) {
if (!bc.getAirDesktopPackagingOptions().isUseGeneratedDescriptor()) {
bcInfo.addFileDependency(bc.getAirDesktopPackagingOptions().getCustomDescriptorPath());
}
} else {
if (bc.getAndroidPackagingOptions().isEnabled() && !bc.getAndroidPackagingOptions().isUseGeneratedDescriptor()) {
bcInfo.addFileDependency(bc.getAndroidPackagingOptions().getCustomDescriptorPath());
}
if (bc.getIosPackagingOptions().isEnabled() && !bc.getIosPackagingOptions().isUseGeneratedDescriptor()) {
bcInfo.addFileDependency(bc.getIosPackagingOptions().getCustomDescriptorPath());
}
}
}
}
Aggregations