mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
at the end of compilation additionally refresh output roots for generated sources, if they are located under module's source content. Need this to update errors highlighting in IDEA, if annotation processors generated something
This commit is contained in:
@@ -854,15 +854,37 @@ public class CompileDriver {
|
||||
if (refreshOutputRoots) {
|
||||
// refresh on output roots is required in order for the order enumerator to see all roots via VFS
|
||||
final Set<File> outputs = new HashSet<File>();
|
||||
for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {
|
||||
final Module[] affectedModules = compileContext.getCompileScope().getAffectedModules();
|
||||
for (final String path : CompilerPathsEx.getOutputPaths(affectedModules)) {
|
||||
outputs.add(new File(path));
|
||||
}
|
||||
final LocalFileSystem lfs = LocalFileSystem.getInstance();
|
||||
if (!outputs.isEmpty()) {
|
||||
final ProgressIndicator indicator = compileContext.getProgressIndicator();
|
||||
indicator.setText("Synchronizing output directories...");
|
||||
LocalFileSystem.getInstance().refreshIoFiles(outputs, false, false, null);
|
||||
lfs.refreshIoFiles(outputs, false, false, null);
|
||||
indicator.setText("");
|
||||
}
|
||||
if (compileContext.isAnnotationProcessorsEnabled()) {
|
||||
final Set<VirtualFile> genSourceRoots = new HashSet<VirtualFile>();
|
||||
final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
|
||||
for (Module module : affectedModules) {
|
||||
if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
|
||||
final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
|
||||
if (path != null) {
|
||||
final File genPath = new File(path);
|
||||
final VirtualFile vFile = lfs.findFileByIoFile(genPath);
|
||||
if (vFile != null && ModuleRootManager.getInstance(module).getFileIndex().isInSourceContent(vFile)) {
|
||||
genSourceRoots.add(vFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!genSourceRoots.isEmpty()) {
|
||||
// refresh generates source roots asynchronously; needed for error highlighting update
|
||||
lfs.refreshFiles(genSourceRoots, true, true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user