Introduce explicit iterate_over field for flag_group in Crosstool

Now flag_group can be marked with iterate_over field, that denotes for which
sequence variable the flag_group will be expanded repeatedly. This cl does that
in backwards compatible way as before, the iteration happened implicitly when the
used variable was found to be sequence at runtime. Because of that it adds some
extra code that will be removed once all the crosstools are migrated to the
explicit iteration.

RELNOTES: NONE
PiperOrigin-RevId: 138501033
diff --git a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
index 9e9e153..3d7f891 100644
--- a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
+++ b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
@@ -51,13 +51,14 @@
 
   // A group of correlated flags. Supports parametrization via variable
   // expansion.
-  // If a variable of list type is expanded, all flags in the flag group
-  // will be expanded for each element of the list.
-  // Only a single variable of list type may be referenced in a single flag
-  // group; the same variable may be referenced multiple times.
+  //
+  // To expand a variable of list type, flag_group has to be annotated with
+  // `iterate_over` message. Then all nested flags or flag_groups will be
+  // expanded repeatedly for each element of the list.
   //
   // For example:
   // flag_group {
+  //   iterate_over: 'include_path'
   //   flag: '-I'
   //   flag: '%{include_path}'
   // }
@@ -66,13 +67,16 @@
   //
   // Flag groups can be nested; if they are, the flag group must only contain
   // other flag groups (no flags) so the order is unambiguously specified.
-  // Nested flag groups require build variables of nested list types, and
-  // will be expanded recursively.
+  // In order to expand a variable of nested lists, 'iterate_over' can be used.
   //
   // For example:
   // flag_group {
+  //   iterate_over: 'object_files'
   //   flag_group { flag: '--start-lib' }
-  //   flag_group { flag: '%{object_files}' }
+  //   flag_group {
+  //     iterate_over: 'object_files'
+  //     flag: '%{object_files}'
+  //   }
   //   flag_group { flag: '--end-lib' }
   // }
   // ... will get expanded to
@@ -85,6 +89,8 @@
     repeated string flag = 1;
 
     repeated FlagGroup flag_group = 2;
+
+    optional string iterate_over = 3;
   }
 
   // A key/value pair to be added as an environment variable. The value of