use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class PrepareToDeployAction method doPrepare.
public void doPrepare(final List<Module> pluginModules, final Project project) {
final List<String> errorMessages = new ArrayList<>();
final List<String> successMessages = new ArrayList<>();
final CompilerManager compilerManager = CompilerManager.getInstance(project);
compilerManager.make(compilerManager.createModulesCompileScope(pluginModules.toArray(new Module[pluginModules.size()]), true), new CompileStatusNotification() {
public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
if (aborted || errors != 0)
return;
ApplicationManager.getApplication().invokeLater(() -> {
for (Module aModule : pluginModules) {
if (!doPrepare(aModule, errorMessages, successMessages)) {
return;
}
}
if (!errorMessages.isEmpty()) {
Messages.showErrorDialog(errorMessages.iterator().next(), DevKitBundle.message("error.occurred"));
} else if (!successMessages.isEmpty()) {
StringBuilder messageBuf = new StringBuilder();
for (String message : successMessages) {
if (messageBuf.length() != 0) {
messageBuf.append('\n');
}
messageBuf.append(message);
}
final String title = pluginModules.size() == 1 ? DevKitBundle.message("success.deployment.message", pluginModules.get(0).getName()) : DevKitBundle.message("success.deployment.message.all");
NOTIFICATION_GROUP.createNotification(title, messageBuf.toString(), NotificationType.INFORMATION, null).notify(project);
}
}, project.getDisposed());
}
});
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class AppEngineUploader method compileAndUpload.
private void compileAndUpload() {
final Runnable startUploading = () -> ApplicationManager.getApplication().invokeLater(() -> startUploadingProcess());
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
final CompileScope moduleScope = compilerManager.createModuleCompileScope(myAppEngineFacet.getModule(), true);
final CompileScope compileScope = ArtifactCompileScope.createScopeWithArtifacts(moduleScope, Collections.singletonList(myArtifact));
ApplicationManager.getApplication().invokeLater(() -> compilerManager.make(compileScope, new CompileStatusNotification() {
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (!aborted && errors == 0) {
startUploading.run();
}
}
}));
}
use of com.intellij.openapi.compiler.CompilerManager in project android by JetBrains.
the class AndroidProjectComponent method projectOpened.
@Override
public void projectOpened() {
final CompilerManager manager = CompilerManager.getInstance(myProject);
manager.addBeforeTask(new AndroidPrecompileTask());
myDisposable = Disposer.newDisposable(getClass().getName());
if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
if (ProjectFacetManager.getInstance(myProject).hasFacets(AndroidFacet.ID)) {
createAndroidSpecificComponents();
} else {
final MessageBusConnection connection = myProject.getMessageBus().connect(myDisposable);
connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {
@Override
public void facetAdded(@NotNull Facet facet) {
if (facet instanceof AndroidFacet) {
createAndroidSpecificComponents();
connection.disconnect();
}
}
});
}
}
}
use of com.intellij.openapi.compiler.CompilerManager in project android by JetBrains.
the class AndroidCompileUtil method isExcludedFromCompilation.
public static boolean isExcludedFromCompilation(VirtualFile child, @Nullable Project project) {
final CompilerManager compilerManager = project != null ? CompilerManager.getInstance(project) : null;
if (compilerManager == null) {
return false;
}
if (!compilerManager.isExcludedFromCompilation(child)) {
return false;
}
final Module module = ModuleUtil.findModuleForFile(child, project);
if (module == null) {
return true;
}
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null || facet.isAppProject()) {
return true;
}
final AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
if (platform == null) {
return true;
}
// we exclude sources of library modules automatically for tools r7 or previous
return platform.getSdkData().getPlatformToolsRevision() > 7;
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-plugins by JetBrains.
the class AirPackageAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getProject();
if (project == null)
return;
final AirPackageDialog dialog = new AirPackageDialog(project);
if (!dialog.showAndGet()) {
return;
}
final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCs = dialog.getSelectedBCs();
final Set<Module> modules = new THashSet<>();
for (Pair<Module, FlexBuildConfiguration> bc : modulesAndBCs) {
modules.add(bc.first);
}
final CompilerManager compilerManager = CompilerManager.getInstance(project);
final CompileScope compileScope = compilerManager.createModulesCompileScope(modules.toArray(new Module[modules.size()]), false);
FlexResourceBuildTargetScopeProvider.setBCsToCompileForPackaging(compileScope, modulesAndBCs);
compilerManager.make(compileScope, new CompileStatusNotification() {
public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
if (!aborted && errors == 0) {
createPackages(project, modulesAndBCs, dialog.getPasswords());
}
}
});
}
Aggregations