(options InstallOptions)
| 460 | } |
| 461 | |
| 462 | func (p *Port) InstallFromDevCache(options InstallOptions) (bool, error) { |
| 463 | // Install from local dev cache only work for hostDev or devDep. |
| 464 | if !p.HostDep && !p.DevDep { |
| 465 | return false, nil |
| 466 | } |
| 467 | |
| 468 | // Rebuild with force. |
| 469 | if !options.Force { |
| 470 | return false, nil |
| 471 | } |
| 472 | |
| 473 | // Disable devCache in build_config. |
| 474 | // For some library like icu, cross-compile it should base on its native build cache dir. |
| 475 | if p.MatchedConfig.DisableDevCache { |
| 476 | return false, nil |
| 477 | } |
| 478 | |
| 479 | // Check if devCacheConfig has been configured. |
| 480 | devCacheConfig := p.ctx.DevCacheConfig() |
| 481 | if devCacheConfig == nil { |
| 482 | return false, nil |
| 483 | } |
| 484 | |
| 485 | installed, err := p.doInstallFromDevCache(options) |
| 486 | if err != nil { |
| 487 | // Repo not exist is not error. |
| 488 | if errors.Is(err, errors.ErrRepoNotExit) { |
| 489 | return false, nil |
| 490 | } |
| 491 | return false, err |
| 492 | } |
| 493 | |
| 494 | if installed { |
| 495 | // Install dependencies also. |
| 496 | if err := p.installDependencies(options); err != nil { |
| 497 | return false, err |
| 498 | } |
| 499 | |
| 500 | if err := p.doInstallFromPackage(p.InstalledDir); err != nil { |
| 501 | return false, err |
| 502 | } |
| 503 | |
| 504 | fromDir := devCacheConfig.GetDir() |
| 505 | return true, p.writeTraceFile(fmt.Sprintf("dev-cache: %q", fromDir)) |
| 506 | } |
| 507 | |
| 508 | return false, nil |
| 509 | } |
| 510 | |
| 511 | func (p *Port) InstallFromSource(options InstallOptions) error { |
| 512 | // Reset at top-level entry. |
no test coverage detected