Эх сурвалжийг харах

Apply formatting to C# sources.

Mario Zechner 4 жил өмнө
parent
commit
287f6dfb24

+ 1 - 0
formatters/README.md

@@ -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.

+ 15 - 3
formatters/format.sh

@@ -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