use of com.android.tools.idea.gradle.project.sync.compatibility.version.VersionRange in project android by JetBrains.
the class VersionIncompatibility method reportMessages.
void reportMessages(@NotNull Project project) {
ComponentVersionReader reader = myReaderAndVersion.getFirst();
String componentName = reader.getComponentName();
String version = myReaderAndVersion.getSecond();
String requirementComponentName = myRequirementVersionReader.getComponentName();
StringBuilder msg = new StringBuilder();
msg.append(componentName).append(" ").append(version);
PositionInFile position = reader.getVersionSource(myModule);
if (!reader.isProjectLevel() && position == null) {
msg.append(", in module '").append(myModule.getName()).append(",'");
}
msg.append(" requires ").append(requirementComponentName).append(" ");
VersionRange requirementVersionRange = myRequirement.getVersionRange();
msg.append(requirementVersionRange.getDescription());
int messageCount = myMessages.size();
if (messageCount == 1) {
msg.append(" ").append(myMessages.get(0));
} else if (messageCount > 1) {
msg.append("<ul>");
for (String message : myMessages) {
msg.append("<li>").append(message).append("</li>");
}
msg.append("</ul>");
}
MessageType messageType = myCompatibilityCheck.getType();
SyncMessage message;
List<String> textLines = new ArrayList<>();
textLines.add(msg.toString());
String failureMsg = myRequirement.getFailureMessage();
if (failureMsg != null) {
List<String> lines = Splitter.on("\\n").omitEmptyStrings().splitToList(failureMsg);
textLines.addAll(lines);
}
String[] text = toStringArray(textLines);
if (position != null) {
message = new SyncMessage(project, DEFAULT_GROUP, messageType, position, text);
} else {
message = new SyncMessage(DEFAULT_GROUP, messageType, text);
}
message.add(myRequirementVersionReader.getQuickFixes(myModule, requirementVersionRange, position));
SyncMessages.getInstance(project).report(message);
}
Aggregations