Determining changed class files from CompilerContext
Hello,
1) I have successfully written a CompilationStatusListener that fires whenever a Java build occurs.
2) I would like to determine which class files have been generated by the build.
3) I can already determine the class output directory, but I want more fine grained information.
4) For example, if I compile Foo.java, I want to obtain a list of all the changed class files not just their output location. In this case, it would be Foo.class and any inner classes.
Here is what I'm doing now - as I said - I can already determine the output directory:
**EXAMPLE**
public void compilationFinished(boolean aborted,
int errors,
int warnings,
CompileContext cc)
{
CompileScope cs = cc.getCompileScope();
// OK: This returns the changed Java files
VirtualFile[] vflist = cs.getFiles(StdFileTypes.JAVA,false);
//OK: This returns compiled class output directory
VirtualFile vf = CompilerPaths.getModuleOutputDirectory(...);
// PROBLEM: This always returns empty, I want to know which class files have been updated
VirtualFile[] classVFList = cs.getFiles(StdFileTypes.CLASS,false);
}
Please sign in to leave a comment.