Rename common to android

Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
This commit is contained in:
Colin Cross
2016-05-18 15:37:25 -07:00
parent c7fd91a266
commit 635c3b0157
43 changed files with 637 additions and 637 deletions

View File

@@ -25,7 +25,7 @@ import (
"github.com/google/blueprint"
"android/soong"
"android/soong/common"
"android/soong/android"
"android/soong/genrule"
)
@@ -114,16 +114,16 @@ type javaBaseProperties struct {
// javaBase contains the properties and members used by all java module types, and implements
// the blueprint.Module interface.
type javaBase struct {
common.AndroidModuleBase
android.ModuleBase
module JavaModuleType
properties javaBaseProperties
// output file suitable for inserting into the classpath of another compile
classpathFile common.Path
classpathFile android.Path
// output file suitable for installing or running
outputFile common.Path
outputFile android.Path
// jarSpecs suitable for inserting classes from a static library into another jar
classJarSpecs []jarSpec
@@ -131,43 +131,43 @@ type javaBase struct {
// jarSpecs suitable for inserting resources from a static library into another jar
resourceJarSpecs []jarSpec
exportAidlIncludeDirs common.Paths
exportAidlIncludeDirs android.Paths
logtagsSrcs common.Paths
logtagsSrcs android.Paths
// filelists of extra source files that should be included in the javac command line,
// for example R.java generated by aapt for android apps
ExtraSrcLists common.Paths
ExtraSrcLists android.Paths
// installed file for binary dependency
installFile common.Path
installFile android.Path
}
type AndroidJavaModuleContext common.AndroidBaseContext
type AndroidJavaModuleContext android.BaseContext
type JavaModuleType interface {
GenerateJavaBuildActions(ctx common.AndroidModuleContext)
GenerateJavaBuildActions(ctx android.ModuleContext)
JavaDependencies(ctx AndroidJavaModuleContext) []string
}
type JavaDependency interface {
ClasspathFile() common.Path
ClasspathFile() android.Path
ClassJarSpecs() []jarSpec
ResourceJarSpecs() []jarSpec
AidlIncludeDirs() common.Paths
AidlIncludeDirs() android.Paths
}
func NewJavaBase(base *javaBase, module JavaModuleType, hod common.HostOrDeviceSupported,
func NewJavaBase(base *javaBase, module JavaModuleType, hod android.HostOrDeviceSupported,
props ...interface{}) (blueprint.Module, []interface{}) {
base.module = module
props = append(props, &base.properties)
return common.InitAndroidArchModule(base, hod, common.MultilibCommon, props...)
return android.InitAndroidArchModule(base, hod, android.MultilibCommon, props...)
}
func (j *javaBase) BootClasspath(ctx common.AndroidBaseContext) string {
func (j *javaBase) BootClasspath(ctx android.BaseContext) string {
if ctx.Device() {
if j.properties.Sdk_version == "" {
return "core-libart"
@@ -191,7 +191,7 @@ func (j *javaBase) BootClasspath(ctx common.AndroidBaseContext) string {
var defaultJavaLibraries = []string{"core-libart", "core-junit", "ext", "framework"}
func javaDepsMutator(ctx common.AndroidBottomUpMutatorContext) {
func javaDepsMutator(ctx android.BottomUpMutatorContext) {
if j, ok := ctx.Module().(JavaModuleType); ok {
ctx.AddDependency(ctx.Module(), nil, j.JavaDependencies(ctx)...)
}
@@ -215,35 +215,35 @@ func (j *javaBase) JavaDependencies(ctx AndroidJavaModuleContext) []string {
return deps
}
func (j *javaBase) aidlFlags(ctx common.AndroidModuleContext, aidlPreprocess common.OptionalPath,
aidlIncludeDirs common.Paths) []string {
func (j *javaBase) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
aidlIncludeDirs android.Paths) []string {
localAidlIncludes := common.PathsForModuleSrc(ctx, j.properties.Aidl_includes)
localAidlIncludes := android.PathsForModuleSrc(ctx, j.properties.Aidl_includes)
var flags []string
if aidlPreprocess.Valid() {
flags = append(flags, "-p"+aidlPreprocess.String())
} else {
flags = append(flags, common.JoinWithPrefix(aidlIncludeDirs.Strings(), "-I"))
flags = append(flags, android.JoinWithPrefix(aidlIncludeDirs.Strings(), "-I"))
}
flags = append(flags, common.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
flags = append(flags, common.JoinWithPrefix(localAidlIncludes.Strings(), "-I"))
flags = append(flags, "-I"+common.PathForModuleSrc(ctx).String())
flags = append(flags, "-I"+common.PathForModuleSrc(ctx, "src").String())
flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
flags = append(flags, android.JoinWithPrefix(localAidlIncludes.Strings(), "-I"))
flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
flags = append(flags, "-I"+android.PathForModuleSrc(ctx, "src").String())
return flags
}
func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath common.Paths,
bootClasspath common.OptionalPath, classJarSpecs, resourceJarSpecs []jarSpec, aidlPreprocess common.OptionalPath,
aidlIncludeDirs common.Paths, srcFileLists common.Paths) {
func (j *javaBase) collectDeps(ctx android.ModuleContext) (classpath android.Paths,
bootClasspath android.OptionalPath, classJarSpecs, resourceJarSpecs []jarSpec, aidlPreprocess android.OptionalPath,
aidlIncludeDirs android.Paths, srcFileLists android.Paths) {
ctx.VisitDirectDeps(func(module blueprint.Module) {
otherName := ctx.OtherModuleName(module)
if javaDep, ok := module.(JavaDependency); ok {
if otherName == j.BootClasspath(ctx) {
bootClasspath = common.OptionalPathForPath(javaDep.ClasspathFile())
bootClasspath = android.OptionalPathForPath(javaDep.ClasspathFile())
} else if inList(otherName, defaultJavaLibraries) {
classpath = append(classpath, javaDep.ClasspathFile())
} else if inList(otherName, j.properties.Java_libs) {
@@ -279,13 +279,13 @@ func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath commo
aidlIncludeDirs, srcFileLists
}
func (j *javaBase) GenerateAndroidBuildActions(ctx common.AndroidModuleContext) {
func (j *javaBase) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.module.GenerateJavaBuildActions(ctx)
}
func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
func (j *javaBase) GenerateJavaBuildActions(ctx android.ModuleContext) {
j.exportAidlIncludeDirs = common.PathsForModuleSrc(ctx, j.properties.Export_aidl_include_dirs)
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Export_aidl_include_dirs)
classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
aidlIncludeDirs, srcFileLists := j.collectDeps(ctx)
@@ -304,7 +304,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
flags.aidlFlags = "$aidlFlags"
}
var javacDeps common.Paths
var javacDeps android.Paths
if bootClasspath.Valid() {
flags.bootClasspath = "-bootclasspath " + bootClasspath.String()
@@ -341,7 +341,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
resourceJarSpecs = append(ResourceDirsToJarSpecs(ctx, j.properties.Java_resource_dirs, j.properties.Exclude_java_resource_dirs),
resourceJarSpecs...)
manifest := common.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
allJarSpecs := append([]jarSpec(nil), classJarSpecs...)
allJarSpecs = append(allJarSpecs, resourceJarSpecs...)
@@ -353,7 +353,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
}
if j.properties.Jarjar_rules != nil {
jarjar_rules := common.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
// Transform classes-full-debug.jar into classes-jarjar.jar
outputFile = TransformJarJar(ctx, outputFile, jarjar_rules)
if ctx.Failed() {
@@ -388,7 +388,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
dxFlags = append(dxFlags,
"--debug",
"--verbose",
"--dump-to="+common.PathForModuleOut(ctx, "classes.lst").String(),
"--dump-to="+android.PathForModuleOut(ctx, "classes.lst").String(),
"--dump-width=1000")
}
@@ -409,7 +409,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
var _ JavaDependency = (*JavaLibrary)(nil)
func (j *javaBase) ClasspathFile() common.Path {
func (j *javaBase) ClasspathFile() android.Path {
return j.classpathFile
}
@@ -421,13 +421,13 @@ func (j *javaBase) ResourceJarSpecs() []jarSpec {
return j.resourceJarSpecs
}
func (j *javaBase) AidlIncludeDirs() common.Paths {
func (j *javaBase) AidlIncludeDirs() android.Paths {
return j.exportAidlIncludeDirs
}
var _ logtagsProducer = (*javaBase)(nil)
func (j *javaBase) logtags() common.Paths {
func (j *javaBase) logtags() android.Paths {
return j.logtagsSrcs
}
@@ -439,10 +439,10 @@ type JavaLibrary struct {
javaBase
}
func (j *JavaLibrary) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
func (j *JavaLibrary) GenerateJavaBuildActions(ctx android.ModuleContext) {
j.javaBase.GenerateJavaBuildActions(ctx)
j.installFile = ctx.InstallFileName(common.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.outputFile)
j.installFile = ctx.InstallFileName(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.outputFile)
}
func JavaLibraryFactory() (blueprint.Module, []interface{}) {
@@ -450,13 +450,13 @@ func JavaLibraryFactory() (blueprint.Module, []interface{}) {
module.properties.Dex = true
return NewJavaBase(&module.javaBase, module, common.HostAndDeviceSupported)
return NewJavaBase(&module.javaBase, module, android.HostAndDeviceSupported)
}
func JavaLibraryHostFactory() (blueprint.Module, []interface{}) {
module := &JavaLibrary{}
return NewJavaBase(&module.javaBase, module, common.HostSupported)
return NewJavaBase(&module.javaBase, module, android.HostSupported)
}
//
@@ -474,12 +474,12 @@ type JavaBinary struct {
binaryProperties javaBinaryProperties
}
func (j *JavaBinary) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
func (j *JavaBinary) GenerateJavaBuildActions(ctx android.ModuleContext) {
j.JavaLibrary.GenerateJavaBuildActions(ctx)
// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
// another build rule before the jar has been installed.
ctx.InstallFile(common.PathForModuleInstall(ctx, "bin"), common.PathForModuleSrc(ctx, j.binaryProperties.Wrapper),
ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"), android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper),
j.installFile)
}
@@ -488,13 +488,13 @@ func JavaBinaryFactory() (blueprint.Module, []interface{}) {
module.properties.Dex = true
return NewJavaBase(&module.javaBase, module, common.HostAndDeviceSupported, &module.binaryProperties)
return NewJavaBase(&module.javaBase, module, android.HostAndDeviceSupported, &module.binaryProperties)
}
func JavaBinaryHostFactory() (blueprint.Module, []interface{}) {
module := &JavaBinary{}
return NewJavaBase(&module.javaBase, module, common.HostSupported, &module.binaryProperties)
return NewJavaBase(&module.javaBase, module, android.HostSupported, &module.binaryProperties)
}
//
@@ -506,32 +506,32 @@ type javaPrebuiltProperties struct {
}
type JavaPrebuilt struct {
common.AndroidModuleBase
android.ModuleBase
properties javaPrebuiltProperties
classpathFile common.Path
classpathFile android.Path
classJarSpecs, resourceJarSpecs []jarSpec
}
func (j *JavaPrebuilt) GenerateAndroidBuildActions(ctx common.AndroidModuleContext) {
func (j *JavaPrebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(j.properties.Srcs) != 1 {
ctx.ModuleErrorf("expected exactly one jar in srcs")
return
}
prebuilt := common.PathForModuleSrc(ctx, j.properties.Srcs[0])
prebuilt := android.PathForModuleSrc(ctx, j.properties.Srcs[0])
classJarSpec, resourceJarSpec := TransformPrebuiltJarToClasses(ctx, prebuilt)
j.classpathFile = prebuilt
j.classJarSpecs = []jarSpec{classJarSpec}
j.resourceJarSpecs = []jarSpec{resourceJarSpec}
ctx.InstallFileName(common.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.classpathFile)
ctx.InstallFileName(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.classpathFile)
}
var _ JavaDependency = (*JavaPrebuilt)(nil)
func (j *JavaPrebuilt) ClasspathFile() common.Path {
func (j *JavaPrebuilt) ClasspathFile() android.Path {
return j.classpathFile
}
@@ -543,15 +543,15 @@ func (j *JavaPrebuilt) ResourceJarSpecs() []jarSpec {
return j.resourceJarSpecs
}
func (j *JavaPrebuilt) AidlIncludeDirs() common.Paths {
func (j *JavaPrebuilt) AidlIncludeDirs() android.Paths {
return nil
}
func JavaPrebuiltFactory() (blueprint.Module, []interface{}) {
module := &JavaPrebuilt{}
return common.InitAndroidArchModule(module, common.HostAndDeviceSupported,
common.MultilibCommon, &module.properties)
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
android.MultilibCommon, &module.properties)
}
//
@@ -560,7 +560,7 @@ func JavaPrebuiltFactory() (blueprint.Module, []interface{}) {
type sdkDependency interface {
JavaDependency
AidlPreprocessed() common.OptionalPath
AidlPreprocessed() android.OptionalPath
}
var _ sdkDependency = (*sdkPrebuilt)(nil)
@@ -574,24 +574,24 @@ type sdkPrebuilt struct {
sdkProperties sdkPrebuiltProperties
aidlPreprocessed common.OptionalPath
aidlPreprocessed android.OptionalPath
}
func (j *sdkPrebuilt) GenerateAndroidBuildActions(ctx common.AndroidModuleContext) {
func (j *sdkPrebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.JavaPrebuilt.GenerateAndroidBuildActions(ctx)
j.aidlPreprocessed = common.OptionalPathForModuleSrc(ctx, j.sdkProperties.Aidl_preprocessed)
j.aidlPreprocessed = android.OptionalPathForModuleSrc(ctx, j.sdkProperties.Aidl_preprocessed)
}
func (j *sdkPrebuilt) AidlPreprocessed() common.OptionalPath {
func (j *sdkPrebuilt) AidlPreprocessed() android.OptionalPath {
return j.aidlPreprocessed
}
func SdkPrebuiltFactory() (blueprint.Module, []interface{}) {
module := &sdkPrebuilt{}
return common.InitAndroidArchModule(module, common.HostAndDeviceSupported,
common.MultilibCommon, &module.properties, &module.sdkProperties)
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
android.MultilibCommon, &module.properties, &module.sdkProperties)
}
func inList(s string, l []string) bool {