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
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 @@
import (
"fmt"
- "path/filepath"
)
type Singleton interface {
@@ -71,28 +70,21 @@
}
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) 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) {