From 8ac2c18ba18f0c9eeecc3e522ac4ea3a174c14c2 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Mon, 13 May 2024 18:09:45 -0600 Subject: [PATCH] For product_memberships, use the desc JSON filtered by the list of actual products from the dump JSON. --- swiftpkg/internal/pkginfos.bzl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/swiftpkg/internal/pkginfos.bzl b/swiftpkg/internal/pkginfos.bzl index 57acc3003..a523adfdf 100644 --- a/swiftpkg/internal/pkginfos.bzl +++ b/swiftpkg/internal/pkginfos.bzl @@ -577,15 +577,21 @@ def _new_from_parsed_json( targets = [] for target_map in dump_manifest["targets"]: tname = target_map["name"] + tdesc_map = desc_targets_by_name[tname] + + # Use the product_memberships from the desc_map, but only include + # product names that actually exist in the dump products list. The + # product_memberships from the desc JSON includes product inclusion that + # we cannot determine using the conservative dump JSON. product_memberships = [ - product.name - for product in products - if lists.contains(product.targets, tname) + prod_name + for prod_name in tdesc_map.get("product_memberships", []) + if lists.contains(products, lambda p: p.name == prod_name) ] target = _new_target_from_json_maps( repository_ctx = repository_ctx, dump_map = target_map, - desc_map = desc_targets_by_name[tname], + desc_map = tdesc_map, product_memberships = product_memberships, pkg_path = pkg_path, collect_src_info = collect_src_info,