use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class BCBasedRunnerParameters method checkAndGetModuleAndBC.
public Pair<Module, FlexBuildConfiguration> checkAndGetModuleAndBC(final Project project) throws RuntimeConfigurationError {
if (myModuleName.isEmpty() || myBCName.isEmpty()) {
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}
final Module module = ModuleManager.getInstance(project).findModuleByName(myModuleName);
if (module == null || !(ModuleType.get(module) instanceof FlexModuleType)) {
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}
final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(module).findConfigurationByName(myBCName);
if (bc == null) {
throw new RuntimeConfigurationError(FlexBundle.message("module.does.not.contain.bc", myModuleName, myBCName));
}
final Sdk sdk = bc.getSdk();
if (sdk == null) {
throw new RuntimeConfigurationError(FlexCommonBundle.message("sdk.not.set.for.bc.0.of.module.1", bc.getName(), module.getName()));
}
return Pair.create(module, bc);
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class AdlUtil method runDebugger.
// http://kb2.adobe.com/cps/407/kb407625.html
public static void runDebugger(final Module module, final Runnable postTask) throws ExecutionException {
final Project project = module.getProject();
final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createConfiguration("FlashUIDesigner", RemoteFlashRunConfigurationType.getFactory());
final RemoteFlashRunConfiguration configuration = (RemoteFlashRunConfiguration) settings.getConfiguration();
RunManagerEx.disableTasks(project, settings.getConfiguration(), CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
ProgramRunner.Callback callback = new ProgramRunner.Callback() {
@Override
public void processStarted(final RunContentDescriptor descriptor) {
final ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
DesignerApplication application = DesignerApplicationManager.getApplication();
if (application != null) {
Disposer.register(application, new Disposable() {
@Override
public void dispose() {
if (!project.isDisposed()) {
ApplicationManager.getApplication().invokeLater(() -> ExecutionManager.getInstance(project).getContentManager().removeRunContent(executor, descriptor));
}
processHandler.destroyProcess();
}
});
postTask.run();
}
}
};
FlexBuildConfiguration buildConfiguration = FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration();
configuration.getRunnerParameters().setModuleName(module.getName());
configuration.getRunnerParameters().setBCName(buildConfiguration.getName());
final FlexRunner runner = new FlexRunner(callback, buildConfiguration);
runner.execute(new ExecutionEnvironment(executor, runner, settings, project));
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexUnitRunnerParameters method doCheck.
private void doCheck(final Project project, final Pair<Module, FlexBuildConfiguration> moduleAndBC) throws RuntimeConfigurationError {
if (DumbService.getInstance(project).isDumb())
return;
final FlexBuildConfiguration bc = moduleAndBC.second;
final Sdk sdk = bc.getSdk();
if (sdk == null) {
throw new RuntimeConfigurationError(FlexCommonBundle.message("sdk.not.set.for.bc.0.of.module.1", bc.getName(), moduleAndBC.first.getName()));
}
switch(bc.getTargetPlatform()) {
case Web:
break;
case Desktop:
FlashRunnerParameters.checkAdlAndAirRuntime(sdk);
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getAirDesktopPackagingOptions(), getBCName(), getModuleName());
}
break;
case Mobile:
FlashRunnerParameters.checkAdlAndAirRuntime(sdk);
switch(myAppDescriptorForEmulator) {
case Android:
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getAndroidPackagingOptions(), getBCName(), getModuleName());
}
break;
case IOS:
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getIosPackagingOptions(), getBCName(), getModuleName());
}
break;
}
break;
}
final FlexUnitSupport support = FlexUnitSupport.getSupport(bc, moduleAndBC.first);
if (support == null) {
throw new RuntimeConfigurationError(FlexBundle.message("flexunit.not.found.for.bc", bc.getName()));
}
if (!support.flexUnit4Present && bc.isPureAs()) {
throw new RuntimeConfigurationError(FlexBundle.message("cant.execute.flexunit1.for.pure.as.bc"));
}
final GlobalSearchScope searchScope = FlexUtils.getModuleWithDependenciesAndLibrariesScope(moduleAndBC.first, bc, true);
switch(getScope()) {
case Class:
getClassToTest(getClassName(), searchScope, support, true);
break;
case Method:
final JSClass classToTest = getClassToTest(getClassName(), searchScope, support, false);
if (StringUtil.isEmpty(getMethodName())) {
throw new RuntimeConfigurationError(FlexBundle.message("no.test.method.specified"));
}
final JSFunction methodToTest = classToTest.findFunctionByNameAndKind(getMethodName(), JSFunction.FunctionKind.SIMPLE);
if (methodToTest == null || !support.isTestMethod(methodToTest)) {
throw new RuntimeConfigurationError(FlexBundle.message("method.not.valid", getMethodName()));
}
break;
case Package:
if (!JSUtils.packageExists(getPackageName(), searchScope)) {
throw new RuntimeConfigurationError(FlexBundle.message("package.not.valid", getPackageName()));
}
break;
default:
assert false : "Unknown scope: " + getScope();
}
}
use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration 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.FlexBuildConfiguration in project intellij-plugins by JetBrains.
the class FlexUnitRunConfigurationForm method createUIComponents.
private void createUIComponents() {
myBCCombo = new BCCombo(myProject);
myWhatToTestForm = new WhatToTestForm(myProject, () -> {
final Module module = myBCCombo.getModule();
if (module != null)
return module;
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}, () -> {
final FlexBuildConfiguration bc = myBCCombo.getBC();
if (bc == null)
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
final FlexUnitSupport support = FlexUnitSupport.getSupport(bc, myBCCombo.getModule());
if (support != null)
return support;
throw new RuntimeConfigurationError(FlexBundle.message("flexunit.not.found.for.bc", bc.getName()));
});
}
Aggregations