[swift-dev] Trying to use Swift libSyntax API. "Module compiled with Swift 4.1 cannot be imported in Swift 4.0.1"
gubikmic at gmail.com
Thu Oct 19 07:38:07 CDT 2017
What I missed was that you have to use the freshly built compiler to
compile your sample program using SwiftSyntax. (Thanks to Harlan for
pointing that out.)
Xcode won't work here (yet). After building swiftpm (`./utils/build-script
--release-debuginfo --swiftpm`) you can use it to create an executable
init --type executable
and then replace the main.swift with e.g. Harlan's example
It should find the SwiftSyntax.swiftmodule and the corresponding dylib
I hope this helps in case you want to try it.
What's worth noting is that if you want a json view of the available syntax
information you can simply run `path/to/your/freshly/built/*swiftc
-frontend -emit-syntax* Example.swift`
2017-10-16 15:06 GMT+02:00 Michael Gubik <gubikmic at gmail.com>:
> I'd like to try the Swift libSyntax API.
> I did a fresh clone and compiled with
> $ ./utils/build-script --release-debuginfo --xcode
> using Xcode 9 beta 2 (9B46).
> Now I'd like to try SwiftSyntax so I created a new Xcode project
> (TestLibSyntax) and copied these three files to a project folder
> Then in the Build Settings I set
> SWIFT_INCLUDE_PATHS = /Users/mmg/src/TestLibSyntax/Libraries
> And add a build phase to copy the .dylib to the Frameworks directory.
> Upon building this project the compiler now complains that
> Module compiled with Swift 4.1 cannot be imported in Swift 4.0.1:
> Is there a way to tell the compiler to build everything in this example
> project with Swift 4.1?
> Or, how to use the SwiftSyntax swiftmodule and dylib in a regular Xcode
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev