Merge "Update java_api_library in testing modules"

This commit is contained in:
Jihoon Kang
2023-04-05 23:27:50 +00:00
committed by Gerrit Code Review
2 changed files with 26 additions and 11 deletions

View File

@@ -1612,7 +1612,7 @@ func (ap *JavaApiContribution) GenerateAndroidBuildActions(ctx android.ModuleCon
} }
type JavaApiLibraryDepsInfo struct { type JavaApiLibraryDepsInfo struct {
StubsJar android.Path JavaInfo
StubsSrcJar android.Path StubsSrcJar android.Path
} }
@@ -1821,7 +1821,7 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
staticLibs = append(staticLibs, provider.HeaderJars...) staticLibs = append(staticLibs, provider.HeaderJars...)
case depApiSrcsTag: case depApiSrcsTag:
provider := ctx.OtherModuleProvider(dep, JavaApiLibraryDepsProvider).(JavaApiLibraryDepsInfo) provider := ctx.OtherModuleProvider(dep, JavaApiLibraryDepsProvider).(JavaApiLibraryDepsInfo)
classPaths = append(classPaths, provider.StubsJar) classPaths = append(classPaths, provider.HeaderJars...)
depApiSrcsStubsSrcJar = provider.StubsSrcJar depApiSrcsStubsSrcJar = provider.StubsSrcJar
} }
}) })
@@ -1900,7 +1900,9 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}) })
ctx.SetProvider(JavaApiLibraryDepsProvider, JavaApiLibraryDepsInfo{ ctx.SetProvider(JavaApiLibraryDepsProvider, JavaApiLibraryDepsInfo{
StubsJar: al.stubsJar, JavaInfo: JavaInfo{
HeaderJars: android.PathsIfNonNil(al.stubsJar),
},
StubsSrcJar: al.stubsSrcJar, StubsSrcJar: al.stubsSrcJar,
}) })
} }

View File

@@ -368,14 +368,6 @@ func gatherRequiredDepsForTest() string {
"core.current.stubs", "core.current.stubs",
"legacy.core.platform.api.stubs", "legacy.core.platform.api.stubs",
"stable.core.platform.api.stubs", "stable.core.platform.api.stubs",
"android_stubs_current.from-text",
"android_system_stubs_current.from-text",
"android_test_stubs_current.from-text",
"android_module_lib_stubs_current.from-text",
"android_system_server_stubs_current.from-text",
"core.current.stubs.from-text",
"legacy.core.platform.api.stubs.from-text",
"stable.core.platform.api.stubs.from-text",
"kotlin-stdlib", "kotlin-stdlib",
"kotlin-stdlib-jdk7", "kotlin-stdlib-jdk7",
@@ -396,6 +388,27 @@ func gatherRequiredDepsForTest() string {
`, extra) `, extra)
} }
extraApiLibraryModules := map[string]string{
"android_stubs_current.from-text": "api/current.txt",
"android_system_stubs_current.from-text": "api/system-current.txt",
"android_test_stubs_current.from-text": "api/test-current.txt",
"android_module_lib_stubs_current.from-text": "api/module-lib-current.txt",
"android_system_server_stubs_current.from-text": "api/system-server-current.txt",
"core.current.stubs.from-text": "api/current.txt",
"legacy.core.platform.api.stubs.from-text": "api/current.txt",
"stable.core.platform.api.stubs.from-text": "api/current.txt",
"core-lambda-stubs.from-text": "api/current.txt",
}
for libName, apiFile := range extraApiLibraryModules {
bp += fmt.Sprintf(`
java_api_library {
name: "%s",
api_files: ["%s"],
}
`, libName, apiFile)
}
bp += ` bp += `
java_library { java_library {
name: "framework", name: "framework",