Remove timestamp based filelist file for tracking Python dependencies
Each Python module will generate a zip file containing source & data files. The Python binary will collect all its dependencies and use merge_zips to merge each zip file to create a final .par file. Test: m -j checkbuild && real examples: Bug: b/70568913 Change-Id: I9ff232d461d33e1c06026e7dcb5b124bf02c3ce5
This commit is contained in:
@@ -29,12 +29,11 @@ import (
|
||||
)
|
||||
|
||||
type pyModule struct {
|
||||
name string
|
||||
actualVersion string
|
||||
pyRunfiles []string
|
||||
depsPyRunfiles []string
|
||||
parSpec string
|
||||
depsParSpecs []string
|
||||
name string
|
||||
actualVersion string
|
||||
pyRunfiles []string
|
||||
srcsZip string
|
||||
depsSrcsZips []string
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -313,14 +312,10 @@ var (
|
||||
"runfiles/e/default_py3.py",
|
||||
"runfiles/e/file4.py",
|
||||
},
|
||||
depsPyRunfiles: []string{
|
||||
"runfiles/a/b/file1.py",
|
||||
"runfiles/c/d/file2.py",
|
||||
},
|
||||
parSpec: "-P runfiles/e -C dir/ -l @prefix@/.intermediates/dir/bin/PY3/dir_.list",
|
||||
depsParSpecs: []string{
|
||||
"-P runfiles/a/b -C dir/ -l @prefix@/.intermediates/dir/lib5/PY3/dir_.list",
|
||||
"-P runfiles/c/d -C dir/ -l @prefix@/.intermediates/dir/lib6/PY3/dir_.list",
|
||||
srcsZip: "@prefix@/.intermediates/dir/bin/PY3/bin.zip",
|
||||
depsSrcsZips: []string{
|
||||
"@prefix@/.intermediates/dir/lib5/PY3/lib5.zip",
|
||||
"@prefix@/.intermediates/dir/lib6/PY3/lib6.zip",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -356,8 +351,9 @@ func TestPythonModule(t *testing.T) {
|
||||
testErrs = append(testErrs,
|
||||
expectModule(t, ctx, buildDir, e.name,
|
||||
e.actualVersion,
|
||||
e.pyRunfiles, e.depsPyRunfiles,
|
||||
e.parSpec, e.depsParSpecs)...)
|
||||
e.srcsZip,
|
||||
e.pyRunfiles,
|
||||
e.depsSrcsZips)...)
|
||||
}
|
||||
}
|
||||
fail(t, testErrs)
|
||||
@@ -388,9 +384,8 @@ func expectErrors(t *testing.T, actErrs []error, expErrs []string) (testErrs []e
|
||||
return
|
||||
}
|
||||
|
||||
func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, variant string,
|
||||
expPyRunfiles, expDepsPyRunfiles []string,
|
||||
expParSpec string, expDepsParSpecs []string) (testErrs []error) {
|
||||
func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, variant, expectedSrcsZip string,
|
||||
expectedPyRunfiles, expectedDepsSrcsZips []string) (testErrs []error) {
|
||||
module := ctx.ModuleForTests(name, variant)
|
||||
|
||||
base, baseOk := module.Module().(*Module)
|
||||
@@ -398,47 +393,36 @@ func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, varian
|
||||
t.Fatalf("%s is not Python module!", name)
|
||||
}
|
||||
|
||||
actPyRunfiles := []string{}
|
||||
actualPyRunfiles := []string{}
|
||||
for _, path := range base.srcsPathMappings {
|
||||
actPyRunfiles = append(actPyRunfiles, path.dest)
|
||||
actualPyRunfiles = append(actualPyRunfiles, path.dest)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(actPyRunfiles, expPyRunfiles) {
|
||||
if !reflect.DeepEqual(actualPyRunfiles, expectedPyRunfiles) {
|
||||
testErrs = append(testErrs, errors.New(fmt.Sprintf(
|
||||
`binary "%s" variant "%s" has unexpected pyRunfiles: %q!`,
|
||||
base.Name(),
|
||||
base.properties.Actual_version,
|
||||
actPyRunfiles)))
|
||||
actualPyRunfiles)))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(base.depsPyRunfiles, expDepsPyRunfiles) {
|
||||
if base.srcsZip.String() != strings.Replace(expectedSrcsZip, "@prefix@", buildDir, 1) {
|
||||
testErrs = append(testErrs, errors.New(fmt.Sprintf(
|
||||
`binary "%s" variant "%s" has unexpected depsPyRunfiles: %q!`,
|
||||
`binary "%s" variant "%s" has unexpected srcsZip: %q!`,
|
||||
base.Name(),
|
||||
base.properties.Actual_version,
|
||||
base.depsPyRunfiles)))
|
||||
base.srcsZip)))
|
||||
}
|
||||
|
||||
if base.parSpec.soongParArgs() != strings.Replace(expParSpec, "@prefix@", buildDir, 1) {
|
||||
for i, _ := range expectedDepsSrcsZips {
|
||||
expectedDepsSrcsZips[i] = strings.Replace(expectedDepsSrcsZips[i], "@prefix@", buildDir, 1)
|
||||
}
|
||||
if !reflect.DeepEqual(base.depsSrcsZips.Strings(), expectedDepsSrcsZips) {
|
||||
testErrs = append(testErrs, errors.New(fmt.Sprintf(
|
||||
`binary "%s" variant "%s" has unexpected parSpec: %q!`,
|
||||
`binary "%s" variant "%s" has unexpected depsSrcsZips: %q!`,
|
||||
base.Name(),
|
||||
base.properties.Actual_version,
|
||||
base.parSpec.soongParArgs())))
|
||||
}
|
||||
|
||||
actDepsParSpecs := []string{}
|
||||
for i, p := range base.depsParSpecs {
|
||||
actDepsParSpecs = append(actDepsParSpecs, p.soongParArgs())
|
||||
expDepsParSpecs[i] = strings.Replace(expDepsParSpecs[i], "@prefix@", buildDir, 1)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(actDepsParSpecs, expDepsParSpecs) {
|
||||
testErrs = append(testErrs, errors.New(fmt.Sprintf(
|
||||
`binary "%s" variant "%s" has unexpected depsParSpecs: %q!`,
|
||||
base.Name(),
|
||||
base.properties.Actual_version,
|
||||
actDepsParSpecs)))
|
||||
base.depsSrcsZips)))
|
||||
}
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user