Merge "Add support for using sdk_version: "module_<ver>""

This commit is contained in:
Paul Duffin 2020-10-01 10:36:23 +00:00 committed by Gerrit Code Review
commit 3a7e672abe
3 changed files with 16 additions and 1 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -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,