SwiftCompilationDatabase

master

SwiftCompilationDatabase produces a CompilationDatabase from the Swift compiler.
jerrymarino/SwiftCompilationDatabase

SwiftCompilationDatabase

SwiftCompilationDatabase produces a compile_commands.json from the Swift compiler.

For tools, like iCompleteMe, that need to invoke the swift compiler outside of a build, JSONCompilationDatabase makes it easy to get all arguments for a file.

Usage

First, build from source

make

SwiftCompilationDatabase relies on the parseable output feature of Swift. Simply run the swift compiler with parseable output enabled ( -parseable-output ), and send the result to SwiftCompilationDatabase.

In practice, this means doing a clean build so all of the frontend invocations are recorded into the database.

swiftc main.swift -parseable-output 2>&1 | swift-compilation-database

SwiftPM / Swift Build

SwiftCompilationDatabase works great with SwiftPM and swift build.

Do a clean build and pipe results

swift build -v -Xswiftc -parseable-output --build-path .build-comp-db 2>&1 | swift-compilation-database

Xcode Usage

To make a compilation database from Xcode, I recommend checking out XcodeCompilationDatabase

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Oct 17 2024 15:06:29 GMT-0900 (Hawaii-Aleutian Daylight Time)