@@ -451,6 +451,7 @@ def _generate_hub_and_spokes(
451451 workspace_fq_deps = _compute_workspace_fq_deps (workspace_members , versions_by_name )
452452
453453 workspace_dep_versions_by_name = {}
454+ workspace_dep_labels_by_triple = {triple : set () for triple in platform_triples }
454455
455456 # Only files in the current Bazel workspace can/should be watched, so check where our manifests are located.
456457 watch_manifests = cargo_lock_path .repo_name == ""
@@ -515,6 +516,7 @@ def _generate_hub_and_spokes(
515516 cfg_match_cache [target ] = match
516517
517518 for triple in match :
519+ workspace_dep_labels_by_triple [triple ].add (":" + dep_name )
518520 feature_resolutions .features_enabled [triple ].update (features )
519521
520522 # Set initial set of features from annotations
@@ -708,6 +710,11 @@ alias(
708710 actual = ":{fq}__{binary}",
709711)""" .format (name = name , fq = fq , binary = binary ))
710712
713+ workspace_deps , conditional_workspace_deps = render_select (
714+ [],
715+ workspace_dep_labels_by_triple ,
716+ )
717+
711718 hub_contents .append (
712719 """
713720package(
@@ -717,9 +724,12 @@ package(
717724filegroup(
718725 name = "_workspace_deps",
719726 srcs = [
720- %s
721- ],
722- )""" % ",\n " .join (['":%s"' % dep for dep in sorted (workspace_dep_versions_by_name .keys ())]),
727+ %s
728+ ]%s,
729+ )""" % (
730+ ",\n " .join (['"%s"' % dep for dep in sorted (workspace_deps )]),
731+ " + " + conditional_workspace_deps if conditional_workspace_deps else "" ,
732+ ),
723733 )
724734
725735 defs_bzl_contents = \
0 commit comments