Testing how swiftLanguageModes/swiftLanguageVersions in SwiftPM behaves.
-
Pick which tools version you want to test.
The repo comes with several
Package.swiftvariants, written for different tools versions. Pick the one you want to test by copying/renaming it toPackage.swift. For example:cp Package-4.2.swift Package.swift
Note: The filenames deliberately do not follow the SwiftPM convention to provide different manifests to different compiler versions (e.g.
Package@swift-5.11.swift). This makes it clear thatPackage.swiftis always the chosen manifest, and it allows you to test old manifest versions with modern compiler versions. -
Check out the
swiftLanguageModes/swiftLanguageVersionsargument in your chosenPackage.swift. Comment in/out different values in the array to test different combinations. -
Run
swift runto run the program. It will print both the compiler version and language mode with which it was compiled.
All of these were compiled with the Swift 6.1 compiler.
Swift compiler 6.0 or later
Swift language mode 4
Swift compiler 6.0 or later
Swift language mode 5
Swift compiler 6.0 or later
Swift language mode 5
Swift compiler 6.0 or later
Swift language mode 6 or later