(p *Port)
| 248 | } |
| 249 | |
| 250 | func (i *installReport) write(p *Port) (string, error) { |
| 251 | if i == nil || p == nil { |
| 252 | return "", nil |
| 253 | } |
| 254 | |
| 255 | var statisticDir string |
| 256 | if p.DevDep || p.HostDep { |
| 257 | hostName := p.ctx.Platform().GetHostName() |
| 258 | statisticDir = filepath.Join(dirs.InstalledDir, "celer", "statistics", hostName+"-dev") |
| 259 | } else { |
| 260 | projectName := p.ctx.Project().GetName() |
| 261 | platformName := p.ctx.Platform().GetName() |
| 262 | buildType := p.ctx.BuildType() |
| 263 | statisticDir = filepath.Join(dirs.InstalledDir, "celer", "statistics", platformName, projectName, buildType) |
| 264 | } |
| 265 | if err := fileio.MkdirAll(statisticDir, os.ModePerm); err != nil { |
| 266 | return "", err |
| 267 | } |
| 268 | |
| 269 | fileBase := strings.ReplaceAll(i.rootPort, "@", "_") |
| 270 | mdPath := filepath.Join(statisticDir, fileBase+".md") |
| 271 | |
| 272 | // Generate markdown report. |
| 273 | markdown := i.renderMarkdown(p) |
| 274 | if err := os.WriteFile(mdPath, []byte(markdown), os.ModePerm); err != nil { |
| 275 | return "", err |
| 276 | } |
| 277 | |
| 278 | return mdPath, nil |
| 279 | } |
no test coverage detected