Lines Matching +full:- +full:p

7 //     http://www.apache.org/licenses/LICENSE-2.0
16 // to `go install`, but doesn't require a GOPATH. A package->path mapping can
19 // -pkg-path android/soong=build/soong
20 // -pkg-path github.com/google/blueprint=build/blueprint
24 // android/soong-test package wouldn't be mapped in the above case.
33 // It also exposes the -trimpath option from go's compiler so that embedded
38 // -b <microfactory_bin_file>, Microfactory can rebuild itself as necessary.
191 func (p *GoPackage) FindDeps(config *Config, path string) error {
195 err := p.findDeps(config, path, depSet)
199 p.allDeps = depSet.packageList
262 func (p *GoPackage) findDeps(config *Config, path string, allPackages *linkedDepSet) error {
308 p.files = append(p.files, filename)
351 sort.Strings(p.files)
354 fmt.Fprintf(os.Stderr, "Package %q depends on %v\n", p.Name, deps)
359 p.directDeps = append(p.directDeps, allPackages.getByName(dep))
365 func (p *GoPackage) Compile(config *Config, outDir string) error {
366 p.mutex.Lock()
367 defer p.mutex.Unlock()
368 if p.compiled {
369 return p.failed
371 p.compiled = true
375 for _, dep := range p.directDeps {
383 for _, dep := range p.directDeps {
385 p.failed = dep.failed
386 return p.failed
390 endTrace := config.trace("check compile %s", p.Name)
392 p.pkgDir = filepath.Join(outDir, strings.Replace(p.Name, "/", "-", -1))
393 p.output = filepath.Join(p.pkgDir, p.Name) + ".a"
394 shaFile := p.output + ".hash"
400 "-N", "-l", // Disable optimization and inlining so that debugging works better
401 "-o", p.output,
402 "-p", p.Name,
403 "-complete", "-pack", "-nolocalimports")
405 cmd.Args = append(cmd.Args, "-c", fmt.Sprintf("%d", runtime.NumCPU()))
408 cmd.Args = append(cmd.Args, "-race")
409 fmt.Fprintln(hash, "-race")
412 cmd.Args = append(cmd.Args, "-trimpath", config.TrimPath)
415 for _, dep := range p.directDeps {
416 cmd.Args = append(cmd.Args, "-I", dep.pkgDir)
419 for _, filename := range p.files {
428 p.failed = err
435 p.failed = err
440 p.hashResult = hash.Sum(nil)
443 if _, err := os.Stat(p.output); err != nil {
448 rebuild = !bytes.Equal(oldSha, p.hashResult)
458 defer un(config.trace("compile %s", p.Name))
460 err := os.RemoveAll(p.pkgDir)
462 err = fmt.Errorf("%s: %v", p.Name, err)
463 p.failed = err
467 err = os.MkdirAll(filepath.Dir(p.output), 0777)
469 err = fmt.Errorf("%s: %v", p.Name, err)
470 p.failed = err
484 p.failed = err
488 err = ioutil.WriteFile(shaFile, p.hashResult, 0666)
490 err = fmt.Errorf("%s: %v", p.Name, err)
491 p.failed = err
495 p.rebuilt = true
500 func (p *GoPackage) Link(config *Config, out string) error {
501 if p.Name != "main" {
504 endTrace := config.trace("check link %s", p.Name)
508 if !p.rebuilt {
510 p.rebuilt = true
512 p.rebuilt = true
514 p.rebuilt = !bytes.Equal(oldSha, p.hashResult)
518 if !p.rebuilt {
521 defer un(config.trace("link %s", p.Name))
532 cmd := exec.Command(filepath.Join(goToolDir, "link"), "-o", out)
534 cmd.Args = append(cmd.Args, "-race")
536 for _, dep := range p.allDeps {
537 cmd.Args = append(cmd.Args, "-L", dep.pkgDir)
539 cmd.Args = append(cmd.Args, p.output)
551 return ioutil.WriteFile(shaFile, p.hashResult, 0666)
555 p := &GoPackage{
584 if err := p.FindDeps(config, path); err != nil {
587 if err := p.Compile(config, intermediates); err != nil {
590 if err := p.Link(config, out); err != nil {
593 return p, nil
633 flags.Var(&pkgMap, "pkg-path", "Mapping of package prefixes to file paths")
637 fmt.Fprintln(os.Stderr, "Usage:", os.Args[0], "-o out/binary <main-package>")
670 // pkgPathMapping can be used with flag.Var to parse -pkg-path arguments of
671 // <package-prefix>=<path-prefix> mappings.
675 return "<package-prefix>=<path-prefix>"
678 func (p *pkgPathMappingVar) Set(value string) error {
680 if equalPos == -1 {
681 return fmt.Errorf("Argument must be in the form of: %q", p.String())
687 return p.Map(pkgPrefix, pathPrefix)