Fix duplicate deps issue related to stubs
It turns out that we accidentally add deps twice to the apex related
config axes if they exist simultaneously in the android and
no-config axes in the bp2build logic for stubs. This change ensures
that this does not happen.
Fixes: 245518215
Test: Unit tests
Test: bp2build with relevant module
Change-Id: Iab037d60a08a869f6ee00928090d2b544490590b
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 51d8e22..aea85ec 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -933,14 +933,14 @@
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
(&defaultSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
- la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, inApexSelectValue)
- la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, nonApexSelectValue)
- la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, defaultSelectValue)
+ la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
+ la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
+ la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, bazel.FirstUniqueBazelLabelList(defaultSelectValue))
} else if config == bazel.OsAndroid {
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
- la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, inApexSelectValue)
- la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, nonApexSelectValue)
+ la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
+ la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
}
}
}