diff options
| author | 2023-11-16 11:19:26 -0800 | |
|---|---|---|
| committer | 2023-11-17 19:06:50 -0800 | |
| commit | d442a0e882aa49edbb944e21eaca2fca20d61b98 (patch) | |
| tree | adb0fd7157487555afe5ed104b76b7baf523de03 /apex/builder.go | |
| parent | 09ad3a6505b6345cc793acc68280069b37f816c0 (diff) | |
Add DataPath.ToRelativeInstallPath
Add a method to DataPath that converts it to the relative install path
in preparation for adding additional complexity to DataPath.
Bug: 311428265
Test: builds
Change-Id: I65b06238aafda2db72c6a253744a3087976451cd
Diffstat (limited to 'apex/builder.go')
| -rw-r--r-- | apex/builder.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/apex/builder.go b/apex/builder.go index 909a4792a..9f9e486b7 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -563,13 +563,8 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { // Copy the test files (if any) for _, d := range fi.dataPaths { // TODO(eakammer): This is now the third repetition of ~this logic for test paths, refactoring should be possible - relPath := d.SrcPath.Rel() - dataPath := d.SrcPath.String() - if !strings.HasSuffix(dataPath, relPath) { - panic(fmt.Errorf("path %q does not end with %q", dataPath, relPath)) - } - - dataDest := imageDir.Join(ctx, fi.apexRelativePath(relPath), d.RelativeInstallPath).String() + relPath := d.ToRelativeInstallPath() + dataDest := imageDir.Join(ctx, fi.apexRelativePath(relPath)).String() copyCommands = append(copyCommands, "cp -f "+d.SrcPath.String()+" "+dataDest) implicitInputs = append(implicitInputs, d.SrcPath) @@ -1095,7 +1090,8 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Outp if f.installDir == "bin" || strings.HasPrefix(f.installDir, "bin/") { executablePaths = append(executablePaths, pathInApex) for _, d := range f.dataPaths { - readOnlyPaths = append(readOnlyPaths, filepath.Join(f.installDir, d.RelativeInstallPath, d.SrcPath.Rel())) + rel := d.ToRelativeInstallPath() + readOnlyPaths = append(readOnlyPaths, filepath.Join(f.installDir, rel)) } for _, s := range f.symlinks { executablePaths = append(executablePaths, filepath.Join(f.installDir, s)) |