Split java device properties into separate struct
Prevent host modules from having fields that only make sense for device modules. Test: builds Change-Id: I20278e029a38fb9a6b75ef3c2cf3c1a97cef2b87
This commit is contained in:
10
java/app.go
10
java/app.go
@@ -70,7 +70,7 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
var deps []string
|
var deps []string
|
||||||
if !a.properties.No_standard_libraries {
|
if !a.properties.No_standard_libraries {
|
||||||
switch a.properties.Sdk_version { // TODO: Res_sdk_version?
|
switch a.deviceProperties.Sdk_version { // TODO: Res_sdk_version?
|
||||||
case "current", "system_current", "":
|
case "current", "system_current", "":
|
||||||
deps = append(deps, "framework-res")
|
deps = append(deps, "framework-res")
|
||||||
default:
|
default:
|
||||||
@@ -248,7 +248,7 @@ func (a *AndroidApp) aaptFlags(ctx android.ModuleContext) ([]string, android.Pat
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
sdkVersion := a.properties.Sdk_version
|
sdkVersion := a.deviceProperties.Sdk_version
|
||||||
if sdkVersion == "" {
|
if sdkVersion == "" {
|
||||||
sdkVersion = ctx.AConfig().PlatformSdkVersion()
|
sdkVersion = ctx.AConfig().PlatformSdkVersion()
|
||||||
}
|
}
|
||||||
@@ -277,8 +277,10 @@ func (a *AndroidApp) aaptFlags(ctx android.ModuleContext) ([]string, android.Pat
|
|||||||
func AndroidAppFactory() (blueprint.Module, []interface{}) {
|
func AndroidAppFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &AndroidApp{}
|
module := &AndroidApp{}
|
||||||
|
|
||||||
module.properties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon,
|
return android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon,
|
||||||
&module.Module.properties, &module.appProperties)
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties,
|
||||||
|
&module.appProperties)
|
||||||
}
|
}
|
||||||
|
65
java/java.go
65
java/java.go
@@ -76,9 +76,6 @@ type compilerProperties struct {
|
|||||||
// list of module-specific flags that will be used for javac compiles
|
// list of module-specific flags that will be used for javac compiles
|
||||||
Javacflags []string `android:"arch_variant"`
|
Javacflags []string `android:"arch_variant"`
|
||||||
|
|
||||||
// list of module-specific flags that will be used for dex compiles
|
|
||||||
Dxflags []string `android:"arch_variant"`
|
|
||||||
|
|
||||||
// list of of java libraries that will be in the classpath
|
// list of of java libraries that will be in the classpath
|
||||||
Java_libs []string `android:"arch_variant"`
|
Java_libs []string `android:"arch_variant"`
|
||||||
|
|
||||||
@@ -88,6 +85,14 @@ type compilerProperties struct {
|
|||||||
// manifest file to be included in resulting jar
|
// manifest file to be included in resulting jar
|
||||||
Manifest *string
|
Manifest *string
|
||||||
|
|
||||||
|
// if not blank, run jarjar using the specified rules file
|
||||||
|
Jarjar_rules *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type compilerDeviceProperties struct {
|
||||||
|
// list of module-specific flags that will be used for dex compiles
|
||||||
|
Dxflags []string `android:"arch_variant"`
|
||||||
|
|
||||||
// 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
|
||||||
Sdk_version string
|
Sdk_version string
|
||||||
|
|
||||||
@@ -95,9 +100,6 @@ type compilerProperties struct {
|
|||||||
// built for testing
|
// built for testing
|
||||||
Dex bool `blueprint:"mutated"`
|
Dex bool `blueprint:"mutated"`
|
||||||
|
|
||||||
// if not blank, run jarjar using the specified rules file
|
|
||||||
Jarjar_rules *string
|
|
||||||
|
|
||||||
// directories to pass to aidl tool
|
// directories to pass to aidl tool
|
||||||
Aidl_includes []string
|
Aidl_includes []string
|
||||||
|
|
||||||
@@ -110,7 +112,8 @@ type compilerProperties struct {
|
|||||||
type Module struct {
|
type Module struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
|
|
||||||
properties compilerProperties
|
properties compilerProperties
|
||||||
|
deviceProperties compilerDeviceProperties
|
||||||
|
|
||||||
// output file suitable for inserting into the classpath of another compile
|
// output file suitable for inserting into the classpath of another compile
|
||||||
classpathFile android.Path
|
classpathFile android.Path
|
||||||
@@ -145,19 +148,20 @@ type JavaDependency interface {
|
|||||||
|
|
||||||
func (j *Module) BootClasspath(ctx android.BaseContext) string {
|
func (j *Module) BootClasspath(ctx android.BaseContext) string {
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
if j.properties.Sdk_version == "" {
|
switch j.deviceProperties.Sdk_version {
|
||||||
|
case "":
|
||||||
return "core-libart"
|
return "core-libart"
|
||||||
} else if j.properties.Sdk_version == "current" {
|
case "current":
|
||||||
// TODO: !TARGET_BUILD_APPS
|
// TODO: !TARGET_BUILD_APPS
|
||||||
// TODO: export preprocessed framework.aidl from android_stubs_current
|
// TODO: export preprocessed framework.aidl from android_stubs_current
|
||||||
return "android_stubs_current"
|
return "android_stubs_current"
|
||||||
} else if j.properties.Sdk_version == "system_current" {
|
case "system_current":
|
||||||
return "android_system_stubs_current"
|
return "android_system_stubs_current"
|
||||||
} else {
|
default:
|
||||||
return "sdk_v" + j.properties.Sdk_version
|
return "sdk_v" + j.deviceProperties.Sdk_version
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if j.properties.Dex {
|
if j.deviceProperties.Dex {
|
||||||
return "core-libart"
|
return "core-libart"
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
@@ -175,7 +179,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
|||||||
if bootClasspath != "" {
|
if bootClasspath != "" {
|
||||||
deps = append(deps, bootClasspath)
|
deps = append(deps, bootClasspath)
|
||||||
}
|
}
|
||||||
if ctx.Device() && j.properties.Sdk_version == "" {
|
if ctx.Device() && j.deviceProperties.Sdk_version == "" {
|
||||||
deps = append(deps, defaultJavaLibraries...)
|
deps = append(deps, defaultJavaLibraries...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,7 +192,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
|||||||
func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
|
func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
|
||||||
aidlIncludeDirs android.Paths) []string {
|
aidlIncludeDirs android.Paths) []string {
|
||||||
|
|
||||||
localAidlIncludes := android.PathsForModuleSrc(ctx, j.properties.Aidl_includes)
|
localAidlIncludes := android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl_includes)
|
||||||
|
|
||||||
var flags []string
|
var flags []string
|
||||||
if aidlPreprocess.Valid() {
|
if aidlPreprocess.Valid() {
|
||||||
@@ -251,7 +255,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) (classpath android.Paths
|
|||||||
|
|
||||||
func (j *Module) compile(ctx android.ModuleContext) {
|
func (j *Module) compile(ctx android.ModuleContext) {
|
||||||
|
|
||||||
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Export_aidl_include_dirs)
|
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.deviceProperties.Export_aidl_include_dirs)
|
||||||
|
|
||||||
classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
|
classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
|
||||||
aidlIncludeDirs, srcFileLists := j.collectDeps(ctx)
|
aidlIncludeDirs, srcFileLists := j.collectDeps(ctx)
|
||||||
@@ -334,8 +338,8 @@ func (j *Module) compile(ctx android.ModuleContext) {
|
|||||||
j.classJarSpecs = classJarSpecs
|
j.classJarSpecs = classJarSpecs
|
||||||
j.classpathFile = outputFile
|
j.classpathFile = outputFile
|
||||||
|
|
||||||
if j.properties.Dex && len(srcFiles) > 0 {
|
if j.deviceProperties.Dex && len(srcFiles) > 0 {
|
||||||
dxFlags := j.properties.Dxflags
|
dxFlags := j.deviceProperties.Dxflags
|
||||||
if false /* emma enabled */ {
|
if false /* emma enabled */ {
|
||||||
// If you instrument class files that have local variable debug information in
|
// If you instrument class files that have local variable debug information in
|
||||||
// them emma does not correctly maintain the local variable table.
|
// them emma does not correctly maintain the local variable table.
|
||||||
@@ -418,17 +422,18 @@ func (j *JavaLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
func JavaLibraryFactory() (blueprint.Module, []interface{}) {
|
func JavaLibraryFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &JavaLibrary{}
|
module := &JavaLibrary{}
|
||||||
|
|
||||||
module.properties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
|
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon,
|
||||||
android.MultilibCommon, &module.Module.properties)
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaLibraryHostFactory() (blueprint.Module, []interface{}) {
|
func JavaLibraryHostFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &JavaLibrary{}
|
module := &JavaLibrary{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostSupported,
|
return android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon,
|
||||||
android.MultilibCommon, &module.Module.properties)
|
&module.Module.properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -462,17 +467,21 @@ func (j *JavaBinary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
func JavaBinaryFactory() (blueprint.Module, []interface{}) {
|
func JavaBinaryFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &JavaBinary{}
|
module := &JavaBinary{}
|
||||||
|
|
||||||
module.properties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
|
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon,
|
||||||
android.MultilibCommon, &module.Module.properties, &module.binaryProperties)
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties,
|
||||||
|
&module.binaryProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaBinaryHostFactory() (blueprint.Module, []interface{}) {
|
func JavaBinaryHostFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &JavaBinary{}
|
module := &JavaBinary{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostSupported,
|
return android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon,
|
||||||
android.MultilibCommon, &module.Module.properties, &module.binaryProperties)
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties,
|
||||||
|
&module.binaryProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user