summaryrefslogtreecommitdiff
path: root/cc/cc.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-02-03 12:17:42 -0800
committer Colin Cross <ccross@android.com> 2025-02-03 22:19:24 -0800
commitbd930bc6c4ff8539da60d6cda69f484a817a31ed (patch)
treecbdf1bd4fce5913ffd314187104869d8ac293ca2 /cc/cc.go
parentc5f4de515f5d1686ed5164dddc2f28134c9aeee4 (diff)
Add explicitlyImpl to shared library dependency tags
Instead of testing that explicit implementation libraries are not incorrectly used in an apex after the fact add the explicitlyImpl flag to dependency tags and use it in cc.DepIsInSameApex and rust.DepIsInSameApex to require that explicit implementation dependencies are in the same apex. Bug: 372543712 Test: go test ./... Change-Id: Ia968e06b578d5ab886a965c3981565d4895dddcd
Diffstat (limited to 'cc/cc.go')
-rw-r--r--cc/cc.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 027992868..ad6468d6c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -839,6 +839,7 @@ type libraryDependencyTag struct {
reexportFlags bool
explicitlyVersioned bool
+ explicitlyImpl bool
dataLib bool
ndk bool
@@ -934,6 +935,11 @@ var (
llndkHeaderLibTag = dependencyTag{name: "llndk_header_lib"}
)
+func IsExplicitImplSharedDepTag(depTag blueprint.DependencyTag) bool {
+ ccLibDepTag, ok := depTag.(libraryDependencyTag)
+ return ok && ccLibDepTag.shared() && ccLibDepTag.explicitlyImpl
+}
+
func IsSharedDepTag(depTag blueprint.DependencyTag) bool {
ccLibDepTag, ok := depTag.(libraryDependencyTag)
return ok && ccLibDepTag.shared()
@@ -2699,6 +2705,9 @@ func AddSharedLibDependenciesWithVersions(ctx android.BottomUpMutatorContext, mo
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
if tag, ok := depTag.(libraryDependencyTag); ok {
tag.explicitlyVersioned = true
+ if version == "" {
+ tag.explicitlyImpl = true
+ }
// depTag is an interface that contains a concrete non-pointer struct. That makes the local
// tag variable a copy of the contents of depTag, and updating it doesn't change depTag. Reassign
// the modified copy to depTag.
@@ -4074,7 +4083,7 @@ func (c *Module) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
func (c *Module) IncomingDepIsInSameApex(depTag blueprint.DependencyTag) bool {
if c.HasStubsVariants() {
- if IsSharedDepTag(depTag) {
+ if IsSharedDepTag(depTag) && !IsExplicitImplSharedDepTag(depTag) {
// dynamic dep to a stubs lib crosses APEX boundary
return false
}