Fix embedded_launcher can't find files

The problem came from Python libraries doesn't know the information that
we enabled embedded_launcher (only Python binary knows about that). And
we can't simply remove runfiles dir for Python libraries since host
Python mode need this.

Bug: b/80441699
Test: m perf_profo_flames
Change-Id: I73ffc4d7504f95a708ae7cca47bc6c15a673aa31
This commit is contained in:
Nan Zhang
2018-05-31 12:49:33 -07:00
parent 1d2318d6cd
commit bea0975f18
4 changed files with 15 additions and 33 deletions

View File

@@ -63,8 +63,7 @@ type BaseProperties struct {
// files of the current module.
// eg. Pkg_path = "a/b/c"; Other packages can reference this module by using
// (from a.b.c import ...) statement.
// if left unspecified, all the source/data files of current module are copied to
// "runfiles/" tree directory directly.
// if left unspecified, all the source/data files path is unchanged within zip file.
Pkg_path *string `android:"arch_variant"`
// true, if the Python module is used internally, eg, Python std libs.
@@ -215,7 +214,6 @@ var (
mainFileName = "__main__.py"
entryPointFile = "entry_point.txt"
parFileExt = ".zip"
runFiles = "runfiles"
internal = "internal"
)
@@ -417,23 +415,11 @@ func (p *Module) GeneratePythonBuildActions(ctx android.ModuleContext) {
return
}
if p.properties.Is_internal != nil && *p.properties.Is_internal {
// pkg_path starts from "internal/" implicitly.
pkgPath = filepath.Join(internal, pkgPath)
} else {
if !p.isEmbeddedLauncherEnabled(p.properties.Actual_version) {
// pkg_path starts from "runfiles/" implicitly.
pkgPath = filepath.Join(runFiles, pkgPath)
}
}
} else {
if p.properties.Is_internal != nil && *p.properties.Is_internal {
// pkg_path starts from "runfiles/" implicitly.
pkgPath = internal
} else {
if !p.isEmbeddedLauncherEnabled(p.properties.Actual_version) {
// pkg_path starts from "runfiles/" implicitly.
pkgPath = runFiles
}
}
}
@@ -620,7 +606,7 @@ func (p *Module) walkTransitiveDeps(ctx android.ModuleContext) {
func fillInMap(ctx android.ModuleContext, m map[string]string,
key, value, curModule, otherModule string) bool {
if oldValue, found := m[key]; found {
ctx.ModuleErrorf("found two files to be placed at the same runfiles location %q."+
ctx.ModuleErrorf("found two files to be placed at the same location within zip %q."+
" First file: in module %s at path %q."+
" Second file: in module %s at path %q.",
key, curModule, oldValue, otherModule, value)