[swift-dev] New to building Swift toolchain
Michael Gottesman
mgottesman at apple.com
Mon Sep 18 13:58:53 CDT 2017
> On Sep 18, 2017, at 8:54 AM, Maksym Grebenets via swift-dev <swift-dev at swift.org> wrote:
>
> Hi all
>
> I guess like many other iOS devs with c/c++ background I really wanted to get into Swift development one day, at least a tiny bit, at least to understand how things work.
>
> So new refactoring tools and starter tasks finally pulled me in.
>
> With a lot of struggle and a lot of help from community I was able to understand how lit works, how to walk the AST and write changes back to the editor. I've got code and tests for new refactoring kind and new refactoring action, so I was like "yay, time to build the keychain and just try it in Xcode!!!".
>
> That's where I was thrown back to the "what do I do?" state again...
>
> I pulled latest master branch and ran build-toolchain and all of that just to be told after almost an hour or so that there are 3 failing tests...
What were the failing tests?
>
> So I thought:
>
> cd swift
> git checkout swift-DEVELOPMENT-SNAPSHOT-2017-09-15-a
> cd ..
> ./swift/utils/update-checkout --tag swift-DEVELOPMENT-SNAPSHOT-2017-09-15-a
>
> then build and fail again :(...
So you are saying that you took the last "known good snapshot" and that also failed. How did it fail? On the same 3 tests?
>
> OK then, so I just disable the tests and give it another go:
>
> # build-presets.ini
> #test
> #validation-test
> #long-test
>
> Yay! I got a toolchain!
> I copy it over to /Library/Developer/Toolchains/
> Select it in Xcode (latest Xcode 9 GM) and... no luck
> The source code highlighting disappears,
> I get "An internal error occurred. Source editor functionality is limited..." error.
> All of the refactoring actions are disabled.
>
> I guess those 3 failing tests did matter in the end...
>
>
> I may be frustrated, because I don't understand what's going on, but I don't feel like giving up.
>
> I'd appreciate any help or advice I can get!
>
> Should I choose an older tag from before to get all tests passing?
Do you mean before the last known good snapshot? If a snapshot was published on swift.org <http://swift.org/>, it /should/ pass all of the tests.
> Should I build using Xcode beta rather then GM?
You should be using the Xcode beta. This can be seen either via the README.md under System Requirements for macOS [and don't worry I run into this issue sometimes as well = )]. It is also documented on the CI: https://ci.swift.org <https://ci.swift.org/> with a nice link.
> Is there any way to build/re-build the OS X toolchain any faster?
> Why does it take so long even if I just re-run same command again?
When you rerun is it not incremental? (I forgot TBH). In terms of the amount of work performed, build-toolchain command is intended to be used for producing snapshots and thus it has to be complete and include code for all platforms/etc. We could potentially have a preset that builds a toolchain only for 1 platform. I am not 100% sure if such a toolchain would work, but it should take significantly less time to build. Would that help?
> Where did I get it wrong so the toolchain doesn't really work with Xcode?
> Can I connect lldb to process that runs my lit tests?
>
> I'm sorry for having so many questions, but you can imagine there isn't a lot of information for newbies like me trying to get into Swift compiler development. Well, let's just say I couldn't find much :) I've just realized that this mail list is better option that StackOverflow about an hour ago :) Though, of course, I have read Brian Gesiak's posts and the swift.org <http://swift.org/> blog post on refactoring.
There are no bad questions or too many questions. Welcome to the dev-list = ).
>
> Just to sum up all of the above, how to I get to build local Xcode toolchain which I can plug in to Xcode and test?
Answer my questions above... I'll help you get across the finish line.
On another note, I noticed you mention starter tasks: keep in mind there are more starter tasks than have been documented. If you are interested in a specific area of the compiler and can not find starter tasks in this area, please feel free to send a nice email to this list. I am sure we can find /something/ ; ).
Michael
>
> Thank you!
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170918/7228634e/attachment.html>
More information about the swift-dev
mailing list