initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
34
misc/scripts/dotnet_format.py
Normal file
34
misc/scripts/dotnet_format.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Invalid usage of dotnet_format.py, it should be called with a path to one or multiple files.")
|
||||
sys.exit(1)
|
||||
|
||||
# Create dummy generated files, if needed.
|
||||
for path in [
|
||||
"modules/mono/SdkPackageVersions.props",
|
||||
]:
|
||||
if os.path.exists(path):
|
||||
continue
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write("<Project />")
|
||||
|
||||
# Avoid importing GeneratedIncludes.props.
|
||||
os.environ["GodotSkipGenerated"] = "true"
|
||||
|
||||
# Match all the input files to their respective C# project.
|
||||
projects = {
|
||||
path: " ".join([f for f in sys.argv[1:] if os.path.commonpath([f, path]) == path])
|
||||
for path in [os.path.dirname(f) for f in glob.glob("**/*.csproj", recursive=True)]
|
||||
}
|
||||
|
||||
# Run dotnet format on all projects with more than 0 modified files.
|
||||
for path, files in projects.items():
|
||||
if files:
|
||||
os.system(f"dotnet format {path} --include {files}")
|
Reference in New Issue
Block a user