fsprojects/ProjectScaffold

provide a scorched-earth clean script

Closed this issue · 2 comments

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

@chrismacklin Just use git clean -xfd??

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