And here's the most problematic part: βAdd a scheme for the target. In the drop-down menu, be careful not to mistake your target for a similar one that belongs to a generated Xcode project.β Which scheme and for which target should I add ?
And that after step 6 I have to build. How to make edits in the resulting project if there are only CMakeLists files
How to complete step 6 and whether I am doing everything right before that. And what to do after step 6 ? Where are the sources themselves?)
The Arguments for your Target (Test) settings should be bin/swift-frontend if you're building the swift compiler. This is the executable at Ninja-*/swift-macosx- */bin/swift-frontend.
For your new scheme, your target should be the target that you created for the Test project. I think the instructions intend to warn you to not accidentally select one of the options that were generated during "Automatically Create Schemes" and the wording could definitely make that clearer.
Ah, great! Moving this thread over to the βDevelopmentβ category for clarity. There are also some past threads in that category which may be helpful, where people detail how they got things set up. As I recall, most donβt use the Xcode project.
@xwu Thank you very much, I probably searched badly, if there is an opportunity, please share the links where people build the project not through xcode
It depends on what you want to work on. For example, if you're working on the compiler frontend, then you should add/choose "swiftFrontend" or "swift-frontend".
Most likely what you need to edit can be found under "Swift Libraries", after you scroll past lots of CMake files. For example:
Other source (and header) files can be found under "Swift Executables", "SwiftModule"-prefixed groups, "SourceKit"-prefixed groups, "XPC Services", "Tests", and maybe some other groups.
There are some gyb'd files not generated for the Xcode build, e.g. Attr.def. For those files, you can just drag them from the Ninja build into the Xcode project.
I can say from my personal experience that it was quite a puzzle to find the source files in Xcode when I first built the project 2(?) years ago. Is there a way to have CMake hide some targets in the generated project? Although, this looks like something that needs changes/improvements from CMake itself first (relavent CMake issue: Proposal: Target property to indicate IDEs shouldn't show it (#23566) Β· Issues Β· CMake / CMake Β· GitLab).
You can continue to build and run your custom scheme after you make changes to the codebase. You do not need recompile target "swift-frontend" in Xcode as building and running will do this for you.
It is recommended to use the ninja with Xcode setup to edit code and then run tests with ninja on the command line. To run individual tests, you should check out the Running Tests section. There is a script for running individual tests and for running the entire testsuite. After you make changes in Xcode, before running tests, you will need to rebuild the compiler.
If I understood correctly, you're trying to figure out how to test valid Swift code using your Ninja on Xcode build? You can create a test.swift file anywhere on your computer and then add its path name to your target's run arguments.
Then you can run it with the appropriate flags to check your test code. For example, you could use -debug-constraints and/or -typecheck to check if there is a type checker error with your test code. If you want to continue using Xcode instead of the command line, you can add these to your target's run arguments as well.
I figured out how to make the target runnable, I just didn't understand at first which panel I was talking about in documentation and where to set the settings.
It seems that now everything starts and something appears in the logs. But I still don't understand why I don't see the print result and why compiler doesn't see my functions/properties ?
The console shows a compilation error. What do you mean by "the compiler does not see my functions"? Swift is a compiled language, not an interpreted language like Python; a compilation error interrupts the compilation process and thus prevents any execution.