From e25c644f1e06b2ff11322e5791dd92dee6ebf9af Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 11 Oct 2019 13:50:28 +0100 Subject: Add system_modules to droidstubs This allows droidstubs to use the same system modules to create the stubs that will be used to compile them. It improves consistency and avoids droidstubs having to duplicate the libraries that make up the system modules on its libs property. Adds systemModules() to the sdkContext which allows consistent error checking behavior between droidstubs and java_library. Bug: 142534789 Test: m checkbuild Change-Id: Ib2006906d9528a900f16851f50b62152ffb51a1b --- java/sdk.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'java/sdk.go') diff --git a/java/sdk.go b/java/sdk.go index 3451774c0..c6a9a73c8 100644 --- a/java/sdk.go +++ b/java/sdk.go @@ -39,6 +39,8 @@ var apiFingerprintPathKey = android.NewOnceKey("apiFingerprintPathKey") type sdkContext interface { // sdkVersion returns the sdk_version property of the current module, or an empty string if it is not set. sdkVersion() string + // systemModules returns the system_modules property of the current module, or an empty string if it is not set. + systemModules() string // minSdkVersion returns the min_sdk_version property of the current module, or sdkVersion() if it is not set. minSdkVersion() string // targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set. @@ -185,8 +187,18 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { frameworkResModule: "framework-res", } case "none": + systemModules := sdkContext.systemModules() + if systemModules == "" { + ctx.PropertyErrorf("sdk_version", + `system_modules is required to be set to a non-empty value when sdk_version is "none", did you mean sdk_version: "core_platform"?`) + } else if systemModules == "none" { + // Normalize no system modules to an empty string. + systemModules = "" + } + return sdkDep{ noStandardLibs: true, + systemModules: systemModules, } case "core_platform": return sdkDep{ -- cgit v1.2.3-59-g8ed1b