DevB1
DevB1

Reputation: 1565

Swift: Jazzy failing to run xcodebuild

I'm trying to generate some documentation for. my project using Jazzy. However, when I run jazzy from the command line I'm getting the following output:

Could not successfully run `xcodebuild`.
Please check the build arguments.
Saved `xcodebuild` log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log
Failed to generate documentation
Traceback (most recent call last):
    7: from /usr/local/bin/jazzy:23:in `<main>'
    6: from /usr/local/bin/jazzy:23:in `load'
    5: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/bin/jazzy:15:in `<top (required)>'
    4: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `build'
    3: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:79:in `chdir'
    2: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/doc_builder.rb:81:in `block in build'
    1: from /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/sourcekitten.rb:266:in `run_sourcekitten'
/usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/lib/jazzy/executable.rb:36:in `execute_command': /usr/local/lib/ruby/gems/2.7.0/gems/jazzy-0.13.6/bin/sourcekitten ["doc", "--"] (RuntimeError)

Running xcodebuild

Could not successfully run `xcodebuild`.

Please check the build arguments.

Saved `xcodebuild` log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log

Failed to generate documentation

Why is this failing to run when from xcode my project build with no issues

Upvotes: 1

Views: 2527

Answers (4)

jawad
jawad

Reputation: 825

It worked with me! after removing ALL project source code files and clone the repo again! :)

Upvotes: 0

Raphael
Raphael

Reputation: 3051

Typically, one of two things go wrong when running Jazzy for the first time. Either you did not set xcodebuild to use the full Xcode app instead of the pure command line tools or you forgot to specify the workspace or scheme in the parameters. This is particularly the case when using Cocoapods or if you have multiple schemes.

With at minimum these parameters, Jazzy should run in most cases:

cd yourAppDirectory # the one with the xcodeproj / xcworkspace in it
jazzy --clean --author "Johnny Appleseed" --author_url https://siriuscybernetics.com -x -workspace,DemoApp.xcworkspace,-scheme,DemoAppScheme

Also consider that that there may be incompatibilities with Apple Silicon / M1 for a while still, such as this Bus Error topic.

Upvotes: 0

Jonathan Garc&#237;a
Jonathan Garc&#237;a

Reputation: 1353

You can review the content of

log file: /var/folders/nd/t1rlxsp94kgbll0v834jnc0h0000gp/T/xcodebuild-84D58051-E84E-40D8-A4E7-E080B83D7117.log

for to obtain details the error

Upvotes: 0

RobLabs
RobLabs

Reputation: 2347

Jazzy requires a build from the command line to generate the documentation. So you need a command similar to:

jazzy --build-tool-arguments -workspace,ios.xcworkspace,-scheme,iosapp

From https://github.com/realm/jazzy

...try passing extra arguments to xcodebuild, for example jazzy --build-tool-arguments -scheme,MyScheme,-target,MyTarget


How to find your schemes and targets to pass into xcodebuild from Jazzy

Be sure to cd to the directory where your Xcode Workspace or Xcode Project is: cd path/to/ios.xcworkspace

xcodebuild -version

# online help
man xcodebuild

# List schemes & targets
xcodebuild -list

Results for a sample Xcode Workspace,

Information about project "ios":
    Targets:
        iosapp
        bench
        dynamic
        static
        bundle
        test
        integration
        Integration Test Harness

    Build Configurations:
        Debug
        Release
        RelWithDebInfo

    If no build configuration is specified and -scheme is not passed then "RelWithDebInfo" is used.

    Schemes:
        bench
        bundle
        CI
        dynamic
        dynamic+static
        Integration Test Harness
        iosapp
        static

Upvotes: 4

Related Questions