Open source contribution

I was trying to fix this issue Since DocC now ships in toolchains, adjust scripts/docs/generate... to not have to download/build docc · Issue #856 · apple/swift-distributed-actors · GitHub .
I cloned the file and changed the toolchains to swift development snapshot 2021-11-20. I also downloaded the open source toolchain. I have got my compiler upgraded to 5.6 and I have swift version 5.5.1
I am getting 2 errors while trying to build the package because my compiler and swift are of different version.
I think for accessing docc from toolchains, will need to write " export
TOOLCHAIN=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-11-20
a.xctoolchain/docc
Still not sure if this will work.

It will be helpful if I get some guidance for learning how to contribute.

Whenever I try to build it, it shows me this dialog box of not having any scheme. And whenever I try to open package resolution log, nothing opens.

Another question, why does the zip files that are mentioned in the releases section different form the files we clone directly from a repository.

I think I am missing a lot out on packages and really want to get my hands dirty with toolchains, packages, dependancy injection. In short devlopment tools.

Recently figured out that all this topics comes under in source kit LSP. Not sure. Please confirm. Also, are there any resources to learn SourceKit-LSP. It looks interesting. Gotta try it out.

Hi Shilpee, (sorry for the typo in your name, edited)
Thanks for helping out here;

I'll preface this with a note that this isn't the easiest to start out your open source contribution journey, because of how the nightly toolchains and various versions are in-flight and not always well aligned.

First things first:

  • Current releases of Xcode won't be able to edit this project.
    • This is documented in the project's readme.
    • We need Xcode to become aware of Swift 5.6 and that has not happened yet. This isn't something we can impact or fix from the open source side of things, as it depends on the usual Xcode release cycle etc.
    • You can use some other text editor or other IDE (CLion works well).
  • You'll have to rely on the command line for working on this project.

Not quite; The toolchain is the toolchain; Don't change that, so it would be:

-> % export TOOLCHAIN=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-11-20-a.xctoolchain

-> % $TOOLCHAIN/usr/bin/docc
OVERVIEW: Documentation Compiler: compile, analyze, and preview documentation.

The ticket you mention basically boils down to removing all the code which is downloading and building docc from source from this file: https://github.com/apple/swift-distributed-actors/blob/main/scripts/docs/generate_docc.sh and using the $TOOLCHAIN/docc instead, that's about it. (Find the comment that says "Prepare and build docc"). If you'd be able to get that done then as soon as we fix the build for the 2021-11-xx toolchains we could merge the improvement, thanks!

Right now the latest nightly toolchain is out of sync with the language features the project is expecting, so the build using a 2021-11-20 toolchain will fail to compile... We focused on getting new language implemented and need to update this repository now -- this is why I mention this is a hard project to contribute to right now because the Swift language it depends on is actively changing in nightly releases. This is also explained in the project's README.

3 Likes

They're not different, they're just previous releases - as signified by the version numbers. The current milestone we're developing towards is 0.10.x and the releases are 0.6.x which predate the distributed actor language feature.

You should not need to refer to anything from the 0.6.x release timeline.

Thank you so much for your detailed response.

I installed the swift plugin, changed the toolchain to development snapshot and resolved dependancies. However I am getting 2 build errors.

For the first error, I need to add run/debug configuration. I read the package.swift file and there are many targets i.e. DistributedActors, executable targets and test targets as well. Which one do I need to add as target in the run configuration. What will be the executable for adding configuration. What other changes do I need to do in the run/debug configuration dialog box.

For the second error, I didn't get anything on the internet. It will be helpful if you can tell more about it

Well, I still dont know what exactly is hard and easy in the server side swift so will give it a try, will surely get stuck​:sweat_smile: and hopefully will manage to fix it under some guidance. :innocent:

Its Shilpee.:slightly_smiling_face:

Hi Shilpee, sorry for mistaking your name, fixed.

The steps to set up CLion are explained in: Are there notes (or docs) on how to use a nightly development snapshot with projects (swift-distributed-actors)? where you also posted, please don't post the same question in two threads, it gets hard to follow discussions this way. You need to follow the steps Moritz outlined here: Are there notes (or docs) on how to use a nightly development snapshot with projects (swift-distributed-actors)? - #3 by slashmo I'll reply there as well...

Again though, you don't really need any IDE to make the change suggested, it's not even a Swift change but only in shell scripts.

I understand and am happy for your willingness to help out. I'm letting you know though that this is a tricky project to contribute to right now, because the swift language itself this project requires is constantly changing and not final, so it has all kinds of issues like what you're experiencing right now that are beyond our control (lack of IDE support, and even once you import, valid code will show up as incorrect in the IDE, since the IDEs don't know about the new language yet).

Apologies for asking on multiple threads. Will be more careful and patient from next time.

Okay, understood. Thanks a ton!

I am slightly confused whether it should be in TOOLCHAIN/usr/bin/docc or in TOOLCHAIN/docc

You need to find the docc binary, so you can check for this yourself really, like this:

ktoso@stratos [20:07:12] [~/code/swift-distributed-actors] [main *]
-> % ls $TOOLCHAIN
Developer      Info.plist     System         _CodeSignature usr
ktoso@stratos [21:55:29] [~/code/swift-distributed-actors] [main *]
-> % ls $TOOLCHAIN/usr
bin     include lib     libexec local   share
ktoso@stratos [21:55:34] [~/code/swift-distributed-actors] [main *]
-> % ls $TOOLCHAIN/usr/bin
clang                      clangd                     llvm-profdata              swift-api-digester         swift-demangle             swift-package-collection   swiftc
clang++                    docc                       sdk-module-lists           swift-api-extract          swift-driver               swift-run
clang-10                   dsymutil                   sourcekit-lsp              swift-build                swift-frontend             swift-stdlib-tool
clang-cl                   lldb                       swift                      swift-build-sdk-interfaces swift-help                 swift-symbolgraph-extract
clang-cpp                  llvm-cov                   swift-api-checker.py       swift-build-tool           swift-package              swift-test
ktoso@stratos [21:55:39] [~/code/swift-distributed-actors] [main *]
-> % ls $TOOLCHAIN/usr/bin/docc
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-11-20-a.xctoolchain/usr/bin/docc