Lines Matching +full:- +full:p
7 // http://www.apache.org/licenses/LICENSE-2.0
27 // A PackageContext provides a way to create package-scoped Ninja pools,
29 // package-scoped PackageContext variable that it uses to create all package-
31 // passed to all calls to define module- or singleton-specific Ninja
86 func (p *packageContext) getScope() *basicScope {
87 return p.scope
95 // function or as part of a package-scoped variable initialization.
112 p := &packageContext{
119 packageContexts[pkgPath] = p
121 return p
128 var errRuleIsBuiltin = errors.New("the rule is a built-in")
129 var errPoolIsBuiltin = errors.New("the pool is a built-in")
172 // pkgPathToName makes a Ninja-friendly name out of a Go package name by
180 return strings.Replace(pkgPath, "/", ".", -1)
185 // visibility rules apply to these references - capitalized names indicate
218 func (p *packageContext) Import(pkgPath string) {
225 err := p.scope.AddImport(importPkg.shortName, importPkg.scope)
234 func (p *packageContext) ImportAs(as, pkgPath string) {
246 err = p.scope.AddImport(as, importPkg.scope)
261 // initialization - either from the init() function or as part of a package-
264 // This function is usually used to initialize a package-scoped Go variable that
268 func (p *packageContext) StaticVariable(name, value string) Variable {
276 pctx: p,
280 err = p.scope.AddVariable(v)
329 // error. It may only be called during a Go package's initialization - either
330 // from the init() function or as part of a package-scoped variable's
333 // This function is usually used to initialize a package-scoped Go variable that
338 func (p *packageContext) VariableFunc(name string,
349 pctx: p,
353 err = p.scope.AddVariable(v)
364 // during a Go package's initialization - either from the init() function or as
365 // part of a package-scoped variable's initialization.
367 // This function is usually used to initialize a package-scoped Go variable that
372 func (p *packageContext) VariableConfigMethod(name string,
392 pctx: p,
396 err = p.scope.AddVariable(v)
503 // information. It may only be called during a Go package's initialization -
504 // either from the init() function or as part of a package-scoped Go variable's
507 // This function is usually used to initialize a package-scoped Go variable that
511 func (p *packageContext) StaticPool(name string, params PoolParams) Pool {
520 pctx: p,
524 err = p.scope.AddPool(pool)
532 func (p *staticPool) packageContext() *packageContext {
533 return p.pctx
536 func (p *staticPool) name() string {
537 return p.name_
540 func (p *staticPool) fullName(pkgNames map[*packageContext]string) string {
541 if p.fullName_ != "" {
542 return p.fullName_
544 return packageNamespacePrefix(pkgNames[p.pctx]) + p.name_
547 func (p *staticPool) memoizeFullName(pkgNames map[*packageContext]string) {
548 p.fullName_ = p.fullName(pkgNames)
551 func (p *staticPool) def(config interface{}) (*poolDef, error) {
552 def, err := parsePoolParams(p.pctx.scope, &p.params)
554 panic(fmt.Errorf("error parsing PoolParams for %s: %s", p, err))
559 func (p *staticPool) String() string {
560 return p.pctx.pkgPath + "." + p.name_
572 // may only be called during a Go package's initialization - either from the
573 // init() function or as part of a package-scoped variable's initialization.
575 // This function is usually used to initialize a package-scoped Go variable that
580 func (p *packageContext) PoolFunc(name string, f func(interface{}) (PoolParams,
591 pctx: p,
595 err = p.scope.AddPool(pool)
603 func (p *poolFunc) packageContext() *packageContext {
604 return p.pctx
607 func (p *poolFunc) name() string {
608 return p.name_
611 func (p *poolFunc) fullName(pkgNames map[*packageContext]string) string {
612 if p.fullName_ != "" {
613 return p.fullName_
615 return packageNamespacePrefix(pkgNames[p.pctx]) + p.name_
618 func (p *poolFunc) memoizeFullName(pkgNames map[*packageContext]string) {
619 p.fullName_ = p.fullName(pkgNames)
622 func (p *poolFunc) def(config interface{}) (*poolDef, error) {
623 params, err := p.paramsFunc(config)
627 def, err := parsePoolParams(p.pctx.scope, ¶ms)
629 panic(fmt.Errorf("error parsing PoolParams for %s: %s", p, err))
634 func (p *poolFunc) String() string {
635 return p.pctx.pkgPath + "." + p.name_
642 func (p *builtinPool) packageContext() *packageContext {
646 func (p *builtinPool) name() string {
647 return p.name_
650 func (p *builtinPool) fullName(pkgNames map[*packageContext]string) string {
651 return p.name_
654 func (p *builtinPool) memoizeFullName(pkgNames map[*packageContext]string) {
658 func (p *builtinPool) def(config interface{}) (*poolDef, error) {
669 func (p *builtinPool) String() string {
670 return "<builtin>:" + p.name_
684 // information. It may only be called during a Go package's initialization -
685 // either from the init() function or as part of a package-scoped Go variable's
688 // This function is usually used to initialize a package-scoped Go variable that
695 // any of the string fields of params. Arguments can shadow package-scoped
697 // those defined in another package. Shadowing a package-scoped variable
698 // results in the package-scoped variable's value being used for build
700 // shadow package-scoped variables the default value is an empty string.
701 func (p *packageContext) StaticRule(name string, params RuleParams,
724 pctx: p,
730 err = p.scope.AddRule(r)
766 // We lazily create the scope so that all the package-scoped variables get
768 // shadow a package-scoped variable with an arg variable.
798 // may only be called during a Go package's initialization - either from the
799 // init() function or as part of a package-scoped variable's initialization.
801 // This function is usually used to initialize a package-scoped Go variable that
810 // shadow package-scoped variables defined within the caller's Go package, but
811 // they may not shadow those defined in another package. Shadowing a package-
812 // scoped variable results in the package-scoped variable's value being used for
814 // do not shadow package-scoped variables the default value is an empty string.
815 func (p *packageContext) RuleFunc(name string, f func(interface{}) (RuleParams,
838 pctx: p,
844 err = p.scope.AddRule(rule)
955 func (p *packageContext) AddNinjaFileDeps(deps ...string) {
956 p.ninjaFileDeps = append(p.ninjaFileDeps, deps...)