use of com.android.tools.idea.gradle.variant.conflict.ConflictSet in project android by JetBrains.
the class BuildVariantUpdater method updateSelectedVariant.
/**
* Updates a module's structure when the user selects a build variant from the tool window.
*
* @param project the module's project.
* @param moduleName the module's name.
* @param buildVariantName the name of the selected build variant.
* @return {@code true} if the module update was successful, {@code false} otherwise.
*/
boolean updateSelectedVariant(@NotNull Project project, @NotNull String moduleName, @NotNull String buildVariantName) {
List<AndroidFacet> affectedAndroidFacets = new ArrayList<>();
List<NdkFacet> affectedNdkFacets = new ArrayList<>();
executeProjectChanges(project, () -> {
Module updatedModule = doUpdate(project, moduleName, buildVariantName, affectedAndroidFacets, affectedNdkFacets);
if (updatedModule != null) {
ConflictSet conflicts = findConflicts(project);
conflicts.showSelectionConflicts();
}
PostSyncProjectSetup.Request setupRequest = new PostSyncProjectSetup.Request();
setupRequest.setGenerateSourcesAfterSync(false).setCleanProjectAfterSync(false);
PostSyncProjectSetup.getInstance(project).setUpProject(setupRequest, null);
generateSourcesIfNeeded(affectedAndroidFacets);
});
return !affectedAndroidFacets.isEmpty() || !affectedNdkFacets.isEmpty();
}
use of com.android.tools.idea.gradle.variant.conflict.ConflictSet in project android by JetBrains.
the class PostSyncProjectSetup method findAndShowVariantConflicts.
private void findAndShowVariantConflicts() {
ConflictSet conflicts = findConflicts(myProject);
List<Conflict> structureConflicts = conflicts.getStructureConflicts();
if (!structureConflicts.isEmpty() && SystemProperties.getBooleanProperty("enable.project.profiles", false)) {
ProjectProfileSelectionDialog dialog = new ProjectProfileSelectionDialog(myProject, structureConflicts);
dialog.show();
}
List<Conflict> selectionConflicts = conflicts.getSelectionConflicts();
if (!selectionConflicts.isEmpty()) {
boolean atLeastOneSolved = solveSelectionConflicts(selectionConflicts);
if (atLeastOneSolved) {
conflicts = findConflicts(myProject);
}
}
conflicts.showSelectionConflicts();
}
Aggregations