Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Keep a Meson build folder outside its project unselected too

Țugui Dragoș3944569fc2f1
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index ba23b737..fa6fa140 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -860,7 +860,9 @@ public enum ProjectArtifacts {
guard isRealFolder(entry), isTaggedAsACache(entry) else { continue }
guard !exclusions.excludes(entry), !exclusions.holds(entry) else { continue }
artifactNames.insert(entry.lastPathComponent)
- found.append(Found(name: entry.lastPathComponent, definition: nil, isTaggedAsACache: true))
+ // A kind known by its tool's own files, whatever the name, still names the folder away from its project.
+ let definition = definitions.first { $0.name == "*" && $0.proof?.holds(at: entry) == true }
+ found.append(Found(name: entry.lastPathComponent, definition: definition, isTaggedAsACache: true))
}
return Look(entries: entries, found: found)
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 60b32080..53ade04d 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -280,6 +280,20 @@ struct ProjectArtifactsTests {
#expect(found.allSatisfy { $0.tool == "Meson" && $0.heldBack == .keepsItsSetup && !$0.isRecommended })
}
+ @Test func aTaggedMesonBuildFolderOutsideItsProjectKeepsItsSetup() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("foo/meson.build", bytes: 16)
+ try directory.file("build-foo/meson-private/coredata.dat", bytes: 400_000)
+ let tag = "Signature: 8a477f597d28d172789f06886806bc55\n# This file is a cache directory tag created by meson.\n"
+ try directory.file("build-foo/CACHEDIR.TAG", contents: Data(tag.utf8))
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(found.map(\.name) == ["build-foo"])
+ #expect(found.allSatisfy { $0.tool == "Meson" && $0.heldBack == .keepsItsSetup && !$0.isRecommended })
+ }
+
@Test func listsPDMsPackagesAndNothingInsideThem() async throws {
let directory = try TemporaryDirectory()
try directory.file("app/pyproject.toml", bytes: 16)
diff --git a/SAFETY.md b/SAFETY.md
index 0d8b0b6d..57db6332 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -334,15 +334,15 @@ Python environment (`.venv`, `venv`, PDM's `__pypackages__`) is listed and never
installed into one by hand, and so is Terraform's `.terraform`, which keeps the workspace you chose, and xwin's
`.xwin-cache`, the Windows SDK a Rust project builds against, which only `xwin splat` with your own options puts back.
Pixi's `.pixi/envs` can be suggested: Pixi makes it again from `pixi.lock` and never lets it be edited by hand. A Meson
-build folder, whatever its name, is listed and never selected: it also keeps the options its build was set up with,
-which Meson's own `--wipe` carries over and nothing else in the project holds. A folder whose name says nothing on its
-own, such as `target` or `build`, is listed and never selected either. Of a Godot project's `.godot`, only the caches
-Godot makes again are offered, `imported` and `shader_cache`: the folder also holds the export passwords and keys
-(`export_credentials.cfg`), which exist nowhere else. Nx's `.nx` is offered only when it holds nothing but the cache and
-the database beside it, which `nx reset` removes together, since a team can keep its release plans there. Build
-Artifacts never searches a hidden folder, a Library, or a folder a tool fills, such as `node_modules`: apps and tools
-keep there what they install, as an editor keeps each extension's `package.json` beside the `node_modules` it runs with.
-A folder chosen to search that is one of those, or sits inside one, is refused with the reason.
+build folder, whatever its name and wherever Peel finds it, is never selected: it also keeps the options its build was
+set up with, which Meson's own `--wipe` carries over and nothing else in the project holds. A folder whose name says
+nothing on its own, such as `target` or `build`, is listed and never selected either. Of a Godot project's `.godot`,
+only the caches Godot makes again are offered, `imported` and `shader_cache`: the folder also holds the export passwords
+and keys (`export_credentials.cfg`), which exist nowhere else. Nx's `.nx` is offered only when it holds nothing but the
+cache and the database beside it, which `nx reset` removes together, since a team can keep its release plans there.
+Build Artifacts never searches a hidden folder, a Library, or a folder a tool fills, such as `node_modules`: apps and
+tools keep there what they install, as an editor keeps each extension's `package.json` beside the `node_modules` it runs
+with. A folder chosen to search that is one of those, or sits inside one, is refused with the reason.
Developer, Build Artifacts, Space, and Installers and Backups select nothing for you: opening a page selects nothing,
and Select Recommended selects what Peel recommends there.