Add directory to project: also partially sync if we're deriving targets from directories.
Normally the 'add directory to project' dialog has an option to add the targets as well. If we're auto-deriving, we're always implicitly adding targets, so that dialog option is disabled.
@@ -238,15 +238,17 @@ public final class AddDirectoryToProjectAction extends BlazeProjectAction {
.map(DirectoryEntry::include)
.collect(toCollection(LinkedHashSet::new));
+ boolean autoDeriveTargets = autoDeriveTargets();
+
Set<TargetExpression> newTargets =
- autoDeriveTargets()
+ autoDeriveTargets
? ImmutableSet.of()
: pathsToAdd.stream()
.filter(path -> !existingRoots.containsWorkspacePath(path))
.map(TargetExpression::allFromPackageRecursive)
.collect(toCollection(LinkedHashSet::new));
- boolean addTargets = addTargetsCheckBox.isSelected();
+ boolean addTargets = autoDeriveTargets || addTargetsCheckBox.isSelected();
ProjectViewEdit edit =
ProjectViewEdit.editLocalProjectView(
