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
diff --git a/android/module_context.go b/android/module_context.go
index a3dad93..d3c5370 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -639,6 +639,9 @@
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 67b9ba9..e93f670 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1883,8 +1883,8 @@
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)
}
}
}