Building SwiftSyntax tool inside the toolchain

I have been able to build a functional swift refactoring tool using the instructions given in https://github.com/apple/swift/tree/master/lib/Syntax. This has been built using Xcode (as given by the instructions in the link). In order to be able to distribute the tool to other developers, it is easier if I can package the tool inside the locally maintained custom swift toolchain. The build system for swift seems quite complex. For example, if I want to put the Renamer refactoring file inside the toolchain,

a) Which directory is more appropriate? tools? utils?
b) How should the makefiles be updated to build the tool.
c) How can I ensure that the SyntaxRewriter and other SwiftSyntax libraries are properly referenced while building the tool?

If there are some examples for this, please let me know.

1 Like

Hi, sorry for the long delay in responding. We are aware of the complexity of building tools based on SwiftSyntax and we are looking towards making it easy for a swift package to depend and use SwiftSyntax. I have some more details here: Supporting SwiftSyntax on more targets - #15 by akyrtzi