diff options
author | Paul Duffin <paulduffin@google.com> | 2019-10-11 13:50:28 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2019-10-11 16:38:14 +0100 |
commit | e25c644f1e06b2ff11322e5791dd92dee6ebf9af (patch) | |
tree | 84dcf2a8fcae29bf8e3466269e06066391a740c3 /java/java.go | |
parent | 22762b98f35fe9c8d9d43f64a41a7e5de6fe0534 (diff) |
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
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/java/java.go b/java/java.go index 4264ba908..8c511eeee 100644 --- a/java/java.go +++ b/java/java.go @@ -270,7 +270,8 @@ type CompilerDeviceProperties struct { Proguard_flags_files []string `android:"path"` } - // When targeting 1.9, override the modules to use with --system + // When targeting 1.9 and above, override the modules to use with --system, + // otherwise provides defaults libraries to add to the bootclasspath. System_modules *string UncompressDex bool `blueprint:"mutated"` @@ -457,7 +458,10 @@ type checkVendorModuleContext interface { type sdkDep struct { useModule, useFiles, useDefaultLibs, invalidVersion bool - modules []string + modules []string + + // The default system modules to use. Will be an empty string if no system + // modules are to be used. systemModules string frameworkResModule string @@ -496,6 +500,10 @@ func (j *Module) sdkVersion() string { return proptools.StringDefault(j.deviceProperties.Sdk_version, defaultSdkVersion(j)) } +func (j *Module) systemModules() string { + return proptools.String(j.deviceProperties.System_modules) +} + func (j *Module) minSdkVersion() string { if j.deviceProperties.Min_sdk_version != nil { return *j.deviceProperties.Min_sdk_version @@ -528,13 +536,10 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultLibraries...) } } - } else if j.deviceProperties.System_modules == nil { - ctx.PropertyErrorf("sdk_version", - `system_modules is required to be set when sdk_version is "none", did you mean "core_platform"`) - } else if *j.deviceProperties.System_modules != "none" { + } else if sdkDep.systemModules != "" { // Add the system modules to both the system modules and bootclasspath. - ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules) - ctx.AddVariationDependencies(nil, bootClasspathTag, *j.deviceProperties.System_modules) + ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules) + ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.systemModules) } if ctx.ModuleName() == "android_stubs_current" || ctx.ModuleName() == "android_system_stubs_current" || |