Merge "Add system_modules to droidstubs"
This commit is contained in:
commit
baf127ce2a
4 changed files with 48 additions and 9 deletions
|
@ -520,6 +520,10 @@ func (a *AARImport) sdkVersion() string {
|
|||
return proptools.StringDefault(a.properties.Sdk_version, defaultSdkVersion(a))
|
||||
}
|
||||
|
||||
func (a *AARImport) systemModules() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (a *AARImport) minSdkVersion() string {
|
||||
if a.properties.Min_sdk_version != nil {
|
||||
return *a.properties.Min_sdk_version
|
||||
|
|
|
@ -67,9 +67,15 @@ type JavadocProperties struct {
|
|||
// If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true.
|
||||
Installable *bool
|
||||
|
||||
// if not blank, set to the version of the sdk to compile against
|
||||
// if not blank, set to the version of the sdk to compile against.
|
||||
// Defaults to compiling against the current platform.
|
||||
Sdk_version *string `android:"arch_variant"`
|
||||
|
||||
// When targeting 1.9 and above, override the modules to use with --system,
|
||||
// otherwise provides defaults libraries to add to the bootclasspath.
|
||||
// Defaults to "none"
|
||||
System_modules *string
|
||||
|
||||
Aidl struct {
|
||||
// Top level directories to pass to aidl tool
|
||||
Include_dirs []string
|
||||
|
@ -401,6 +407,10 @@ func (j *Javadoc) sdkVersion() string {
|
|||
return proptools.StringDefault(j.properties.Sdk_version, defaultSdkVersion(j))
|
||||
}
|
||||
|
||||
func (j *Javadoc) systemModules() string {
|
||||
return proptools.String(j.properties.System_modules)
|
||||
}
|
||||
|
||||
func (j *Javadoc) minSdkVersion() string {
|
||||
return j.sdkVersion()
|
||||
}
|
||||
|
@ -427,6 +437,10 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
|
|||
}
|
||||
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.modules...)
|
||||
}
|
||||
} else if sdkDep.systemModules != "" {
|
||||
// Add the system modules to both the system modules and bootclasspath.
|
||||
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
|
||||
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.systemModules)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,6 +528,10 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
|||
case bootClasspathTag:
|
||||
if dep, ok := module.(Dependency); ok {
|
||||
deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars()...)
|
||||
} else if sm, ok := module.(*SystemModules); ok {
|
||||
// A system modules dependency has been added to the bootclasspath
|
||||
// so add its libs to the bootclasspath.
|
||||
deps.bootClasspath = append(deps.bootClasspath, sm.headerJars...)
|
||||
} else {
|
||||
panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
|
||||
}
|
||||
|
|
21
java/java.go
21
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" ||
|
||||
|
|
12
java/sdk.go
12
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{
|
||||
|
|
Loading…
Reference in a new issue