summaryrefslogtreecommitdiff
path: root/python/python.go
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2018-11-06 17:30:35 +0800
committerLogan Chien <loganchien@google.com>2019-01-29 22:26:57 +0800
commit02880e41963fdc799c6b202da41d15be224a5602 (patch)
treed56c4159e4f6b7dfdd313e6e200b98ab0a9db55c /python/python.go
parent62f6fcbbb9528b58fd98e5fd5c71e484844be12f (diff)
Add missing dependencies for python_test
This commit adds missing shared lib dependencies for `python_test` modules with embedded launcher. Bug: 119086738 Test: CHECK_ELF_FIELS=true make check-elf-files Change-Id: I26f8e1eb9086930093f60c7daa54469850fab32d
Diffstat (limited to 'python/python.go')
-rw-r--r--python/python.go54
1 files changed, 40 insertions, 14 deletions
diff --git a/python/python.go b/python/python.go
index e8b47131b..ddc3f1f93 100644
--- a/python/python.go
+++ b/python/python.go
@@ -160,6 +160,7 @@ type bootstrapper interface {
type installer interface {
install(ctx android.ModuleContext, path android.Path)
+ setAndroidMkSharedLibs(sharedLibs []string)
}
type PythonDependency interface {
@@ -203,18 +204,19 @@ type dependencyTag struct {
}
var (
- pythonLibTag = dependencyTag{name: "pythonLib"}
- launcherTag = dependencyTag{name: "launcher"}
- pyIdentifierRegexp = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_-]*$`)
- pyExt = ".py"
- protoExt = ".proto"
- pyVersion2 = "PY2"
- pyVersion3 = "PY3"
- initFileName = "__init__.py"
- mainFileName = "__main__.py"
- entryPointFile = "entry_point.txt"
- parFileExt = ".zip"
- internal = "internal"
+ pythonLibTag = dependencyTag{name: "pythonLib"}
+ launcherTag = dependencyTag{name: "launcher"}
+ launcherSharedLibTag = dependencyTag{name: "launcherSharedLib"}
+ pyIdentifierRegexp = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_-]*$`)
+ pyExt = ".py"
+ protoExt = ".proto"
+ pyVersion2 = "PY2"
+ pyVersion3 = "PY3"
+ initFileName = "__init__.py"
+ mainFileName = "__main__.py"
+ entryPointFile = "entry_point.txt"
+ parFileExt = ".zip"
+ internal = "internal"
)
// create version variants for modules.
@@ -308,6 +310,20 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddFarVariationDependencies([]blueprint.Variation{
{Mutator: "arch", Variation: ctx.Target().String()},
}, launcherTag, "py2-launcher")
+
+ // Add py2-launcher shared lib dependencies. Ideally, these should be
+ // derived from the `shared_libs` property of "py2-launcher". However, we
+ // cannot read the property at this stage and it will be too late to add
+ // dependencies later.
+ ctx.AddFarVariationDependencies([]blueprint.Variation{
+ {Mutator: "arch", Variation: ctx.Target().String()},
+ }, launcherSharedLibTag, "libsqlite")
+
+ if ctx.Target().Os.Bionic() {
+ ctx.AddFarVariationDependencies([]blueprint.Variation{
+ {Mutator: "arch", Variation: ctx.Target().String()},
+ }, launcherSharedLibTag, "libc", "libdl", "libm")
+ }
}
case pyVersion3:
@@ -374,8 +390,18 @@ func (p *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
embeddedLauncher, p.srcsPathMappings, p.srcsZip, p.depsSrcsZips)
}
- if p.installer != nil && p.installSource.Valid() {
- p.installer.install(ctx, p.installSource.Path())
+ if p.installer != nil {
+ var sharedLibs []string
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ if ctx.OtherModuleDependencyTag(dep) == launcherSharedLibTag {
+ sharedLibs = append(sharedLibs, ctx.OtherModuleName(dep))
+ }
+ })
+ p.installer.setAndroidMkSharedLibs(sharedLibs)
+
+ if p.installSource.Valid() {
+ p.installer.install(ctx, p.installSource.Path())
+ }
}
}