use of org.kie.workbench.common.services.backend.compiler.impl.pomprocessor.PomPlaceHolder in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnabler method process.
@Override
public ProcessedPoms process(final CompilationRequest req) {
if (!isValidConfiguration) {
return new ProcessedPoms(Boolean.FALSE, Collections.emptyList());
}
Path mainPom = Paths.get(URI.create(FILE_URI + req.getKieCliRequest().getWorkingDirectory() + "/" + POM_NAME));
if (!Files.isReadable(mainPom)) {
return new ProcessedPoms(Boolean.FALSE, Collections.emptyList());
}
PomPlaceHolder placeHolder = editor.readSingle(mainPom);
// check if the main pom is already scanned and edited
Boolean isPresent = isPresent(placeHolder);
if (placeHolder.isValid() && !isPresent) {
// recursive NIO search in all subfolders
List<String> pomsList = MavenUtils.searchPoms(mainPom.getParent());
boolean result = false;
if (pomsList.size() > 0) {
result = processFoundPoms(pomsList, req);
}
return new ProcessedPoms(result, pomsList);
} else {
return new ProcessedPoms(Boolean.FALSE, Collections.emptyList());
}
}
use of org.kie.workbench.common.services.backend.compiler.impl.pomprocessor.PomPlaceHolder in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnabler method processFoundPoms.
private boolean processFoundPoms(List<String> poms, CompilationRequest request) {
boolean result = true;
for (String pom : poms) {
Path tmpPom = Paths.get(URI.create(FILE_URI + pom));
PomPlaceHolder tmpPlaceHolder = editor.readSingle(tmpPom);
if (!isPresent(tmpPlaceHolder)) {
result = result && editor.write(tmpPom, request);
}
}
return result;
}
Aggregations