@Override
public GenerationItem[] getGenerationItems(CompileContext compileContext) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
final CompileScope compileScope = compileContext.getCompileScope();
final CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(myProject);
final VirtualFile[] files = compileScope.getFiles(PbFileType.PROTOBUF_FILE_TYPE, false);
final List<GenerationItem> generationItems = new ArrayList<GenerationItem>(files.length);
for (VirtualFile file : files) {
if (!compilerConfiguration.isExcludedFromCompilation(file)) {
Module module = compileContext.getModuleByFile(file);
final PbFacet facet = PbFacet.getInstance(module);
if (facet != null) { // Generate if a Protobuf facet has been created for the module.
if (facet.getConfiguration().isCompilationEnabled()) {
generationItems.add(new PbGenerationItem(file, module, fileIndex.isInTestSourceContent(file)));