use of com.intellij.openapi.compiler.CompileContext in project azure-tools-for-java by Microsoft.
the class IDEHelperImpl method buildArtifact.
private static ListenableFuture<Boolean> buildArtifact(@NotNull Project project, @NotNull final Artifact artifact, boolean rebuild) {
final SettableFuture<Boolean> future = SettableFuture.create();
Set<Artifact> artifacts = new LinkedHashSet<Artifact>(1);
artifacts.add(artifact);
CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);
ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
CompilerManager.getInstance(project).make(scope, new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
future.set(!aborted && errors == 0);
}
});
return future;
}
use of com.intellij.openapi.compiler.CompileContext in project intellij-community by JetBrains.
the class JavaAutoRunManager method createWatcher.
@NotNull
@Override
protected AutoTestWatcher createWatcher(Project project) {
return new AutoTestWatcher() {
private boolean myHasErrors = false;
private CompilationStatusListener myStatusListener;
@Override
public void activate() {
if (myStatusListener == null) {
myStatusListener = new CompilationStatusListener() {
private boolean myFoundFilesToMake = false;
@Override
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (!myFoundFilesToMake)
return;
if (errors == 0) {
restartAllAutoTests(0);
}
myHasErrors = errors == 0;
myFoundFilesToMake = false;
}
@Override
public void automakeCompilationFinished(int errors, int warnings, CompileContext compileContext) {
compilationFinished(false, errors, warnings, compileContext);
}
@Override
public void fileGenerated(String outputRoot, String relativePath) {
myFoundFilesToMake = true;
}
};
CompilerManager.getInstance(project).addCompilationStatusListener(myStatusListener, project);
}
}
@Override
public void deactivate() {
if (myStatusListener != null) {
CompilerManager.getInstance(project).removeCompilationStatusListener(myStatusListener);
}
}
@Override
public boolean isUpToDate(int modificationStamp) {
return !myHasErrors;
}
};
}
use of com.intellij.openapi.compiler.CompileContext in project intellij-community by JetBrains.
the class BaseClassesAnalysisAction method compileAndAnalyze.
private void compileAndAnalyze(@NotNull Project project, @NotNull AnalysisScope scope) {
if (project.isDisposed()) {
return;
}
final CompilerManager compilerManager = CompilerManager.getInstance(project);
compilerManager.make(compilerManager.createProjectCompileScope(project), new CompileStatusNotification() {
@Override
public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
if (aborted || errors != 0)
return;
ApplicationManager.getApplication().invokeLater(() -> doAnalyze(project, scope));
}
});
}
use of com.intellij.openapi.compiler.CompileContext in project intellij-community by JetBrains.
the class ShowSerializedXmlAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final PsiClass psiClass = getPsiClass(e);
if (psiClass == null)
return;
final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
if (module == null || virtualFile == null)
return;
final String className = ClassUtil.getJVMClassName(psiClass);
final Project project = getEventProject(e);
CompilerManager.getInstance(project).make(new FileSetCompileScope(Collections.singletonList(virtualFile), new Module[] { module }), new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (aborted || errors > 0)
return;
generateAndShowXml(module, className);
}
});
}
use of com.intellij.openapi.compiler.CompileContext in project intellij-community by JetBrains.
the class GradleStartupActivity method runActivity.
@Override
public void runActivity(@NotNull final Project project) {
configureBuildClasspath(project);
showNotificationForUnlinkedGradleProject(project);
final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(project);
CompilerManager.getInstance(project).addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
AccessToken token = ReadAction.start();
try {
buildConfigurationGenerator.generateBuildConfiguration(context);
} finally {
token.finish();
}
return true;
}
});
}
Aggregations