@NotNull DirtyFilesHolder<ErlangSourceRootDescriptor, ErlangTarget> holder,
@NotNull BuildOutputConsumer outputConsumer,
@NotNull CompileContext context) throws ProjectBuildException, IOException {
if (!holder.hasDirtyFiles() && !holder.hasRemovedFiles()) return;
JpsModule module = target.getModule();
JpsProject project = module.getProject();
ErlangCompilerOptions compilerOptions = JpsErlangCompilerOptionsExtension.getOrCreateExtension(project).getOptions();
if (!compilerOptions.myUseRebarCompiler) return;
String rebarExecutablePath = getRebarExecutablePath(project);
if (rebarExecutablePath == null) {
String errorMessage = "Rebar path is not set";
context.processMessage(new CompilerMessage(NAME, BuildMessage.Kind.ERROR, errorMessage));
throw new ProjectBuildException(errorMessage);
}
for (String contentRootUrl : module.getContentRootsList().getUrls()) {
String contentRootPath = new URL(contentRootUrl).getPath();
File contentRootDir = new File(contentRootPath);
File rebarConfigFile = new File(contentRootDir, REBAR_CONFIG_FILE_NAME);
if (!rebarConfigFile.exists()) continue;
runRebar(contentRootPath, rebarExecutablePath, compilerOptions.myAddDebugInfoEnabled, context);