Remove removes the cache for the specified platform, project, build type and name version.
(nameVersion string)
| 181 | |
| 182 | // Remove removes the cache for the specified platform, project, build type and name version. |
| 183 | func (a ArtifactConfig) Remove(nameVersion string) error { |
| 184 | platformName := a.ctx.Platform().GetName() |
| 185 | projectName := a.ctx.Project().GetName() |
| 186 | buildType := a.ctx.BuildType() |
| 187 | artifactCacheDir := a.ctx.PkgCacheConfig().GetDir(context.PkgCacheDirArtifacts) |
| 188 | pacakgeDir := filepath.Join(artifactCacheDir, platformName, projectName, buildType, nameVersion) |
| 189 | if fileio.PathExists(pacakgeDir) { |
| 190 | if err := os.RemoveAll(pacakgeDir); err != nil { |
| 191 | return fmt.Errorf("failed toremove cache package %s -> %w", pacakgeDir, err) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | // Exist check both archive file and build desc file exist. |
| 199 | func (a ArtifactConfig) Exist(nameVersion, hash string) bool { |
no test coverage detected