Detecting full project rebuild in compilator

Hi,

My custom compiler needs clear some external files on full project rebuild, ie when all files are about to be rebuilt.
What I do now is:

CompilerManager.getInstance(project).addBeforeTask(this);

public boolean execute(CompileContext context) {
if (context.isMake()) {
return true;
}

final VirtualFile[] files = context.getCompileScope().getFiles(null, false);
final VirtualFile[] projectFiles = context.getProjectCompileScope().getFiles(null, false);

if (files.length == projectFiles.length) {
// here we assume we have a full rebuild
}
return true;
}

Is there more precise (and less time-consuming) way to do this?
Except context.getCompileScope() instanceof com.intellij.compiler.impl.ProjectCompileScope ?

Regards,
Slawomir Ginter

Please sign in to leave a comment.