@Override public final ExitCode build( CompileContext context, ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, OutputConsumer outputConsumer) throws ProjectBuildException, IOException { if (outputConsumer.getCompiledClasses().isEmpty() || !isEnabled(context, chunk)) { return ExitCode.NOTHING_DONE; } final String progress = getProgressMessage(); final boolean shouldShowProgress = !StringUtil.isEmptyOrSpaces(progress); if (shouldShowProgress) { context.processMessage(new ProgressMessage(progress + " [" + chunk.getName() + "]")); } ExitCode exitCode = ExitCode.NOTHING_DONE; try { InstrumentationClassFinder finder = CLASS_FINDER.get(context); // try using shared finder if (finder == null) { final Collection<File> platformCp = ProjectPaths.getPlatformCompilationClasspath(chunk, false); final Collection<File> classpath = new ArrayList<File>(); classpath.addAll(ProjectPaths.getCompilationClasspath(chunk, false)); classpath.addAll(ProjectPaths.getSourceRootsWithDependents(chunk).keySet()); finder = createInstrumentationClassFinder(platformCp, classpath, outputConsumer); CLASS_FINDER.set(context, finder); } exitCode = performBuild(context, chunk, finder, outputConsumer); } finally { if (shouldShowProgress) { context.processMessage(new ProgressMessage("")); // cleanup progress } } return exitCode; }