Is it possible to dump the AST while building an Xcode project? : <p>I've been doing some work on analyzing Swift projects using their ASTs, and I would like to know if it is possible to generate it somehow when building a Swift project with Xcode.</p>

<p>Right now, I am able to print the AST on the terminal when running the <code>swiftc -dump-ast</code> command for single files and simple projects. However, it becomes harder when using it for more complex projects. </p>

<p>For this reason, I'd like to use xcode. I already tried to pass the <code>-dump-ast</code> flag to the compiler in Build Settings > Swift Compiler - Custom Flags > Other Swift Flags. The flag was indeed passed to the compiler (the output does report calling swiftc with the -dump-ast flag when building). I tried to build the project both with xcode and through the <code>xcodebuild</code>command below, but neither dumped the ast. </p>

<pre><code>xcodebuild -target 'CompilingTest.xcodeproj' -scheme 'CompilingTest' -
configuration "Debug" -sdk iphoneos -arch "armv7" 
CONFIGURATION_BUILD_DIR="TestBuild" ONLY_ACTIVE_ARCH=NO
</code></pre>

<p>Now, I'm reasoning that either Xcode's build process redirects swiftc's output to some file, or it silences it somehow. Any thoughts?</p>

<p>Any help would be greatly appreciated.</p>
