summaryrefslogtreecommitdiff
path: root/ci_tests
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2025-03-11 13:22:56 -0700
committer Cole Faust <colefaust@google.com> 2025-03-11 13:22:56 -0700
commitbb13d8e75438260d0e7e9bc51ac7ffdc2aa2f508 (patch)
tree3b0fc46c65f6ecf798bc249bf506d8ab31b3b864 /ci_tests
parent7ed094ef25e59df953b422f011eaac8bb1c1eba1 (diff)
Use built files instead of installed files as deps
When building test zips. Some other rules, like target_files.zip, are not hermetic, and pick up all files in the installation staging directories. This test_package module was causing more things to be placed into the staging directory and thus packaged into target_files.zip. Copy the built file instead of the installed file so that the staging directories are not affected. Bug: 388850000 Test: diff'd soong-built platform_tests.zip before/after this change, no differences Change-Id: I0e354cd62277aef7f4401d7e2b1d42267d257112
Diffstat (limited to 'ci_tests')
-rw-r--r--ci_tests/ci_test_package_zip.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go
index 451dac4cc..f8c4578b6 100644
--- a/ci_tests/ci_test_package_zip.go
+++ b/ci_tests/ci_test_package_zip.go
@@ -20,6 +20,7 @@ import (
"strings"
"android/soong/android"
+
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
@@ -214,7 +215,13 @@ func extendBuilderCommand(ctx android.ModuleContext, m android.Module, builder *
ctx.ModuleErrorf("Module %s doesn't set InstallFilesProvider", m.Name())
}
- for _, installedFile := range installedFilesInfo.InstallFiles {
+ for _, spec := range installedFilesInfo.PackagingSpecs {
+ if spec.SrcPath() == nil {
+ // Probably a symlink
+ continue
+ }
+ installedFile := spec.FullInstallPath()
+
ext := installedFile.Ext()
// there are additional installed files for some app-class modules, we only need the .apk, .odex and .vdex files in the test package
excludeInstalledFile := ext != ".apk" && ext != ".odex" && ext != ".vdex"
@@ -253,7 +260,9 @@ func extendBuilderCommand(ctx android.ModuleContext, m android.Module, builder *
tempOut := android.PathForModuleOut(ctx, "STAGING", f)
builder.Command().Text("mkdir").Flag("-p").Text(filepath.Join(stagingDir.String(), dir))
- builder.Command().Text("cp").Flag("-Rf").Input(installedFile).Output(tempOut)
+ // Copy srcPath instead of installedFile because some rules like target-files.zip
+ // are non-hermetic and would be affected if we built the installed files.
+ builder.Command().Text("cp").Flag("-Rf").Input(spec.SrcPath()).Output(tempOut)
builder.Temporary(tempOut)
}
}