Add libraryDependencyTag to track dependencies on static and shared libraries
dependencyTag uses a set of predefined tags to identify different types
of dependencies. There are already multiple bits of metadata stored
in the dependency tag (Library, Shared, ReexportFlags), and supporting
them all requires a combinatorial explosion of predefined tags and
causes issues when using equality comparisons if a new bit of metadata
is added.
Add a new libraryDependencyTag type that will contain the metadata
bits, and replace the quality comparisons with checks on the metadata
bits.
There are 5 TODOs where modifying the checks identified problems with
the existing checks. These were left in place to produce identical
build output and will be fixed separately.
Bug: 162437057
Test: no change to build.ninja or {Android,make_vars,late}-${TARGET_PRODUCT}.mk
Change-Id: I72d4207dcf381c07c92e00e5a03968ebb5ed8d30
diff --git a/rust/rust.go b/rust/rust.go
index 78bf7ad..960f66a 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -849,8 +849,8 @@
}
exportDep := false
- switch depTag {
- case cc.StaticDepTag:
+ switch {
+ case cc.IsStaticDepTag(depTag):
depFlag = "-lstatic=" + libName
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.depFlags = append(depPaths.depFlags, depFlag)
@@ -862,7 +862,7 @@
depPaths.coverageFiles = append(depPaths.coverageFiles, ccDep.CoverageFiles()...)
directStaticLibDeps = append(directStaticLibDeps, ccDep)
mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, depName)
- case cc.SharedDepTag:
+ case cc.IsSharedDepTag(depTag):
depFlag = "-ldylib=" + libName
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.depFlags = append(depPaths.depFlags, depFlag)
@@ -874,9 +874,9 @@
directSharedLibDeps = append(directSharedLibDeps, ccDep)
mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, depName)
exportDep = true
- case cc.CrtBeginDepTag:
+ case depTag == cc.CrtBeginDepTag:
depPaths.CrtBegin = linkFile
- case cc.CrtEndDepTag:
+ case depTag == cc.CrtEndDepTag:
depPaths.CrtEnd = linkFile
}
@@ -994,10 +994,10 @@
actx.AddVariationDependencies(append(commonDepVariations,
blueprint.Variation{Mutator: "link", Variation: "shared"}),
- cc.SharedDepTag, deps.SharedLibs...)
+ cc.SharedDepTag(), deps.SharedLibs...)
actx.AddVariationDependencies(append(commonDepVariations,
blueprint.Variation{Mutator: "link", Variation: "static"}),
- cc.StaticDepTag, deps.StaticLibs...)
+ cc.StaticDepTag(), deps.StaticLibs...)
if deps.CrtBegin != "" {
actx.AddVariationDependencies(commonDepVariations, cc.CrtBeginDepTag, deps.CrtBegin)