()
| 80 | } |
| 81 | |
| 82 | func (p Port) buildMeta() (string, error) { |
| 83 | // Try find prebuilt meta from cache first. |
| 84 | key := fmt.Sprintf("%s|%t", p.NameVersion(), p.DevDep || p.HostDep) |
| 85 | if v, ok := buildMetaCache.Load(key); ok { |
| 86 | r := v.(metaResult) |
| 87 | return r.meta, r.err |
| 88 | } |
| 89 | |
| 90 | // Computer meta and save into cache. |
| 91 | platformName := expr.If(p.DevDep || p.HostDep, p.ctx.Platform().GetHostName(), p.ctx.Platform().GetName()) |
| 92 | port := pkgcache.Port{ |
| 93 | NameVersion: p.NameVersion(), |
| 94 | Platform: platformName, |
| 95 | Project: p.ctx.Project().GetName(), |
| 96 | DevDep: p.DevDep, |
| 97 | HostDev: p.HostDep, |
| 98 | BuildConfig: p.toPkgCacheBuildConfig(p.MatchedConfig, p.portFile), |
| 99 | Callbacks: p, |
| 100 | } |
| 101 | |
| 102 | // Don't cache ErrRepoNotExit — the repo may be cloned later in the same run. |
| 103 | result, err := port.BuildMeta() |
| 104 | if err == nil || !errors.Is(err, errors.ErrRepoNotExit) { |
| 105 | buildMetaCache.Store(key, metaResult{meta: result, err: err}) |
| 106 | } |
| 107 | return result, err |
| 108 | } |
| 109 | |
| 110 | func (c Port) GenPlatformTomlString() (string, error) { |
| 111 | if c.DevDep || c.HostDep { |
no test coverage detected