use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class MavenTasksManager method initComponent.
@Override
public void initComponent() {
if (!isNormalProject())
return;
if (isInitialized.getAndSet(true))
return;
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
class MyCompileTask implements CompileTask {
private final boolean myBefore;
MyCompileTask(boolean before) {
myBefore = before;
}
@Override
public boolean execute(CompileContext context) {
return doExecute(myBefore, context);
}
}
compilerManager.addBeforeTask(new MyCompileTask(true));
compilerManager.addAfterTask(new MyCompileTask(false));
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class ValidationConfigurable method getValidators.
private List<Compiler> getValidators() {
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
final List<Compiler> validators = new ArrayList<>();
validators.addAll(Arrays.asList(compilerManager.getCompilers(Validator.class)));
for (GenericCompiler compiler : compilerManager.getCompilers(GenericCompiler.class)) {
if (compiler.getOrderPlace() == GenericCompiler.CompileOrderPlace.VALIDATING) {
validators.add(compiler);
}
}
return validators;
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class CompilerConfigurationImpl method createCompilers.
private void createCompilers() {
if (JAVAC_EXTERNAL_BACKEND != null) {
return;
}
JAVAC_EXTERNAL_BACKEND = new JavacCompiler(myProject);
myRegisteredCompilers.add(JAVAC_EXTERNAL_BACKEND);
if (!ApplicationManager.getApplication().isUnitTestMode()) {
if (EclipseCompiler.isInitialized()) {
final EclipseCompiler eclipse = new EclipseCompiler(myProject);
myRegisteredCompilers.add(eclipse);
}
}
final Set<FileType> types = new HashSet<>();
for (BackendCompiler compiler : Extensions.getExtensions(BackendCompiler.EP_NAME, myProject)) {
myRegisteredCompilers.add(compiler);
types.addAll(compiler.getCompilableFileTypes());
}
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
for (FileType type : types) {
compilerManager.addCompilableFileType(type);
}
myDefaultJavaCompiler = JAVAC_EXTERNAL_BACKEND;
for (BackendCompiler compiler : myRegisteredCompilers) {
if (compiler.getId().equals(myState.DEFAULT_COMPILER)) {
myDefaultJavaCompiler = compiler;
break;
}
}
myState.DEFAULT_COMPILER = myDefaultJavaCompiler.getId();
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class ExternalSystemTaskActivator method init.
public void init() {
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
class MyCompileTask implements CompileTask {
private final boolean myBefore;
MyCompileTask(boolean before) {
myBefore = before;
}
@Override
public boolean execute(CompileContext context) {
return doExecuteCompileTasks(myBefore, context);
}
}
compilerManager.addBeforeTask(new MyCompileTask(true));
compilerManager.addAfterTask(new MyCompileTask(false));
fireTasksChanged();
}
use of com.intellij.openapi.compiler.CompilerManager in project intellij-community by JetBrains.
the class JavaCoverageEngine method recompileProjectAndRerunAction.
@Override
public boolean recompileProjectAndRerunAction(@NotNull final Module module, @NotNull final CoverageSuitesBundle suite, @NotNull final Runnable chooseSuiteAction) {
final VirtualFile outputpath = CompilerModuleExtension.getInstance(module).getCompilerOutputPath();
final VirtualFile testOutputpath = CompilerModuleExtension.getInstance(module).getCompilerOutputPathForTests();
if ((outputpath == null && isModuleOutputNeeded(module, JavaSourceRootType.SOURCE)) || (suite.isTrackTestFolders() && testOutputpath == null && isModuleOutputNeeded(module, JavaSourceRootType.TEST_SOURCE))) {
final Project project = module.getProject();
if (suite.isModuleChecked(module))
return false;
suite.checkModule(module);
final Runnable runnable = () -> {
if (Messages.showOkCancelDialog("Project class files are out of date. Would you like to recompile? The refusal to do it will result in incomplete coverage information", "Project is out of date", Messages.getWarningIcon()) == Messages.OK) {
final CompilerManager compilerManager = CompilerManager.getInstance(project);
compilerManager.make(compilerManager.createProjectCompileScope(project), 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(() -> {
if (project.isDisposed())
return;
CoverageDataManager.getInstance(project).chooseSuitesBundle(suite);
});
}
});
} else if (!project.isDisposed()) {
CoverageDataManager.getInstance(project).chooseSuitesBundle(null);
}
};
ApplicationManager.getApplication().invokeLater(runnable);
return true;
}
return false;
}
Aggregations