Skip to content

Instantly share code, notes, and snippets.

@SwiftArchitect
Last active November 26, 2019 03:05
Show Gist options
  • Save SwiftArchitect/3912339cf861888c0f657688a65c1473 to your computer and use it in GitHub Desktop.
Save SwiftArchitect/3912339cf861888c0f657688a65c1473 to your computer and use it in GitHub Desktop.
Clean Build Artifacts
#!/bin/bash
#path to this script
location=$(dirname "$0")
#execute other scripts, passing the 1st parameter (directory)
source "$location/"cleanxcode.sh "$1"
source "$location/"cleanxamarin.sh "$1"
source "$location/"cleannodejs.sh "$1"
# ...etc.
#!/bin/bash
#optional 1st parameter: directory
directory="$1"
if [ -z "$directory" ]; then
directory="."
fi
# -maxdepth 2: This directory and 1 level deeper
# -type d: directories only
# -exec rm: delete the result
# @see https://unix.stackexchange.com/a/89929
echo "Removing Node.js modules..."
find "$directory" -type d -name "node_modules" -exec rm -r "{}" \;
echo "Done removing Node.js modules. (Use 'npm install' to get them back)"
#!/bin/bash
#optional 1st parameter: directory
directory="$1"
if [ -z "$directory" ]; then
directory="."
fi
echo "Removing Xamarin packages..."
find "$directory" -type d -name "packages" -exec rm -r "{}" \;
echo "Done removing Xamarin packages."
echo "Removing Xamarin NuGets..."
nuget locals all -clear
echo "Done removing Xamarin NuGets."
#!/bin/bash
#optional 1st parameter: directory
directory="$1"
if [ -z "$directory" ]; then
directory="."
fi
echo "Removing Xcode objects..."
find "$directory" -type d -name "obj" -exec rm -r "{}" \;
find "$directory" -type d -name "bin" -exec rm -r "{}" \;
find "$directory" -type d -name "DerivedData" -exec rm -r "{}" \;
find "$directory" -name ".DS_Store" -exec rm -r "{}" \;
find "$directory" -type d -name "xcuserdata" -exec rm -r "{}" \;
echo "Done removing Xcode objects."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment