use of com.android.tools.idea.gradle.project.sync.validation.common.CommonModuleValidator in project android by JetBrains.
the class PostSyncProjectSetup method setUpProject.
/**
* Invoked after a project has been synced with Gradle.
*/
public void setUpProject(@NotNull Request request, @Nullable ProgressIndicator progressIndicator) {
// Force a refresh after a sync.
// https://code.google.com/p/android/issues/detail?id=229633
ApplicationManager.getApplication().runWriteAction(() -> ProjectRootManagerEx.getInstanceEx(myProject).makeRootsChange(EmptyRunnable.INSTANCE, false, true));
boolean syncFailed = mySyncState.lastSyncFailedOrHasIssues();
if (syncFailed && request.isUsingCachedGradleModels()) {
onCachedModelsSetupFailure(request);
return;
}
myDependencySetupErrors.reportErrors();
myVersionCompatibilityChecker.checkAndReportComponentIncompatibilities(myProject);
CommonModuleValidator moduleValidator = myModuleValidatorFactory.create(myProject);
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
for (Module module : moduleManager.getModules()) {
moduleValidator.validate(module);
}
moduleValidator.fixAndReportFoundIssues();
if (syncFailed) {
myProjectSetup.setUpProject(progressIndicator, true);
// Notify "sync end" event first, to register the timestamp. Otherwise the cache (GradleProjectSyncData) will store the date of the
// previous sync, and not the one from the sync that just ended.
mySyncState.syncEnded();
return;
}
if (myPluginVersionUpgrade.checkAndPerformUpgrade()) {
// Plugin version was upgraded and a sync was triggered.
return;
}
new ProjectStructureUsageTracker(myProject).trackProjectStructure();
DisposedModules.getInstance(myProject).deleteImlFilesForDisposedModules();
removeAllModuleCompiledArtifacts(myProject);
AndroidGradleProjectComponent.getInstance(myProject).checkForSupportedModules();
findAndShowVariantConflicts();
myProjectSetup.setUpProject(progressIndicator, false);
// For Android Studio, use "Gradle-Aware Make" to run JUnit tests.
// For IDEA, use regular "Make".
boolean androidStudio = myIdeInfo.isAndroidStudio();
String taskName = androidStudio ? MakeBeforeRunTaskProvider.TASK_NAME : ExecutionBundle.message("before.launch.compile.step");
setMakeStepInJunitRunConfigurations(taskName);
notifySyncFinished(request);
attemptToGenerateSources(request);
TemplateManager.getInstance().refreshDynamicTemplateMenu(myProject);
myModuleSetup.setUpModules(null);
}
Aggregations