Tasks we perform with Sourcery are rather simple and can be replaced
with a basic collection of files and the generation of lists in the
new `swiftlint-dev` command. This spares contributors from installing
either Sourcery or Bazel.
The current algorithm is like "collect all included files and subtract all excluded files".
Collecting all included and all excluded files relies on the file system. This can become slow
when the patterns used to exclude files resolve to a large number of files.
The new approach only collects all lintable files and checks them against the exclude patterns.
This can be done by in-memory string-regex-match and does therefore not require file system accesses.
Ideally, SwiftLintCore would some day only contain components
that are needed to define rules. Consequently, it would be the
only bundle required to import for (external) rule development.
* Compile with `-strict-concurrency=complete`
Only in Bazel for now, because this is considered an unsafe flag in
SwiftPM which would lead to warnings for downstream consumers of
SwiftLint using SwiftPM.
Some imports of SwiftSyntax need the `@preconcurrency` annotation until
https://github.com/apple/swift-syntax/pull/2322 is available in a
release.
The following SwiftLint libraries have `-strict-concurrency=complete`
applied:
* SwiftLintCoreMacros
* SwiftLintBuiltInRules
* SwiftLintExtraRules
The following SwiftLint libraries don't have the flag applied and need
to be migrated:
* SwiftLintCore
* swiftlint (CLI target)
So really the rules and macros are now being compiled with
`-strict-concurrency=complete`, but the core infrastructure of SwiftLint
is not.
Still, given that Swift 6 will eventually make these warnings errors by
default, it's good to prevent issues from creeping in earlier rather
than later.
* Add CI job to build with strict concurrency
And pin the Ruby version to 2.7.5. rbenv was installed on all CI
machines using Homebrew, with Ruby 2.7.5 installed and set as the
global version. The `pre-command` script was also updated on all agents
to add rbenv binaries to the path and run `rbenv init`.
Remove rules_ruby integration and just use rbenv and ruby directly.
By adding a `tools/sourcery` script that downloads and runs Sourcery via
Bazel.
Previously, unrelated changes might include modifications to the
generated comment headers because contributors' local versions of
Sourcery would be used, which we don't control.
Also move the CI job to Buildkite where the bazel server is usually
already warmed up and running.