There has been high activity on Swift Package Manager recently starting with Kostiantyn Koval and me receiving commit access \o/. Here is a summary of changes which are worth looking at and will affect you if you’re developing packages with swiftpm.
-
Max Howell ported swiftpm to swift 3 api guidelines.
-
Max Howell added Xcode project file generation into swiftpm, that means you can use Xcode for your swift packages (on OSX).
Just run this command to generate the Xcode project file for the package.
$ swift build --generate-xcodeproj or $ swift build -X
This will generate the Xcode project in root directory of the package. If you prefer the file to be somewhere else Honza Dvorsky raised a PR to generate it in a custom location.
-
I started a PR adding basic support of building C language based on Daniel Dunbar’s proposal.
-
Brian Croom updated the tests in swiftpm since now you don’t have to conform to
XCTestCaseProvider
forXCTestCase
subclasses on linux and insteadallTests
becomes a static computed property which you pass as param totestCase
method inXCTMain
. Something like this :
extension MyAwesomeTests {
static var allTests: [(String, MyAwesomeTests -> () throws -> Void)] {
return [
("testAnAwesomeThingy", testAnAwesomeThingy),
]
}
}
then in LinuxMain.swift
:
XCTMain([testCase(MyAwesomeTests.allTests)])
-
I refactored the init mode of swiftpm which can now generate both library and executable packages default being executable package.
$ swift build --init # same as `swift build --init executable` $ swift build --init library
-
I fixed the issue where
exclude
inPackage.swift
was not working for folders insidetests
directory. Now you can exclude tests or any of the subfolders.
import PackageDescription
let package = Package(
name: "FooPackage",
exclude: ["Tests/Fixtures"]
)
-
I added better error handling in
swift test
which will now suggest to runswift build
if someone forgets it before runningswift test
. Also if there is no test module thenswift test
now shows a nice one liner error. -
I improved
swift test
by adding-h
/--help
and eliminating the need of adding-XCTest
to pass arguments to it.
Internal swiftpm changes
-
Max Howell raised a PR which would give
bootstrap
script powers to parse swiftpm’sPackage.swift
so the targets don’t need to be duplicated inside the script 😍 -
I changed the
PackageDescription
module such that it would readPackage.swift
and write the TOML represention to a file if a fd is passed to it instead of dumping it on stdout. -
I refactored the
Build
module and created models for llbuild tools using protocols and protocol extension instead of subclassing which worked out great.