Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure the SwiftLint build phase to explicitly run on every build #8098

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Nov 11, 2022

Description

Addresses this warning:

swiftlint-woo

We should be running SwiftLint on every build.

Testing instructions

Checkout this branch, build, and verify the warning is gone.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@mokagio mokagio self-assigned this Nov 11, 2022
@mokagio mokagio added the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Nov 11, 2022
@mokagio mokagio added this to the 11.3 milestone Nov 11, 2022
@mokagio mokagio requested a review from a team November 11, 2022 14:56
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8098-5d32126 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this? For instance, if I change the README should it re-run SwiftLint?

Can we do something with input files like *.swift that only runs if a Swift file is changed? Just slightly more efficient IMHO

@mokagio
Copy link
Contributor Author

mokagio commented Nov 12, 2022

Oh yes, good point. 🤔 I'm sure there's a pattern we can use in the Xcode UI list or .xcfilelist to get there.

@mokagio
Copy link
Contributor Author

mokagio commented Nov 17, 2022

@jkmassel I've been playing with the options here.

To get the full advantage of having the input file list, we also need an output file. In the case of a build phase that runs SwiftLint, that would have to be a dummy file, see #8134.

This screenshot shows the error one gets with "Based on dependency analysis" checked but no output files:

image

I worry a setup with a dummy output file would end up being more confusing than useful. In particular when we consider:

  • Running SwiftLint doesn't take long (*)
  • It seems reasonable to assume most builds run on a project like this one will include changes to Swift files

* here's a quick test I run on my Apple M1 Max 32 GB machine, showing SwiftLint taking < 0.2s on average:

➜ time ./Scripts/build-phases/swiftlint.sh
...
./Scripts/build-phases/swiftlint.sh  0.05s user 0.12s system 144% cpu 0.115 total

➜ time ./Scripts/build-phases/swiftlint.sh
...
./Scripts/build-phases/swiftlint.sh  0.05s user 0.12s system 143% cpu 0.117 total

➜ time ./Scripts/build-phases/swiftlint.sh
...
./Scripts/build-phases/swiftlint.sh  0.04s user 0.11s system 143% cpu 0.108 total

@oguzkocer oguzkocer modified the milestones: 11.3, 11.4 Nov 19, 2022
@oguzkocer oguzkocer modified the milestones: 11.4 ❄️, 11.6 Dec 2, 2022
@mokagio mokagio modified the milestones: 11.6, 11.7 Dec 7, 2022
@spencertransier spencertransier modified the milestones: 11.7, 11.8 Dec 16, 2022
@spencertransier spencertransier modified the milestones: 11.8, 11.9 Jan 7, 2023
@spencertransier spencertransier modified the milestones: 11.9 ❄️, 12.0 Jan 16, 2023
@mokagio mokagio removed this from the 12.0 milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants