diff --git a/java/java_test.go b/java/java_test.go index 9e6357792..f16639aa8 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1487,6 +1487,12 @@ func TestJavaSdkLibrary(t *testing.T) { libs: ["foo"], sdk_version: "system_29", } + java_library { + name: "baz-module-30", + srcs: ["c.java"], + libs: ["foo"], + sdk_version: "module_30", + } `) // check the existence of the internal modules @@ -1533,6 +1539,13 @@ func TestJavaSdkLibrary(t *testing.T) { "prebuilts/sdk/29/system/foo.jar") } + bazModule30Javac := ctx.ModuleForTests("baz-module-30", "android_common").Rule("javac") + // tests if "baz-module-30" is actually linked to the module 30 stubs lib + if !strings.Contains(bazModule30Javac.Args["classpath"], "prebuilts/sdk/30/module-lib/foo.jar") { + t.Errorf("baz-module-30 javac classpath %v does not contain %q", bazModule30Javac.Args["classpath"], + "prebuilts/sdk/30/module-lib/foo.jar") + } + // test if baz has exported SDK lib names foo and bar to qux qux := ctx.ModuleForTests("qux", "android_common") if quxLib, ok := qux.Module().(*Library); ok { diff --git a/java/sdk.go b/java/sdk.go index f59926502..971791f4a 100644 --- a/java/sdk.go +++ b/java/sdk.go @@ -222,7 +222,7 @@ func (s sdkSpec) usePrebuilt(ctx android.EarlyModuleContext) bool { return ctx.Config().AlwaysUsePrebuiltSdks() } else if s.version.isNumbered() { // validation check - if s.kind != sdkPublic && s.kind != sdkSystem && s.kind != sdkTest { + if s.kind != sdkPublic && s.kind != sdkSystem && s.kind != sdkTest && s.kind != sdkModule { panic(fmt.Errorf("prebuilt SDK is not not available for sdkKind=%q", s.kind)) return false } diff --git a/java/testing.go b/java/testing.go index a47241323..461fd3f9f 100644 --- a/java/testing.go +++ b/java/testing.go @@ -55,6 +55,8 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "prebuilts/sdk/30/public/framework.aidl": nil, "prebuilts/sdk/30/system/android.jar": nil, "prebuilts/sdk/30/system/foo.jar": nil, + "prebuilts/sdk/30/module-lib/android.jar": nil, + "prebuilts/sdk/30/module-lib/foo.jar": nil, "prebuilts/sdk/30/public/core-for-system-modules.jar": nil, "prebuilts/sdk/current/core/android.jar": nil, "prebuilts/sdk/current/public/android.jar": nil,