Skip to content

Commit 0fb96d3

Browse files
committed
feat(sentinels): add .NET project build directory exclusions
Exclude bin/ and obj/ directories when *.csproj (C#) or *.fsproj (F#) project files are present, using glob sentinel patterns. Inspired by stevegrunwell#87, props @guigomesa.
1 parent 552c983 commit 0fb96d3

5 files changed

Lines changed: 48 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2828
* Exclude Elm packages (`elm-stuff`)
2929
* Exclude Godot 4 editor cache (`.godot`)
3030
* Exclude R renv environment (`renv`)
31+
* Exclude .NET build output (`bin`, `obj`) when `*.csproj` or `*.fsproj` project files are present (inspired by [stevegrunwell/asimov#87], props @guigomesa)
3132
* Added `make install` and `make uninstall` targets for streamlined setup and removal ([#35], props @sylver)
3233
* Added `scripts/uninstall.sh` to cleanly remove Asimov and its launchd schedule ([#35], props @sylver)
3334
* Added common interval reference comments to `com.stevegrunwell.asimov.plist` ([#35], props @sylver)
@@ -120,3 +121,4 @@ Initial public release.
120121
[#35]: https://github.com/stevegrunwell/asimov/pull/35
121122
[#56]: https://github.com/stevegrunwell/asimov/pull/56
122123
[stevegrunwell/asimov#64]: https://github.com/stevegrunwell/asimov/pull/64
124+
[stevegrunwell/asimov#87]: https://github.com/stevegrunwell/asimov/pull/87

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Asimov recognizes dependency directories across **30+ patterns** in these ecosys
3838
| **PHP** | `vendor` |
3939
| **Ruby** | `vendor` |
4040
| **Java / Kotlin / Scala** | `.gradle`, `build`, `target` |
41+
| **.NET (C# / F#)** | `bin`, `obj` |
4142
| **Swift / Apple** | `.build`, `Carthage`, `Pods` |
4243
| **Dart / Flutter** | `.dart_tool`, `.packages`, `build` |
4344
| **Elixir** | `deps`, `_build`, `.build` |

asimov

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ readonly ASIMOV_VENDOR_DIR_SENTINELS=(
7272
'target deps.edn' # Clojure CLI
7373
'.cpcache deps.edn' # Clojure CLI classpath cache
7474
'.shadow-cljs shadow-cljs.edn' # Shadow-CLJS (ClojureScript)
75+
'bin *.csproj' # .NET C# build output
76+
'obj *.csproj' # .NET C# intermediate output
77+
'bin *.fsproj' # .NET F# build output
78+
'obj *.fsproj' # .NET F# intermediate output
7579
'vendor composer.json' # Composer (PHP)
7680
'vendor Gemfile' # Bundler (Ruby)
7781
'vendor go.mod' # Go Modules (Golang)

tests/behavior.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ load test_helper
4343
[[ "$(count_exclusions)" -eq 0 ]]
4444
}
4545

46+
@test "does not exclude bin without any .NET project file" {
47+
mkdir -p "${HOME}/Code/My-Project/bin"
48+
run_asimov
49+
refute_excluded "${HOME}/Code/My-Project/bin"
50+
[[ "$(count_exclusions)" -eq 0 ]]
51+
}
52+
4653
# =============================================================================
4754
# Multi-match and deduplication
4855
# =============================================================================

tests/sentinels.bats

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,40 @@ load test_helper
300300
[[ "$(count_exclusions)" -eq 1 ]]
301301
}
302302

303+
# --- .NET ---
304+
305+
@test ".NET C#: excludes bin when *.csproj is present" {
306+
mkdir -p "${HOME}/Code/My-Project/bin"
307+
echo "sentinel" > "${HOME}/Code/My-Project/MyApp.csproj"
308+
run_asimov
309+
assert_excluded "${HOME}/Code/My-Project/bin"
310+
[[ "$(count_exclusions)" -eq 1 ]]
311+
}
312+
313+
@test ".NET C#: excludes obj when *.csproj is present" {
314+
mkdir -p "${HOME}/Code/My-Project/obj"
315+
echo "sentinel" > "${HOME}/Code/My-Project/MyApp.csproj"
316+
run_asimov
317+
assert_excluded "${HOME}/Code/My-Project/obj"
318+
[[ "$(count_exclusions)" -eq 1 ]]
319+
}
320+
321+
@test ".NET F#: excludes bin when *.fsproj is present" {
322+
mkdir -p "${HOME}/Code/My-Project/bin"
323+
echo "sentinel" > "${HOME}/Code/My-Project/MyApp.fsproj"
324+
run_asimov
325+
assert_excluded "${HOME}/Code/My-Project/bin"
326+
[[ "$(count_exclusions)" -eq 1 ]]
327+
}
328+
329+
@test ".NET F#: excludes obj when *.fsproj is present" {
330+
mkdir -p "${HOME}/Code/My-Project/obj"
331+
echo "sentinel" > "${HOME}/Code/My-Project/MyApp.fsproj"
332+
run_asimov
333+
assert_excluded "${HOME}/Code/My-Project/obj"
334+
[[ "$(count_exclusions)" -eq 1 ]]
335+
}
336+
303337
# --- PHP ---
304338

305339
@test "Composer: excludes vendor when composer.json is present" {

0 commit comments

Comments
 (0)