Apply formatting to C# sources.

This commit is contained in:
Mario Zechner 2021-08-16 19:06:08 +02:00
parent f48e2ae2f8
commit 287f6dfb24
2 changed files with 16 additions and 3 deletions

View File

@ -5,5 +5,6 @@ You will need the following in your `PATH`:
- JDK 10+
- clang-format 12 (i.e. `brew install clang-format`)
- dotnet format (i.e. `dotnet tool install -g dotnet-format`, comes with dotnet 6 out of the box)
To run the formatter, invoke the `format.sh` script. This will shuffle around the Gradle config files, invoke spotless, then undo the config file shuffling. Invoking `./gradlew spotlessApply` from the `formatters/` directory will not work.

View File

@ -8,21 +8,33 @@ setup() {
cp $dir/.clang-format $dir/..
cp $dir/build.gradle $dir/..
cp $dir/settings.gradle $dir/..
cp $dir/.editorconfig $dir/../spine-csharp
cp $dir/.editorconfig $dir/../spine-xna
cp $dir/.editorconfig $dir/../spine-monogame
cp $dir/.editorconfig $dir/../spine-unity
}
cleanup() {
rm $dir/../.clang-format
rm $dir/../build.gradle
rm $dir/../settings.gradle
rm $dir/../spine-csharp/.editorconfig
rm $dir/../spine-xna/.editorconfig
rm $dir/../spine-monogame/.editorconfig
rm $dir/../spine-unity/.editorconfig
}
# copy Gradle and clang-format config to root
# copy Gradle, dotnet-format, and clang-format config to root
setup
# Execute spotless
# Execute spotless and dotnet-format
pushd $dir/..
./formatters/gradlew spotlessApply
dotnet-format spine-csharp/spine-csharp.sln
dotnet-format -f spine-xna
dotnet-format -f spine-monogame
dotnet-format -f spine-unity
popd
# Delete Gradle and clang-format config files in root
# Delete Gradle, dotnet-format, and clang-format config files in root
cleanup