Commit Graph

8 Commits

Author SHA1 Message Date
Slava Karpenko 91c0240fd5 Explicitely disable cache for SwiftLintPlugin runs on Xcode Cloud (#5287)
In Xcode Cloud environment, SwiftLint’s cache cannot be written. When using the SwiftLintPlugin, there is no way to disable the cache. Previously, a solution was made for the SwiftLint CLI itself where it looks at a set of environment variables (#4485). This solution offers a cleaner approach where the plugin itself decides whether it needs to enable or disable the cache based on the `CI_XCODE_CLOUD` environment variable.

In the long run, SwiftLint should get rid of `isLikelyXcodeCloudEnvironment` entirely. The caller should always decide if caching is possible or not, while SwiftLint itself should be platform-agnostic.
2023-11-05 14:04:22 +01:00
Tony Arnold cfd9a26e33 Ensure that configuration exclusion rules are respected by the build plugin (#4757)
We always pass all of the Swift source files in the target to the tool, so we need to ensure that any exclusion rules in the configuration are respected.
2023-03-02 22:26:49 +01:00
Roman Stetsenko 843198d241 Use prebuildCommand for SwiftLint plugin (#4680) 2023-02-02 19:25:25 +01:00
Danny Mösch f8f2317bdb Extract common plugin execution code to method (#4690) 2023-01-14 12:35:53 +01:00
Tony Arnold ab143685a4 Use a binary target for the build tool plugin (#4603)
* Use a binary target for the build tool plugin

* Merge `push_version` and `release` make commands

Instead of running `make push_version "0.2.0: Tumble Dry"` and then
`make release`, now run `make release "0.2.0: Tumble Dry"`, which will
build the release artifacts and update/push the new version to GitHub.

This allows the artifacts to use the new version, update the artifact
bundle checksum in the package manifest, then tag the release.

The Releasing.md instructions were updated to reflect this new workflow.

* Add `SwiftLintSourcePlugin` source plugin for SwiftPM

* Add changelog entry

* Remove SwiftLintSourcePlugin for now

* Build from Source on Linux

* Use a lower-level method of checking if a file is accessible

This shouldn’t trigger sandbox violations, I hope…

* Prevent an infinite recursion of the filesystem root

* Remove unnecessary logging

* Quieten the output so that Xcode only prints violations

* Break up comment to avoid line length warning

* Fix capitalization of Glibc import

Co-authored-by: JP Simard <jp@jpsim.com>
2022-11-29 18:10:47 -05:00
JP Simard 5a7d3ade02 Lint Plugins directory (#4591) 2022-11-25 15:51:09 +00:00
Tony Arnold f088bbde15 Only lint Swift source files within the provided target (#4406)
* Only lint Swift source files within the provided target

* Restore plugin display name to “SwiftLint”

* Xcode targets don’t always conform to the SourceModuleTarget

Use a “baser” way to get at the Swift sources of the current target

* Use the cache path as the outputFiles

This prevents the warning we’re seeing in Xcode on every build, but shouldn’t interfere with the re-run logic

* Look for configuration files manually in the project directory and parents

* Check if the file is readable, not just that it exists

* Move the Path helper into a separate file

* Fix a wayward apostrophe

Signed-off-by: Tony Arnold <tony@thecocoabots.com>

* Add an entry to the CHANGELOG

Signed-off-by: Tony Arnold <tony@thecocoabots.com>

Signed-off-by: Tony Arnold <tony@thecocoabots.com>
2022-11-24 18:38:41 -05:00
Johannes Ebeling 3fd1573c57 Make SwiftLint available as a build tool plugin (#4176)
*  (spm) add build tool plugin definition for swiftlint
* 📝 (changelog) add changelog item for the plugin
* 🐛 (cache) define cache path explicitly to avoid issues during build without issues
* 🎨 minor code cleanup
* 📝 document usage with Xcode as well as Swift packages
2022-10-05 15:28:19 -04:00