SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

SwiftLint 0.52.3/4: The package product ... requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0

Open drekka opened this issue 1 year ago • 15 comments

New Issue Checklist

Describe the bug

So we added the SwiftLint plugin to the app project and also the SPM modules Package.swift file. We then checked the project target version was iOS16.1 and specified that in the platforms section of the Package.swift file.

This all works well within Xcode.

However when we started building our CI scripts and running xcodebuild the compilation fails with a stream of messages about the minimum OS target version being 11. For example:

error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')

And of course a whole bunch of compilation failures due to various APIs such as async/await not being available in iOS11.

I've tried running xcodebuild from the command line like this:

xcodebuild -workspace Rhythm.xcworkspace -scheme Application -configuration Debug -sdk iphonesimulator16.4 -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.4'  -skipPackagePluginValidation clean build

But no luck and no change.

I dumped out the SPM dependencies which look like this:

.
├── vexil<https://github.com/unsignedapps/[email protected]>
├── factory<https://github.com/hmlongco/[email protected]>
├── swift-markdown-ui<https://github.com/gonzalezreal/[email protected]>
├── swiftlint<https://github.com/realm/[email protected]>
│   ├── swift-argument-parser<https://github.com/apple/[email protected]>
│   ├── swift-syntax<https://github.com/apple/[email protected]>
│   ├── sourcekitten<https://github.com/jpsim/[email protected]>
│   │   ├── swift-argument-parser<https://github.com/apple/[email protected]>
│   │   ├── swxmlhash<https://github.com/drmohundro/[email protected]>
│   │   └── yams<https://github.com/jpsim/[email protected]>
│   ├── yams<https://github.com/jpsim/[email protected]>
│   ├── swiftytexttable<https://github.com/scottrhoyt/[email protected]>
│   ├── collectionconcurrencykit<https://github.com/JohnSundell/[email protected]>
│   └── cryptoswift<https://github.com/krzyzanowskim/[email protected]>
├── rive-ios<https://github.com/rive-app/[email protected]>
|...

Suspecting from the errors that the root problem was something SwiftLint depended on. I then removed SwiftLint and the command line builds started working.

Environment

  • SwiftLint version: 0.52.3 & 0.52.4
  • Installation method: SPM
  • Are you using [nested configurations]: No
  • Which Xcode version are you using: 14.3.1

drekka avatar Sep 07 '23 08:09 drekka

+1

curia-damiano avatar Sep 19 '23 15:09 curia-damiano

Confirmed on our Azure DevOps CI/CD as well

dvanluijpen avatar Sep 22 '23 06:09 dvanluijpen

FYI my issue #5228 has been solved with the release of 0.53.0.

I close my own issue.........

curia-damiano avatar Oct 05 '23 06:10 curia-damiano

Still reproducible for me with SwiftLint 0.53.0 and Xcode 15.0 when trying to execute test for a package with xcodebuild:

xcodebuild test -scheme MyPackageScheme -sdk iphonesimulator17.0 -destination "OS=17.0,name=iPhone 15 Pro"

I get almost the same output:

error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'CollectionConcurrencyKit' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')

Once I remove SwiftLint from package dependencies, everything starts working, but I really want to run SwiftLint on CI for PR builds.

vadimbelyaev avatar Oct 05 '23 07:10 vadimbelyaev

same for me, SwiftLint 0.53.0 and Xcode 14.3

ilonashub avatar Oct 05 '23 08:10 ilonashub

So I am lucky. But I use Xcode 15.0.

curia-damiano avatar Oct 05 '23 12:10 curia-damiano

@curia-damiano, just out of curiosity: did you have these errors while building an app or a standalone Swift package?

vadim-belyaev-appex avatar Oct 05 '23 12:10 vadim-belyaev-appex

Yes, identical error messages, in fact I've opened issue #5228.

As said, even my issue was not closed (I have closed it myself), but I've seen and tested release 0.53.0, and under Xcode 15.0, it works fine to me.

curia-damiano avatar Oct 05 '23 12:10 curia-damiano

FYI I reopen my issue because on a different project I get exactly the same error, even with 0.53.0

curia-damiano avatar Oct 08 '23 18:10 curia-damiano

v0.53.0 hasn't fixed it over here. Only updated the error to say it requires support for iOS 12 instead of 11. So improved I guess, but definitely NOT fixed.

drekka avatar Oct 16 '23 05:10 drekka

Please read the error messages that Xcode is providing carefully. Your projects are configured in such a way that Xcode is attempting to build SwiftLint for iOS, which will not compile. SwiftLint supports building and running on macOS and Linux only.

This appears to be a common mistake. Please try this suggestion to see if it helps: https://github.com/realm/SwiftLint/issues/3073#issuecomment-934301131

jpsim avatar Oct 16 '23 10:10 jpsim

You probably only want to add the plugin to run swiftlint during builds for your app target but added the Swiftlint frameworks to your app target by mistake. Make sure to remove them from Framework and Libraries.

Screenshot 2023-11-03 at 5 32 27 PM

marchinram avatar Nov 03 '23 22:11 marchinram

I have the exact same issue with Azure, and I haven't added any SwiftLint products in the target. It's only added as a plugin during build phase, but still, I get the same error.

theoks avatar Nov 29 '23 12:11 theoks

Seeing the same issue using Github Actions. We're not using the plugin with an app project and Swiftlint has not been added to the app target. We're only using the SPM plugin with some local packages. Tried with 0.54.0 and 0.53.0 on swift 5.9, iOS 15.

error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintFramework' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintBuiltInRules' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'CollectionConcurrencyKit' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintPlugin' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintCore' from project 'SwiftLint')
error: The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
error: The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'SwiftLintExtraRules' from project 'SwiftLint')
Testing failed:

The package product 'SwiftIDEUtils' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
The package product 'SwiftOperators' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
The package product 'SwiftParser' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
The package product 'SwiftSyntax' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
The package product 'SwiftSyntaxBuilder' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
The package product 'CollectionConcurrencyKit' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0
Testing cancelled because the build failed.

Jaron-Lowe avatar Dec 22 '23 21:12 Jaron-Lowe

@jpsim It's looking like this issue is completely resolved for me on main. Do we know if there is any plan to cut another release for SPM so we can get the fix?

Jaron-Lowe avatar Feb 12 '24 18:02 Jaron-Lowe

EKukarskiy avatar Mar 13 '24 14:03 EKukarskiy

You probably only want to add the plugin to run swiftlint during builds for your app target but added the Swiftlint frameworks to your app target by mistake. Make sure to remove them from Framework and Libraries.

Screenshot 2023-11-03 at 5 32 27 PM

That's it, thank you!

FilipeNMarques avatar Apr 18 '24 20:04 FilipeNMarques