Current state • Currently builds static libraries or binaries • Supported platforms are OS X and Ubuntu Linux • Only builds Swift code, no C/C++/Objective-C/...
$ swift build --help OVERVIEW: Build sources into binary products USAGE: swift build [options] MODES: --configuration Build with configuration (debug|release) [-c] --clean Delete all build intermediaries and products [-k] OPTIONS: --chdir Change working directory before any other operation [-C] -v Increase verbosity of informational output
Spectre describe("a person") { let person = Person(name: "Kyle") $0.it("has a name") { try expect(person.name) == "Kyle" } $0.it("returns the name as description") { try expect(person.description) == "Kyle" } }
$ make test swift build ./.build/debug/spectre-build -> Converting dates to strings -> can convert NSDate to an ISO8601 GMT string -> Parsing of localtime dates -> can parse dates -> can parse dates with negative timezone offsets -> can parse timezone offsets without colons -> Parsing of UTC dates -> can parse dates -> can parse epoch -> can parse dates without seconds -> is resilient against Y2K bugs 8 passes and 0 failures
Foundation is incomplete and sometimes different from OS X: #if os(Linux) let index = p.startIndex.distanceTo(p.startIndex.successor()) path = NSString(string: p).substringFromIndex(index) #else path = p.substringFromIndex(p.startIndex.successor()) #endif
Some things in the standard library might not be available: #if _runtime(_ObjC) // Excluded due to use of dynamic casting and Builtin.autorelease, neither // of which correctly work without the ObjC Runtime right now. // See rdar://problem/18801510 [...] public func getVaList(args: [CVarArgType]) -> CVaListPointer {
OS X libc and Glibc can differ: let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK if system_glob(cPattern, flags, nil, >) == 0 { #if os(Linux) let matchc = gt.gl_pathc #else let matchc = gt.gl_matchc #endif
And other random fun: ./.build/debug/spectre-build /usr/bin/ld: .build/debug/Clock.a(ISO8601Parser.swift.o): undefined reference to symbol '_swift_FORCE_LOAD_$_swiftGlibc' /home/travis/.swiftenv/versions/swift-2.2-SNAPSHOT-2015-12-22-a/ usr/lib/swift/linux/libswiftGlibc.so: error adding symbols: DSO missing from command line clang: error: linker command failed with exit code 1 (use -v to see invocation)
Rough build process • PackageDescription generates TOML • dep parses the TOML and can generate YAML • Dependencies are fetched by swift-get • YAML is used as input to llbuild • swift-build calls out to llbuild
CocoaPods • Centralized discovery • Xcode integration • Support for other languages • Additional metadata in the Manifest • Does not cover the build process