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 Merged-In: I5b4e557068a1e5c71a80c76452030e72ec83a696
This commit is contained in:
13
java/java.go
13
java/java.go
@@ -1496,8 +1496,14 @@ type JavaApiLibraryProperties struct {
|
|||||||
Api_surface *string
|
Api_surface *string
|
||||||
|
|
||||||
// list of Java API contribution modules that consists this API surface
|
// list of Java API contribution modules that consists this API surface
|
||||||
|
// This is a list of Soong modules
|
||||||
Api_contributions []string
|
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
|
// List of flags to be passed to the javac compiler to generate jar file
|
||||||
Javacflags []string
|
Javacflags []string
|
||||||
}
|
}
|
||||||
@@ -1594,6 +1600,13 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
srcFiles = append(srcFiles, android.PathForSource(ctx, provider.ApiFile.String()))
|
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)
|
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir)
|
||||||
|
|
||||||
al.stubsFlags(ctx, cmd, stubsDir)
|
al.stubsFlags(ctx, cmd, stubsDir)
|
||||||
|
@@ -1691,6 +1691,7 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
|
|||||||
name: "bar2",
|
name: "bar2",
|
||||||
api_surface: "system",
|
api_surface: "system",
|
||||||
api_contributions: ["foo1", "foo2"],
|
api_contributions: ["foo1", "foo2"],
|
||||||
|
api_files: ["api1/current.txt", "api2/current.txt"]
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
map[string][]byte{
|
map[string][]byte{
|
||||||
@@ -1708,7 +1709,7 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
moduleName: "bar2",
|
moduleName: "bar2",
|
||||||
sourceTextFileDirs: []string{"a/foo1.txt", "b/foo2.txt"},
|
sourceTextFileDirs: []string{"a/foo1.txt", "b/foo2.txt", "api1/current.txt", "api2/current.txt"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, c := range testcases {
|
for _, c := range testcases {
|
||||||
|
Reference in New Issue
Block a user