diff --git a/.swiftformat b/.swiftformat index 0c6722736..bcd35a4dc 100644 --- a/.swiftformat +++ b/.swiftformat @@ -12,6 +12,7 @@ --commas inline --ifdef no-indent --indent 4 +--indent-blank-lines enabled --nospaceoperators ...,..< --stripunusedargs closure-only --trimwhitespace nonblank-lines diff --git a/Tools/Sources/Commands/SetupProject.swift b/Tools/Sources/Commands/SetupProject.swift index c35ca2610..8379025ac 100644 --- a/Tools/Sources/Commands/SetupProject.swift +++ b/Tools/Sources/Commands/SetupProject.swift @@ -17,7 +17,10 @@ struct SetupProject: ParsableCommand { } func brewInstall() throws { - try Zsh.run(command: "brew install xcodegen swiftgen swiftformat git-lfs sourcery mint pkl kiliankoe/formulae/swift-outdated localazy/tools/localazy peripheryapp/periphery/periphery") + try Zsh.run(command: "brew install xcodegen swiftgen git-lfs sourcery mint pkl kiliankoe/formulae/swift-outdated localazy/tools/localazy peripheryapp/periphery/periphery") + + // Install swiftformat from develop (for now), making sure to avoid conflicts with an existing versioned installation. + try Zsh.run(command: "source ci_scripts/ci_common.sh && install_swiftformat_head") } func mintPackagesInstall() throws { diff --git a/ci_scripts/ci_common.sh b/ci_scripts/ci_common.sh index bc88b380e..ff948912f 100755 --- a/ci_scripts/ci_common.sh +++ b/ci_scripts/ci_common.sh @@ -15,7 +15,15 @@ setup_github_actions_environment() { unset HOMEBREW_NO_INSTALL_FROM_API export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - brew update && brew install xcodegen swiftlint swiftformat git-lfs pkl a7ex/homebrew-formulae/xcresultparser + brew update && brew install xcodegen swiftlint git-lfs pkl a7ex/homebrew-formulae/xcresultparser + install_swiftformat_head +} + +install_swiftformat_head() { + if brew list --versions swiftformat &>/dev/null && ! brew list --versions swiftformat | grep -q HEAD; then + brew uninstall swiftformat + fi + brew install swiftformat --HEAD } setup_github_actions_translations_environment() {