fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
515 stars 154 forks source link

provide a scorched-earth clean script #274

Closed chrismacklin closed 7 years ago

chrismacklin commented 7 years ago

First off, thanks to all the contributors for this project! It has been immensely helpful getting our F# programs working with the rest of our build/test/release automation.

We have quite a few F# projects that we are migrating into project scaffold, and this process has been pretty tricky and error-prone. I've run into multiple strange edge cases where cached build products or pieces of the build tools have gotten into weird states, and blowing away all of the non-persistent files in the scaffold was the only thing that fixed it. It would be really helpful to include a scorched-earth "clean" script that destroys everything that will be automatically recreated when build is run again. That might help others in similar situations, as people might hesitate to do things like blow away the entire .fake directory, except we've had to do that before.

My clean script looks something like this (this probably isn't that robust, and a windows variant would be needed as well):

#!/usr/bin/env bash

set -eu

cd "$(dirname "$0")"

# remove build products from default IDE build location
rm -rf src/*/bin src/*/obj

# remove scaffold build products
rm -rf bin obj

# remove test build products
rm -rf tests/*/bin tests/*/obj

# remove pulled packages
rm -rf packages

# remove the cached version of fake
rm -rf .fake
dsyme commented 7 years ago

@chrismacklin Just use git clean -xfd??

chrismacklin commented 7 years ago

Indeed, I discovered this solution some time ago but had forgotten about opening this issue. Thanks!