Can I use Swift Lexer as a liibrary?

Hello, friends.

I want to integrate Swift into clang-format. Yes, I do want to do that.

From what I have learned from the Swift repository, it does not povide a library the way clang does, instead, it provides mature solutions like sourceKit, swift compiler target itself, lib_internalSwiftParse etc.

What I want is
1 - compile a compatible version of llvm, with its clang-format tool
2 - use the Swift lexer to lex a source file.
3 (done) - convert the Swift lexemes to internal representation compatible with clang.
4 - rework the logic of llvm's clang-format to work with Swift tokens too.

Any help? I think all I need is a library type of target. I just want to use the Lexer class, and a couple of Basic/* classes like (SourceManager).

Alright I did what I wanted.
There are libraries of all kinds inside lib/ directory after one builds the project.