use of org.jetbrains.jps.ModuleChunk in project intellij-community by JetBrains.
the class IncProjectBuilder method runBuildersForChunk.
private boolean runBuildersForChunk(final CompileContext context, final BuildTargetChunk chunk) throws ProjectBuildException, IOException {
Set<? extends BuildTarget<?>> targets = chunk.getTargets();
if (targets.size() > 1) {
Set<ModuleBuildTarget> moduleTargets = new LinkedHashSet<>();
for (BuildTarget<?> target : targets) {
if (target instanceof ModuleBuildTarget) {
moduleTargets.add((ModuleBuildTarget) target);
} else {
String targetsString = StringUtil.join(targets, (Function<BuildTarget<?>, String>) target1 -> StringUtil.decapitalize(target1.getPresentableName()), ", ");
context.processMessage(new CompilerMessage("", BuildMessage.Kind.ERROR, "Cannot build " + StringUtil.decapitalize(target.getPresentableName()) + " because it is included into a circular dependency (" + targetsString + ")"));
return false;
}
}
return runModuleLevelBuilders(context, new ModuleChunk(moduleTargets));
}
final BuildTarget<?> target = targets.iterator().next();
if (target instanceof ModuleBuildTarget) {
return runModuleLevelBuilders(context, new ModuleChunk(Collections.singleton((ModuleBuildTarget) target)));
}
// In general the set of files corresponding to changed source file may be different
// Need this for example, to keep up with case changes in file names for case-insensitive OSes:
// deleting the output before copying is the only way to ensure the case of the output file's name is exactly the same as source file's case
cleanOldOutputs(context, target);
final List<TargetBuilder<?, ?>> builders = BuilderRegistry.getInstance().getTargetBuilders();
final float builderProgressDelta = 1.0f / builders.size();
for (TargetBuilder<?, ?> builder : builders) {
buildTarget(target, context, builder);
updateDoneFraction(context, builderProgressDelta);
}
return true;
}
Aggregations