aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2022-12-01 21:43:06 +0000
committerSpandan Das <spandandas@google.com>2022-12-05 22:27:06 +0000
commitc082eb8eac3ce1ab54f728bc0f2584c88a93d4c9 (patch)
tree544c0ee8ca088f46a1adfd2771e2f2d966c90b03 /java/java.go
parent6830f6be7e37086b38435c5bfa3b052b433bc6e2 (diff)
Add an api_files property in java_api_library
java_api_contribution is useful to java_api_library when the api files are not colocated. If they are colocated (e.g. in Multi-tree assembled api_surfaces directory), it is useful to refer to them directly without nedding to create a java_api_contribution module. Test: In build/soong, go test ./java Change-Id: I5b4e557068a1e5c71a80c76452030e72ec83a696
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go
index e37a77e46..9dd585062 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1567,8 +1567,14 @@ type JavaApiLibraryProperties struct {
Api_surface *string
// list of Java API contribution modules that consists this API surface
+ // This is a list of Soong modules
Api_contributions []string
+ // list of api.txt files relative to this directory that contribute to the
+ // API surface.
+ // This is a list of relative paths
+ Api_files []string
+
// List of flags to be passed to the javac compiler to generate jar file
Javacflags []string
}
@@ -1665,6 +1671,13 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
srcFiles = append(srcFiles, android.PathForSource(ctx, provider.ApiFile.String()))
})
+ // Add the api_files inputs
+ for _, api := range al.properties.Api_files {
+ // Use MaybeExistentPathForSource since the api file might not exist during analysis.
+ // This will be provided by the orchestrator in the combined execution.
+ srcFiles = append(srcFiles, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), api))
+ }
+
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir)
al.stubsFlags(ctx, cmd, stubsDir)