use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class LayoutRenderingIssueValidationStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
if (myModelVersion != null) {
String text = String.format("Using an obsolete version of the Gradle plugin (%1$s);", myModelVersion);
text += " this can lead to layouts not rendering correctly.";
SyncMessage message = new SyncMessage(DEFAULT_GROUP, WARNING, text);
message.add(Arrays.asList(new FixAndroidGradlePluginVersionHyperlink(), new OpenUrlHyperlink("https://code.google.com/p/android/issues/detail?id=170841", "More Info...")));
SyncMessages.getInstance(getProject()).report(message);
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class JdkModuleSetupStep method setUpInAndroidStudio.
@VisibleForTesting
void setUpInAndroidStudio(@NotNull Module module, @NotNull AndroidModuleModel androidModel) {
AndroidProject androidProject = androidModel.getAndroidProject();
String compileTarget = androidProject.getCompileTarget();
AndroidVersion version = AndroidTargetHash.getPlatformVersion(compileTarget);
if (version != null && version.getFeatureLevel() >= 21) {
Sdk jdk = myIdeSdks.getJdk();
if (jdk != null && !myJdks.isApplicableJdk(jdk, JDK_1_7)) {
Project project = module.getProject();
SyncMessage msg;
String text = "compileSdkVersion " + compileTarget + " requires compiling with JDK 7 or newer.";
VirtualFile buildFile = getGradleBuildFile(module);
if (buildFile != null) {
msg = reportWrongJdkError(project, text, buildFile);
} else {
msg = reportWrongJdkError(project, text);
}
SyncMessages.getInstance(project).report(msg);
GradleSyncState.getInstance(project).getSummary().setWrongJdkFound(true);
}
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class SdkModuleSetupStep method showPlatformNotFoundError.
private static void showPlatformNotFoundError(@NotNull Module module, @NotNull String compileTarget) {
String text = String.format("Module '%1$s': platform '%2$s' not found.", module.getName(), compileTarget);
getLog().warn(text);
SyncMessage msg = new SyncMessage(SDK_SETUP_ISSUES, ERROR, text);
SyncMessages.getInstance(module.getProject()).report(msg);
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class ExternalNdkBuildIssuesReporter method report.
@Override
void report(@NotNull SyncIssue syncIssue, @NotNull Module module, @Nullable VirtualFile buildFile) {
String group = "External Native Build Issues";
String nativeToolOutput = syncIssue.getData();
if (nativeToolOutput != null) {
SyncMessages messages = getSyncMessages(module);
// Parse the native build tool output with the list of existing parsers.
List<Message> compilerMessages = myBuildOutputParser.parseGradleOutput(nativeToolOutput);
for (Message compilerMessage : compilerMessages) {
MessageType type = MessageType.findMatching(compilerMessage.getKind());
PositionInFile position = createPosition(compilerMessage.getSourceFilePositions());
String text = compilerMessage.getText();
Project project = module.getProject();
if (type == ERROR) {
// TODO make error handlers work with SyncMessage, instead of NotificationData.
NotificationCategory category = type.convertToCategory();
NotificationData notification = messages.createNotification(group, text, category, position);
// Try to parse the error messages using the list of existing error handlers to find any potential quick-fixes.
for (SyncErrorHandler handler : myErrorHandlers) {
if (handler.handleError(new ExternalSystemException(text), notification, project)) {
break;
}
}
messages.report(notification);
continue;
}
SyncMessage message;
if (position != null) {
message = new SyncMessage(project, group, type, position, text);
} else {
message = new SyncMessage(group, type, text);
}
messages.report(message);
}
}
}
use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.
the class UnsupportedGradleReporter method report.
@Override
void report(@NotNull SyncIssue syncIssue, @NotNull Module module, @Nullable VirtualFile buildFile) {
String text = syncIssue.getMessage();
MessageType type = getMessageType(syncIssue);
SyncMessage message = new SyncMessage(DEFAULT_GROUP, type, NonNavigatable.INSTANCE, text);
String gradleVersion = syncIssue.getData();
List<NotificationHyperlink> quickFixes = getQuickFixHyperlinks(module.getProject(), gradleVersion);
message.add(quickFixes);
getSyncMessages(module).report(message);
}
Aggregations