diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/androidmk.go | 1 | ||||
| -rw-r--r-- | java/java.go | 13 | ||||
| -rw-r--r-- | java/java_test.go | 24 | ||||
| -rw-r--r-- | java/sdk.go | 2 | ||||
| -rw-r--r-- | java/sdk_test.go | 4 | ||||
| -rw-r--r-- | java/testing.go | 4 |
6 files changed, 42 insertions, 6 deletions
diff --git a/java/androidmk.go b/java/androidmk.go index d76e29b21..a220cce70 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -542,6 +542,7 @@ func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries { func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{android.AndroidMkEntries{ Class: "JAVA_LIBRARIES", + DistFile: android.OptionalPathForPath(dstubs.apiFile), OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar), Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ diff --git a/java/java.go b/java/java.go index 22d14ecfe..0188cf1a2 100644 --- a/java/java.go +++ b/java/java.go @@ -800,7 +800,7 @@ func (m *Module) getLinkType(name string) (ret linkType, stubs bool) { return javaModule, true case ver.kind == sdkModule: return javaModule, false - case name == "services-stubs": + case name == "android_system_server_stubs_current": return javaSystemServer, true case ver.kind == sdkSystemServer: return javaSystemServer, false @@ -2338,6 +2338,12 @@ type ImportProperties struct { // set the name of the output Stem *string + + Aidl struct { + // directories that should be added as include directories for any aidl sources of modules + // that depend on this module, as well as to aidl for this module. + Export_include_dirs []string + } } type Import struct { @@ -2351,6 +2357,7 @@ type Import struct { combinedClasspathFile android.Path exportedSdkLibs []string + exportAidlIncludeDirs android.Paths } func (j *Import) sdkVersion() sdkSpec { @@ -2424,6 +2431,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), jarName, outputFile) } + + j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs) } var _ Dependency = (*Import)(nil) @@ -2458,7 +2467,7 @@ func (j *Import) DexJar() android.Path { } func (j *Import) AidlIncludeDirs() android.Paths { - return nil + return j.exportAidlIncludeDirs } func (j *Import) ExportedSdkLibs() []string { diff --git a/java/java_test.go b/java/java_test.go index 6d972bebd..e8a1a7c83 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1491,3 +1491,27 @@ func checkBootClasspathForSystemModule(t *testing.T, ctx *android.TestContext, m t.Errorf("bootclasspath of %q must start with --system and end with %q, but was %#v.", moduleName, expectedSuffix, bootClasspath) } } + +func TestAidlExportIncludeDirsFromImports(t *testing.T) { + ctx, _ := testJava(t, ` + java_library { + name: "foo", + srcs: ["aidl/foo/IFoo.aidl"], + libs: ["bar"], + } + + java_import { + name: "bar", + jars: ["a.jar"], + aidl: { + export_include_dirs: ["aidl/bar"], + }, + } + `) + + aidlCommand := ctx.ModuleForTests("foo", "android_common").Rule("aidl").RuleParams.Command + expectedAidlFlag := "-Iaidl/bar" + if !strings.Contains(aidlCommand, expectedAidlFlag) { + t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag) + } +} diff --git a/java/sdk.go b/java/sdk.go index ded2a061b..0e132d399 100644 --- a/java/sdk.go +++ b/java/sdk.go @@ -406,7 +406,7 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep return toModule([]string{"android_module_lib_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) case sdkSystemServer: // TODO(146757305): provide .apk and .aidl that have more APIs for modules - return toModule([]string{"android_module_lib_stubs_current", "services-stubs"}, "framework-res", sdkFrameworkAidlPath(ctx)) + return toModule([]string{"android_system_server_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) default: panic(fmt.Errorf("invalid sdk %q", sdkVersion.raw)) } diff --git a/java/sdk_test.go b/java/sdk_test.go index ea6733d86..088db9e70 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -222,9 +222,9 @@ func TestClasspath(t *testing.T) { { name: "system_server_current", properties: `sdk_version: "system_server_current",`, - bootclasspath: []string{"android_module_lib_stubs_current", "services-stubs", "core-lambda-stubs"}, + bootclasspath: []string{"android_system_server_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", - java9classpath: []string{"android_module_lib_stubs_current", "services-stubs"}, + java9classpath: []string{"android_system_server_stubs_current"}, aidl: "-p" + buildDir + "/framework.aidl", }, } diff --git a/java/testing.go b/java/testing.go index 5b6a39b2a..6929bb724 100644 --- a/java/testing.go +++ b/java/testing.go @@ -50,6 +50,8 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "api/test-current.txt": nil, "api/test-removed.txt": nil, "framework/aidl/a.aidl": nil, + "aidl/foo/IFoo.aidl": nil, + "aidl/bar/IBar.aidl": nil, "assets_a/a": nil, "assets_b/b": nil, @@ -148,7 +150,7 @@ func GatherRequiredDepsForTest() string { "android_system_stubs_current", "android_test_stubs_current", "android_module_lib_stubs_current", - "services-stubs", + "android_system_server_stubs_current", "core.current.stubs", "core.platform.api.stubs", "kotlin-stdlib", |