aboutsummaryrefslogtreecommitdiffstats
path: root/singleton_ctx.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-05-13 14:36:24 -0700
committerColin Cross <ccross@android.com>2015-06-26 10:51:44 -0700
commit4572edddfa0d6288bdf71208e29d9f99f58ae583 (patch)
treeef54ec11adffa1b9ed3efdb963771eb664fef2f1 /singleton_ctx.go
parent4adc8194905e72bcc240ef5bf5bbb2175c329c16 (diff)
downloadandroid_build_blueprint-4572edddfa0d6288bdf71208e29d9f99f58ae583.tar.gz
android_build_blueprint-4572edddfa0d6288bdf71208e29d9f99f58ae583.tar.bz2
android_build_blueprint-4572edddfa0d6288bdf71208e29d9f99f58ae583.zip
Add self-documenting support
The primary builder will now generate a rule to call itself with --docs=.bootstrap/docs/<name>.html to produce an automatically generated documentation file. The documentation generation process is: - Call each factory once to get empty property structs associated with the module type - Use reflection to determine the names of the type of each property struct - Use the bootstrap_go_package modules from reading the Blueprints files to find the source files for each Go package used to build the primary builder - Use the go/parser module to find the type declaration for each property struct - Extract comments for the property struct and each property declaration - Format all the comments into HTML Change-Id: Icae9307cc10549a30bfc14d6922824099de5a9b0
Diffstat (limited to 'singleton_ctx.go')
-rw-r--r--singleton_ctx.go24
1 files changed, 8 insertions, 16 deletions
diff --git a/singleton_ctx.go b/singleton_ctx.go
index c9cfc8c..e982086 100644
--- a/singleton_ctx.go
+++ b/singleton_ctx.go
@@ -16,7 +16,6 @@ package blueprint
import (
"fmt"
- "path/filepath"
)
type Singleton interface {
@@ -71,28 +70,21 @@ func (s *singletonContext) Config() interface{} {
}
func (s *singletonContext) ModuleName(logicModule Module) string {
- module := s.context.moduleInfo[logicModule]
- return module.properties.Name
+ return s.context.ModuleName(logicModule)
}
func (s *singletonContext) ModuleDir(logicModule Module) string {
- module := s.context.moduleInfo[logicModule]
- return filepath.Dir(module.relBlueprintsFile)
+ return s.context.ModuleDir(logicModule)
}
func (s *singletonContext) BlueprintFile(logicModule Module) string {
- module := s.context.moduleInfo[logicModule]
- return module.relBlueprintsFile
+ return s.context.BlueprintFile(logicModule)
}
func (s *singletonContext) ModuleErrorf(logicModule Module, format string,
args ...interface{}) {
- module := s.context.moduleInfo[logicModule]
- s.errs = append(s.errs, &Error{
- Err: fmt.Errorf(format, args...),
- Pos: module.pos,
- })
+ s.errs = append(s.errs, s.context.ModuleErrorf(logicModule, format, args...))
}
func (s *singletonContext) Errorf(format string, args ...interface{}) {
@@ -153,25 +145,25 @@ func (s *singletonContext) SetBuildDir(pctx *PackageContext, value string) {
}
func (s *singletonContext) VisitAllModules(visit func(Module)) {
- s.context.visitAllModules(visit)
+ s.context.VisitAllModules(visit)
}
func (s *singletonContext) VisitAllModulesIf(pred func(Module) bool,
visit func(Module)) {
- s.context.visitAllModulesIf(pred, visit)
+ s.context.VisitAllModulesIf(pred, visit)
}
func (s *singletonContext) VisitDepsDepthFirst(module Module,
visit func(Module)) {
- s.context.visitDepsDepthFirst(s.context.moduleInfo[module], visit)
+ s.context.VisitDepsDepthFirst(module, visit)
}
func (s *singletonContext) VisitDepsDepthFirstIf(module Module,
pred func(Module) bool, visit func(Module)) {
- s.context.visitDepsDepthFirstIf(s.context.moduleInfo[module], pred, visit)
+ s.context.VisitDepsDepthFirstIf(module, pred, visit)
}
func (s *singletonContext) AddNinjaFileDeps(deps ...string) {