rubyxcodexcodebuildswift2jazzy

Jazzy Unable to find an Xcode with swift version 2.2. (RuntimeError): Xcode7.3


We are trying to generate the documents for Swift2.2 using Jazzy with Xcode7.3. We have 2 environments: Local dev environment (Macbook) and Server machine for central build.

We have exactly same set up in both machine like Xcode,CommandLine tools,Ruby but in server Jazzy fails with the below error:

jazzy-0.5.0/lib/jazzy/sourcekitten.rb:137:in `run_sourcekitten': Unable to find an Xcode with swift version 2.2. (RuntimeError)
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:57:in `block in build'
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `chdir'
from .../gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `build'
from .../gems/jazzy-0.5.0/bin/jazzy:15:in `<top (required)>'
from .../jazzy/bin/jazzy:23:in `load'
from .../jazzy/bin/jazzy:23:in `<main>'

Many people suggested to use the --swift-version 2.2 but this didn't work for me.. :(

Do we need to send any additional parameters to get rid of this error..?


Solution

  • The problem was caused by the fact that jazzy relies on the spotlight indexing service of OS X in order to find an Xcode instance with the proper Swift version. Since this service is disabled on the build server it was failed to find any Xcode instance.

    We can't guarantee the enable of spotlight in build servers and we need to make sure that jazzy works even if spotlight is disabled. Luckily, a new version of jazzy (0.6.1) that fixes the problem. This version uses the currently selected Xcode (xcode-select command) if there is no swift version explicitly specified (https://github.com/realm/jazzy/pull/560).

    We need to make sure that there is either only one version of Xcode installed or that the right Xcode version (with the proper swift version) is selected.