Add support for using sdk_version: "module_<ver>"
Fixes a panic when trying to build something with sdk_version: "module_30". Test: m nothing Change-Id: I9b2ce50957f59e2bead335ffa58888e15cda1f78
This commit is contained in:
parent
6c76f18aae
commit
fb6ae5bc73
3 changed files with 16 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue