Allow wrapping of PackageContext
Turn PackageContext into an interface so that build systems can wrap it
to add more custom helpers.
This does introduce an API change, though it should be fairly simple.
NewPackageContext used to provide an opaque *PackageContext struct, now it
provides a PackageContext interface.
Change-Id: I383c64a303d857ef5e0dec86ad77f791ba4c9639
diff --git a/ninja_defs.go b/ninja_defs.go
index 05b8f2f..e7a2929 100644
--- a/ninja_defs.go
+++ b/ninja_defs.go
@@ -207,7 +207,7 @@
}
func (r *ruleDef) WriteTo(nw *ninjaWriter, name string,
- pkgNames map[*PackageContext]string) error {
+ pkgNames map[*packageContext]string) error {
if r.Comment != "" {
err := nw.Comment(r.Comment)
@@ -327,7 +327,7 @@
return b, nil
}
-func (b *buildDef) WriteTo(nw *ninjaWriter, pkgNames map[*PackageContext]string) error {
+func (b *buildDef) WriteTo(nw *ninjaWriter, pkgNames map[*packageContext]string) error {
var (
comment = b.Comment
rule = b.Rule.fullName(pkgNames)
@@ -372,7 +372,7 @@
return nw.BlankLine()
}
-func valueList(list []*ninjaString, pkgNames map[*PackageContext]string,
+func valueList(list []*ninjaString, pkgNames map[*packageContext]string,
escaper *strings.Replacer) []string {
result := make([]string, len(list))