sdk_version: "system_server_current"
The new sdk version "system_server_current" is for system server components that needs to use all public APIs, system APIs, module APIs, and the system server APIs. Bug: 146757305 Test: m Change-Id: I24fd5af010532a110393676607dc90889f2ec17e
This commit is contained in:
15
java/java.go
15
java/java.go
@@ -756,6 +756,7 @@ const (
|
|||||||
javaSdk
|
javaSdk
|
||||||
javaSystem
|
javaSystem
|
||||||
javaModule
|
javaModule
|
||||||
|
javaSystemServer
|
||||||
javaPlatform
|
javaPlatform
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -789,6 +790,10 @@ func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
|
|||||||
return javaModule, true
|
return javaModule, true
|
||||||
case ver.kind == sdkModule:
|
case ver.kind == sdkModule:
|
||||||
return javaModule, false
|
return javaModule, false
|
||||||
|
case name == "services-stubs":
|
||||||
|
return javaSystemServer, true
|
||||||
|
case ver.kind == sdkSystemServer:
|
||||||
|
return javaSystemServer, false
|
||||||
case ver.kind == sdkPrivate || ver.kind == sdkNone || ver.kind == sdkCorePlatform:
|
case ver.kind == sdkPrivate || ver.kind == sdkNone || ver.kind == sdkCorePlatform:
|
||||||
return javaPlatform, false
|
return javaPlatform, false
|
||||||
case !ver.valid():
|
case !ver.valid():
|
||||||
@@ -824,17 +829,23 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to linkTypeContext,
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case javaSystem:
|
case javaSystem:
|
||||||
if otherLinkType == javaPlatform || otherLinkType == javaModule {
|
if otherLinkType == javaPlatform || otherLinkType == javaModule || otherLinkType == javaSystemServer {
|
||||||
ctx.ModuleErrorf("compiles against system API, but dependency %q is compiling against private API."+commonMessage,
|
ctx.ModuleErrorf("compiles against system API, but dependency %q is compiling against private API."+commonMessage,
|
||||||
ctx.OtherModuleName(to))
|
ctx.OtherModuleName(to))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case javaModule:
|
case javaModule:
|
||||||
if otherLinkType == javaPlatform {
|
if otherLinkType == javaPlatform || otherLinkType == javaSystemServer {
|
||||||
ctx.ModuleErrorf("compiles against module API, but dependency %q is compiling against private API."+commonMessage,
|
ctx.ModuleErrorf("compiles against module API, but dependency %q is compiling against private API."+commonMessage,
|
||||||
ctx.OtherModuleName(to))
|
ctx.OtherModuleName(to))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case javaSystemServer:
|
||||||
|
if otherLinkType == javaPlatform {
|
||||||
|
ctx.ModuleErrorf("compiles against system server API, but dependency %q is compiling against private API."+commonMessage,
|
||||||
|
ctx.OtherModuleName(to))
|
||||||
|
}
|
||||||
|
break
|
||||||
case javaPlatform:
|
case javaPlatform:
|
||||||
// no restriction on link-type
|
// no restriction on link-type
|
||||||
break
|
break
|
||||||
|
26
java/sdk.go
26
java/sdk.go
@@ -72,6 +72,7 @@ const (
|
|||||||
sdkSystem
|
sdkSystem
|
||||||
sdkTest
|
sdkTest
|
||||||
sdkModule
|
sdkModule
|
||||||
|
sdkSystemServer
|
||||||
sdkPrivate
|
sdkPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -94,6 +95,8 @@ func (k sdkKind) String() string {
|
|||||||
return "core_platform"
|
return "core_platform"
|
||||||
case sdkModule:
|
case sdkModule:
|
||||||
return "module"
|
return "module"
|
||||||
|
case sdkSystemServer:
|
||||||
|
return "system_server"
|
||||||
default:
|
default:
|
||||||
return "invalid"
|
return "invalid"
|
||||||
}
|
}
|
||||||
@@ -261,6 +264,8 @@ func sdkSpecFrom(str string) sdkSpec {
|
|||||||
kind = sdkTest
|
kind = sdkTest
|
||||||
case "module":
|
case "module":
|
||||||
kind = sdkModule
|
kind = sdkModule
|
||||||
|
case "system_server":
|
||||||
|
kind = sdkSystemServer
|
||||||
default:
|
default:
|
||||||
return sdkSpec{sdkInvalid, sdkVersionNone, str}
|
return sdkSpec{sdkInvalid, sdkVersionNone, str}
|
||||||
}
|
}
|
||||||
@@ -324,13 +329,13 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toModule := func(m, r string, aidl android.Path) sdkDep {
|
toModule := func(modules []string, res string, aidl android.Path) sdkDep {
|
||||||
return sdkDep{
|
return sdkDep{
|
||||||
useModule: true,
|
useModule: true,
|
||||||
bootclasspath: []string{m, config.DefaultLambdaStubsLibrary},
|
bootclasspath: append(modules, config.DefaultLambdaStubsLibrary),
|
||||||
systemModules: "core-current-stubs-system-modules",
|
systemModules: "core-current-stubs-system-modules",
|
||||||
java9Classpath: []string{m},
|
java9Classpath: modules,
|
||||||
frameworkResModule: r,
|
frameworkResModule: res,
|
||||||
aidl: android.OptionalPathForPath(aidl),
|
aidl: android.OptionalPathForPath(aidl),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,16 +385,19 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
|||||||
noFrameworksLibs: true,
|
noFrameworksLibs: true,
|
||||||
}
|
}
|
||||||
case sdkPublic:
|
case sdkPublic:
|
||||||
return toModule("android_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
return toModule([]string{"android_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx))
|
||||||
case sdkSystem:
|
case sdkSystem:
|
||||||
return toModule("android_system_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
return toModule([]string{"android_system_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx))
|
||||||
case sdkTest:
|
case sdkTest:
|
||||||
return toModule("android_test_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
return toModule([]string{"android_test_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx))
|
||||||
case sdkCore:
|
case sdkCore:
|
||||||
return toModule("core.current.stubs", "", nil)
|
return toModule([]string{"core.current.stubs"}, "", nil)
|
||||||
case sdkModule:
|
case sdkModule:
|
||||||
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
|
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
|
||||||
return toModule("android_module_lib_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
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))
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("invalid sdk %q", sdkVersion.raw))
|
panic(fmt.Errorf("invalid sdk %q", sdkVersion.raw))
|
||||||
}
|
}
|
||||||
|
@@ -212,7 +212,6 @@ func TestClasspath(t *testing.T) {
|
|||||||
aidl: "-pprebuilts/sdk/29/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/29/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
name: "module_current",
|
name: "module_current",
|
||||||
properties: `sdk_version: "module_current",`,
|
properties: `sdk_version: "module_current",`,
|
||||||
bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"},
|
bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"},
|
||||||
@@ -220,6 +219,14 @@ func TestClasspath(t *testing.T) {
|
|||||||
java9classpath: []string{"android_module_lib_stubs_current"},
|
java9classpath: []string{"android_module_lib_stubs_current"},
|
||||||
aidl: "-p" + buildDir + "/framework.aidl",
|
aidl: "-p" + buildDir + "/framework.aidl",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "system_server_current",
|
||||||
|
properties: `sdk_version: "system_server_current",`,
|
||||||
|
bootclasspath: []string{"android_module_lib_stubs_current", "services-stubs", "core-lambda-stubs"},
|
||||||
|
system: "core-current-stubs-system-modules",
|
||||||
|
java9classpath: []string{"android_module_lib_stubs_current", "services-stubs"},
|
||||||
|
aidl: "-p" + buildDir + "/framework.aidl",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testcase := range classpathTestcases {
|
for _, testcase := range classpathTestcases {
|
||||||
|
@@ -147,6 +147,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
"android_system_stubs_current",
|
"android_system_stubs_current",
|
||||||
"android_test_stubs_current",
|
"android_test_stubs_current",
|
||||||
"android_module_lib_stubs_current",
|
"android_module_lib_stubs_current",
|
||||||
|
"services-stubs",
|
||||||
"core.current.stubs",
|
"core.current.stubs",
|
||||||
"core.platform.api.stubs",
|
"core.platform.api.stubs",
|
||||||
"kotlin-stdlib",
|
"kotlin-stdlib",
|
||||||
|
Reference in New Issue
Block a user