Rename host_deps option to tool_deps, to reflect more closely what it now does.

The name host_deps is retained as an alias for tool_deps.

Fixes https://github.com/bazelbuild/bazel/issues/8976.

RELNOTES: The query flag "--host_deps" (commonly used as "--nohost_deps") has been renamed to "--tool_deps", and now also removes dependencies in any execution configuration from being reported in the query output. The previous flag name is deprecated and will be removed in a future release.
PiperOrigin-RevId: 267596701
diff --git a/site/docs/cquery.html b/site/docs/cquery.html
index b6e9f1e..5218a6f 100644
--- a/site/docs/cquery.html
+++ b/site/docs/cquery.html
@@ -225,17 +225,17 @@
   the BUILD file and instead set elsewhere by Bazel.
 </p>
 
-<h4><code>--host_deps</code> (boolean, default=True)</h4>
+<h4><code>--tool_deps</code> (boolean, default=True)</h4>
 
 <p>
   Setting this flag to false filters out all configured targets for which the
   path from the queried target to them crosses a transition between the target
   configuration and the
-  <a href="skylark/rules.html#configurations">host configuration</a>.
-  If the queried target is in a non-host configuration, setting <code>--nohost_deps</code> will
-  only return targets that also are in non-host configurations. If the queried
-  target is in a host configuration, setting <code>--nohost_deps</code> will only return
-  targets also in the host configuration.
+  <a href="skylark/rules.html#configurations">non-target configurations</a>.
+  If the queried target is in the target configuration, setting <code>--notool_deps</code> will
+  only return targets that also are in the target configuration. If the queried
+  target is in a non-target configuration, setting <code>--notool_deps</code> will only return
+  targets also in non-target configurations.
 </p>
 
 <h2 id='output-formats'>Output Formats</h2>
diff --git a/site/docs/tutorial/cpp.md b/site/docs/tutorial/cpp.md
index 6b869ae..b7c6f43 100644
--- a/site/docs/tutorial/cpp.md
+++ b/site/docs/tutorial/cpp.md
@@ -172,7 +172,7 @@
 representation of the dependency graph (run the command at the workspace root):
 
 ```
-bazel query --nohost_deps --noimplicit_deps 'deps(//main:hello-world)' \
+bazel query --notool_deps --noimplicit_deps 'deps(//main:hello-world)' \
   --output graph
 ```
 
@@ -193,7 +193,7 @@
 straight to xdot:
 
 ```
-xdot <(bazel query --nohost_deps --noimplicit_deps 'deps(//main:hello-world)' \
+xdot <(bazel query --notool_deps --noimplicit_deps 'deps(//main:hello-world)' \
   --output graph)
 ```
 
diff --git a/site/docs/tutorial/java.md b/site/docs/tutorial/java.md
index c7355c6..7de0b9f 100644
--- a/site/docs/tutorial/java.md
+++ b/site/docs/tutorial/java.md
@@ -175,7 +175,7 @@
 representation of the dependency graph (run the command at the workspace root):
 
 ```
-bazel query  --nohost_deps --noimplicit_deps "deps(//:ProjectRunner)" --output graph
+bazel query  --notool_deps --noimplicit_deps "deps(//:ProjectRunner)" --output graph
 ```
 
 The above command tells Bazel to look for all dependencies for the target
diff --git a/site/docs/user-manual.html b/site/docs/user-manual.html
index 741ef6a..04d3bb6 100644
--- a/site/docs/user-manual.html
+++ b/site/docs/user-manual.html
@@ -2174,10 +2174,9 @@
   disabled if an incomplete result is not acceptable in case of errors.
 </p>
 <p>
-  The <code class='flag'>--[no]host_deps</code> option,
-  enabled by default, causes dependencies on "host
-  configuration" targets to be included in the dependency graph over
-  which the query operates.
+  The <code class='flag'>--[no]tool_deps</code> option,
+  enabled by default, causes dependencies in non-target configurations to be included in the
+  dependency graph over which the query operates.
 
 </p>
 <p>
diff --git a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
index 45916b0..783298b 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
@@ -323,7 +323,7 @@
    */
   protected Collection<T> getAllowedDeps(T target, Collection<T> deps) {
     // It's possible to query on a target that's configured in the host configuration. In those
-    // cases if --nohost_deps is turned on, we only allow reachable targets that are ALSO in the
+    // cases if --notool_deps is turned on, we only allow reachable targets that are ALSO in the
     // host config. This is somewhat counterintuitive and subject to change in the future but seems
     // like the best option right now.
     if (settings.contains(Setting.ONLY_TARGET_DEPS)) {
diff --git a/src/main/java/com/google/devtools/build/lib/query2/aquery/ActionGraphQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/aquery/ActionGraphQueryEnvironment.java
index b0f0e87..638c201 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/aquery/ActionGraphQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/aquery/ActionGraphQueryEnvironment.java
@@ -324,7 +324,7 @@
     if (configuredTargetValue != null) {
       return configuredTargetValue;
     }
-    // Try with host configuration (even when --nohost_deps is set in the case that top-level
+    // Try with host configuration (even when --notool_deps is set in the case that top-level
     // targets are configured in the host configuration so we are doing a host-configuration-only
     // query).
     configuredTargetValue = getHostConfiguredTarget(label);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/common/CommonQueryOptions.java b/src/main/java/com/google/devtools/build/lib/query2/common/CommonQueryOptions.java
index fa9e2d9..878461c 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/common/CommonQueryOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/common/CommonQueryOptions.java
@@ -50,7 +50,8 @@
   public List<String> universeScope;
 
   @Option(
-      name = "host_deps",
+      name = "tool_deps",
+      oldName = "host_deps",
       defaultValue = "true",
       documentationCategory = OptionDocumentationCategory.QUERY,
       effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
@@ -66,7 +67,7 @@
               + " configured targets also in the target configuration will be returned. If the"
               + " top-level target is in the host configuration, only host configured targets will"
               + " be returned.")
-  public boolean includeHostDeps;
+  public boolean includeToolDeps;
 
   @Option(
       name = "implicit_deps",
@@ -94,7 +95,7 @@
   /** Return the current options as a set of QueryEnvironment settings. */
   public Set<Setting> toSettings() {
     Set<Setting> settings = EnumSet.noneOf(Setting.class);
-    if (!includeHostDeps) {
+    if (!includeToolDeps) {
       settings.add(Setting.ONLY_TARGET_DEPS);
     }
     if (!includeImplicitDeps) {
diff --git a/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQueryEnvironment.java
index 7fba356..e6d82f7 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/cquery/ConfiguredTargetQueryEnvironment.java
@@ -260,7 +260,7 @@
     if (configuredTarget != null) {
       return configuredTarget;
     }
-    // Try with host configuration (even when --nohost_deps is set in the case that top-level
+    // Try with host configuration (even when --notool_deps is set in the case that top-level
     // targets are configured in the host configuration so we are doing a host-configuration-only
     // query).
     configuredTarget = getHostConfiguredTarget(label);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/output/FormatUtils.java b/src/main/java/com/google/devtools/build/lib/query2/query/output/FormatUtils.java
index 20ccc96..18ad662 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/query/output/FormatUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/query/output/FormatUtils.java
@@ -30,7 +30,7 @@
   private FormatUtils() {}
 
   static DependencyFilter getDependencyFilter(CommonQueryOptions queryOptions) {
-    if (queryOptions.includeHostDeps) {
+    if (queryOptions.includeToolDeps) {
       return queryOptions.includeImplicitDeps
           ? DependencyFilter.ALL_DEPS
           : DependencyFilter.NO_IMPLICIT_DEPS;