aboutsummaryrefslogtreecommitdiffstats
path: root/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'context.go')
-rw-r--r--context.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/context.go b/context.go
index 8d43c6c..3cd165a 100644
--- a/context.go
+++ b/context.go
@@ -2347,6 +2347,7 @@ func (c *Context) generateSingletonBuildActions(config interface{},
scope := newLocalScope(nil, singletonNamespacePrefix(info.name))
sctx := &singletonContext{
+ name: info.name,
context: c,
config: config,
scope: scope,
@@ -2977,6 +2978,25 @@ func (c *Context) VisitAllModuleVariants(module Module,
c.visitAllModuleVariants(c.moduleInfo[module], visit)
}
+// Singletons returns a list of all registered Singletons.
+func (c *Context) Singletons() []Singleton {
+ var ret []Singleton
+ for _, s := range c.singletonInfo {
+ ret = append(ret, s.singleton)
+ }
+ return ret
+}
+
+// SingletonName returns the name that the given singleton was registered with.
+func (c *Context) SingletonName(singleton Singleton) string {
+ for _, s := range c.singletonInfo {
+ if s.singleton == singleton {
+ return s.name
+ }
+ }
+ return ""
+}
+
// WriteBuildFile writes the Ninja manifeset text for the generated build
// actions to w. If this is called before PrepareBuildActions successfully
// completes then ErrBuildActionsNotReady is returned.