use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexBuildTargetScopeProvider method getModulesAndBCsToCompile.
static Collection<Pair<Module, FlexBuildConfiguration>> getModulesAndBCsToCompile(final CompileScope scope) throws ConfigurationException {
final Collection<Pair<Module, FlexBuildConfiguration>> result = new HashSet<>();
final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile = FlexResourceBuildTargetScopeProvider.getBCsToCompileForPackaging(scope);
final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(scope);
if (modulesAndBCsToCompile != null) {
for (Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
if (!moduleAndBC.second.isSkipCompile()) {
final FlexBuildConfiguration bcWithForcedDebugStatus = forceDebugStatus(moduleAndBC.first.getProject(), moduleAndBC.second);
result.add(Pair.create(moduleAndBC.first, bcWithForcedDebugStatus));
appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
}
}
} else if (runConfiguration instanceof FlashRunConfiguration || runConfiguration instanceof FlexUnitRunConfiguration) {
final BCBasedRunnerParameters params = runConfiguration instanceof FlashRunConfiguration ? ((FlashRunConfiguration) runConfiguration).getRunnerParameters() : ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
final Pair<Module, FlexBuildConfiguration> moduleAndBC;
final Ref<RuntimeConfigurationError> exceptionRef = new Ref<>();
moduleAndBC = ApplicationManager.getApplication().runReadAction((NullableComputable<Pair<Module, FlexBuildConfiguration>>) () -> {
try {
return params.checkAndGetModuleAndBC(runConfiguration.getProject());
} catch (RuntimeConfigurationError e) {
exceptionRef.set(e);
return null;
}
});
if (!exceptionRef.isNull()) {
throw new ConfigurationException(exceptionRef.get().getMessage(), FlexBundle.message("run.configuration.0", runConfiguration.getName()));
}
if (!moduleAndBC.second.isSkipCompile()) {
result.add(moduleAndBC);
appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
}
} else {
for (final Module module : scope.getAffectedModules()) {
if (module.isDisposed() || ModuleType.get(module) != FlexModuleType.getInstance())
continue;
for (final FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
if (!bc.isSkipCompile()) {
result.add(Pair.create(module, bc));
}
}
}
}
return result;
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class CompilerConfigGenerator method getOrCreateConfigFile.
public static VirtualFile getOrCreateConfigFile(final Module module, final FlexBuildConfiguration bc) throws IOException {
final CompilerConfigGenerator generator = new CompilerConfigGenerator(module, bc, FlexBuildConfigurationManager.getInstance(module).getModuleLevelCompilerOptions(), FlexProjectLevelCompilerOptionsHolder.getInstance(module.getProject()).getProjectLevelCompilerOptions());
String text = generator.generateConfigFileText();
if (bc.isTempBCForCompilation()) {
final FlexBuildConfiguration originalBC = FlexBuildConfigurationManager.getInstance(module).findConfigurationByName(bc.getName());
final boolean makeExternalLibsMerged = BCUtils.isFlexUnitBC(bc) || (originalBC != null && originalBC.getOutputType() == OutputType.Library);
final boolean makeIncludedLibsMerged = BCUtils.isRuntimeStyleSheetBC(bc);
text = FlexCompilerConfigFileUtilBase.mergeWithCustomConfigFile(text, bc.getCompilerOptions().getAdditionalConfigFilePath(), makeExternalLibsMerged, makeIncludedLibsMerged);
}
final String name = getConfigFileName(module, bc.getName(), PlatformUtils.getPlatformPrefix().toLowerCase(), BCUtils.getBCSpecifier(bc));
return getOrCreateConfigFile(name, text);
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlashRunConfigurationForm method applyEditorTo.
@Override
protected void applyEditorTo(@NotNull final FlashRunConfiguration configuration) throws ConfigurationException {
final FlashRunnerParameters params = configuration.getRunnerParameters();
myBCCombo.applyTo(params);
final boolean overrideMainClass = myOverrideMainClassCheckBox.isSelected();
params.setOverrideMainClass(overrideMainClass);
params.setOverriddenMainClass(overrideMainClass ? myMainClassComponent.getText().trim() : "");
params.setOverriddenOutputFileName(overrideMainClass ? myOutputFileNameTextField.getText().trim() : "");
params.setLaunchUrl(myUrlOrFileRadioButton.isSelected());
final String url = myUrlOrFileTextWithBrowse.getText().trim();
final boolean windowsLocalFile = SystemInfo.isWindows && url.length() >= 2 && Character.isLetter(url.charAt(0)) && ':' == url.charAt(1);
params.setUrl(windowsLocalFile ? FileUtil.toSystemIndependentName(url) : url);
params.setLauncherParameters(myLauncherParameters);
params.setRunTrusted(myRunTrustedCheckBox.isSelected());
params.setAdlOptions(myAdlOptionsEditor.getText().trim());
params.setAirProgramParameters(myAirProgramParametersEditor.getText().trim());
final AirMobileRunTarget mobileRunTarget = myOnEmulatorRadioButton.isSelected() ? AirMobileRunTarget.Emulator : myOnAndroidDeviceRadioButton.isSelected() ? AirMobileRunTarget.AndroidDevice : myOnIOSSimulatorRadioButton.isSelected() ? AirMobileRunTarget.iOSSimulator : AirMobileRunTarget.iOSDevice;
params.setMobileRunTarget(mobileRunTarget);
final Emulator emulator = (Emulator) myEmulatorCombo.getSelectedItem();
params.setEmulator(emulator);
if (emulator.adlAlias == null) {
try {
params.setScreenWidth(Integer.parseInt(myScreenWidth.getText().trim()));
params.setScreenHeight(Integer.parseInt(myScreenHeight.getText().trim()));
params.setFullScreenWidth(Integer.parseInt(myFullScreenWidth.getText().trim()));
params.setFullScreenHeight(Integer.parseInt(myFullScreenHeight.getText().trim()));
} catch (NumberFormatException e) {
/**/
}
try {
params.setScreenDpi(Integer.parseInt(myScreenDpi.getText().trim()));
} catch (NumberFormatException e) {
params.setScreenDpi(0);
}
}
final FlexBuildConfiguration bc = myBCCombo.getBC();
if (SystemInfo.isMac && bc != null && bc.getTargetPlatform() == TargetPlatform.Mobile && myOnIOSSimulatorRadioButton.isSelected()) {
final String path = FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim());
if (!path.isEmpty()) {
PropertiesComponent.getInstance().setValue(LATEST_SELECTED_IOS_SIMULATOR_SDK_PATH_KEY, path);
}
}
params.setIOSSimulatorSdkPath(FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim()));
params.setFastPackaging(myFastPackagingCheckBox.isSelected());
params.setDebugTransport(myDebugOverNetworkRadioButton.isSelected() ? AirMobileDebugTransport.Network : AirMobileDebugTransport.USB);
try {
final int port = Integer.parseInt(myUsbDebugPortTextField.getText().trim());
if (port > 0 && port < 65535) {
params.setUsbDebugPort(port);
}
} catch (NumberFormatException ignore) {
/*ignore*/
}
params.setEmulatorAdlOptions(myEmulatorAdlOptionsEditor.getText().trim());
params.setAppDescriptorForEmulator((AppDescriptorForEmulator) myAppDescriptorForEmulatorCombo.getSelectedItem());
params.setDebuggerSdkRaw(mySdkForDebuggingCombo.getSelectedSdkRaw());
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlashRunConfigurationProducer method findSuitableRunConfig.
@Nullable
private static RunConfiguration findSuitableRunConfig(final Module module, final String fqn, final List<RunConfiguration> existing) {
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(module);
RunConfiguration basedOnBC = null;
RunConfiguration basedOnMainClass = null;
RunConfiguration basedOnMainClassAndActiveBC = null;
for (final RunConfiguration runConfig : existing) {
final FlashRunnerParameters params = ((FlashRunConfiguration) runConfig).getRunnerParameters();
if (module.getName().equals(params.getModuleName())) {
final FlexBuildConfiguration bc = manager.findConfigurationByName(params.getBCName());
if (bc == null)
continue;
if (params.isOverrideMainClass()) {
if (fqn.equals(params.getOverriddenMainClass())) {
if (manager.getActiveConfiguration() == bc) {
basedOnMainClassAndActiveBC = runConfig;
}
basedOnMainClass = runConfig;
}
} else {
if (bc.getOutputType() == OutputType.Application && fqn.equals(bc.getMainClass())) {
if (manager.getActiveConfiguration() == bc) {
// the best choice
return runConfig;
}
basedOnBC = runConfig;
}
}
}
}
// forth - based on overridden main class and any bc
return basedOnBC != null ? basedOnBC : basedOnMainClassAndActiveBC != null ? basedOnMainClassAndActiveBC : basedOnMainClass;
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlashRunConfigurationProducer method getBCToBaseOn.
private static FlexBuildConfiguration getBCToBaseOn(final Module module, final String fqn) {
final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(module);
FlexBuildConfiguration appWithSuitableMainClass = null;
for (FlexBuildConfiguration bc : manager.getBuildConfigurations()) {
if (bc.getOutputType() == OutputType.Application && fqn.equals(bc.getMainClass())) {
if (manager.getActiveConfiguration() == bc) {
// the best choice
return bc;
}
appWithSuitableMainClass = bc;
}
}
// if no apps with matching main class - take active bc and override main class
return appWithSuitableMainClass != null ? appWithSuitableMainClass : manager.getActiveConfiguration();
}
Aggregations