Fixed then comments to describe how to use android.ModuleBase object. am: b9eeb1d79a

am: 2bc313cf61

Change-Id: Ib0cbe9d8d8c3fc0802dc0ba78a0b4c80d52b4215
This commit is contained in:
Nan Zhang
2017-02-02 21:47:24 +00:00
committed by android-build-merger

View File

@@ -218,17 +218,17 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
return InitArchModule(m, propertyStructs...) return InitArchModule(m, propertyStructs...)
} }
// A AndroidModuleBase object contains the properties that are common to all Android // A ModuleBase object contains the properties that are common to all Android
// modules. It should be included as an anonymous field in every module // modules. It should be included as an anonymous field in every module
// struct definition. InitAndroidModule should then be called from the module's // struct definition. InitAndroidModule should then be called from the module's
// factory function, and the return values from InitAndroidModule should be // factory function, and the return values from InitAndroidModule should be
// returned from the factory function. // returned from the factory function.
// //
// The AndroidModuleBase type is responsible for implementing the // The ModuleBase type is responsible for implementing the GenerateBuildActions
// GenerateBuildActions method to support the blueprint.Module interface. This // method to support the blueprint.Module interface. This method will then call
// method will then call the module's GenerateAndroidBuildActions method once // the module's GenerateAndroidBuildActions method once for each build variant
// for each build variant that is to be built. GenerateAndroidBuildActions is // that is to be built. GenerateAndroidBuildActions is passed a
// passed a AndroidModuleContext rather than the usual blueprint.ModuleContext. // AndroidModuleContext rather than the usual blueprint.ModuleContext.
// AndroidModuleContext exposes extra functionality specific to the Android build // AndroidModuleContext exposes extra functionality specific to the Android build
// system including details about the particular build variant that is to be // system including details about the particular build variant that is to be
// generated. // generated.
@@ -236,12 +236,12 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
// For example: // For example:
// //
// import ( // import (
// "android/soong/common" // "android/soong/android"
// "github.com/google/blueprint" // "github.com/google/blueprint"
// ) // )
// //
// type myModule struct { // type myModule struct {
// common.AndroidModuleBase // android.ModuleBase
// properties struct { // properties struct {
// MyProperty string // MyProperty string
// } // }
@@ -249,10 +249,10 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
// //
// func NewMyModule() (blueprint.Module, []interface{}) { // func NewMyModule() (blueprint.Module, []interface{}) {
// m := &myModule{} // m := &myModule{}
// return common.InitAndroidModule(m, &m.properties) // return android.InitAndroidModule(m, &m.properties)
// } // }
// //
// func (m *myModule) GenerateAndroidBuildActions(ctx common.AndroidModuleContext) { // func (m *myModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// // Get the CPU architecture for the current build variant. // // Get the CPU architecture for the current build variant.
// variantArch := ctx.Arch() // variantArch := ctx.Arch()
// //