diff options
author | 2025-02-04 21:18:36 +0000 | |
---|---|---|
committer | 2025-02-04 21:21:09 +0000 | |
commit | d718aa50572113b2b07a0e33a97eaa032a1be387 (patch) | |
tree | b0003c510d42ed3c06a26379abbdc64b8cddfb1c | |
parent | 7613bd1929057a0da89f4c85ca6506ea98869286 (diff) |
Install intermediate file in testcases
ctx.InstallFile adds the source file to checkBuildFiles. This causes
issues if the module is an unexported namespace, since the installation
files will not be created.
Additional context: https://android-review.git.corp.google.com/c/platform/build/soong/+/3474792/comment/40af1b92_5e65d152/
Test: m nothing --soong-only
Test: go test ./java
Change-Id: I83ac66c6a81c8163a24acd4e9ef8aab0982e5e4c
-rw-r--r-- | android/module_context.go | 3 | ||||
-rw-r--r-- | java/java.go | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/android/module_context.go b/android/module_context.go index a3dad93f5..d3c537097 100644 --- a/android/module_context.go +++ b/android/module_context.go @@ -639,6 +639,9 @@ func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, e func (m *moduleContext) installFile(installPath InstallPath, name string, srcPath Path, deps []InstallPath, executable bool, hooks bool, checkbuild bool, extraZip *extraFilesZip) InstallPath { + if _, ok := srcPath.(InstallPath); ok { + m.ModuleErrorf("Src path cannot be another installed file. Please use a path from source or intermediates instead.") + } fullInstallPath := installPath.Join(m, name) if hooks { diff --git a/java/java.go b/java/java.go index 67b9ba966..e93f6703b 100644 --- a/java/java.go +++ b/java/java.go @@ -1883,8 +1883,8 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, dataPath := android.DataPath{SrcPath: data} ctx.InstallTestData(pathInTestCases, []android.DataPath{dataPath}) } - if j.installFile != nil { - ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".jar", j.installFile) + if j.outputFile != nil { + ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".jar", j.outputFile) } } } |