jazzy: Add support for Jazzy for code where a Xcode project doesn't exist
I have a Swift project that is not a Xcode project, it is a RemObjects Fire project - https://github.com/loretoparisi/swift-promise-example.
If I try to run jazzy from the sources folder src/
(that is here: https://github.com/loretoparisi/swift-promise-example/tree/master/StaticLibrary/SharedProject/src ) I get an error that I suppose is due to the fact that this is not a Xcode project:
Running xcodebuild
Could not parse compiler arguments from `xcodebuild` output.
Please confirm that `xcodebuild` is building a Swift module.
Saved `xcodebuild` log file: /var/folders/mm/qbx_84b57sgf_f9j0cxmj__r0000gn/T/xcodebuild-FAD08B0F-059E-415B-968E-D4074BD7D21D.log
Failed to generate documentation
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/sourcekitten.rb:140:in `run_sourcekitten'
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:57:in `block in build'
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `build'
from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/bin/jazzy:15:in `<top (required)>'
from /usr/bin/jazzy:23:in `load'
from /usr/bin/jazzy:23:in `<main>
So is it possibile to run jazzy for non Xcode projects?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 23 (9 by maintainers)
This would be a great feature as I have a framework with no Xcode project.
Converting this issue from a question to a feature request since I agree with @kylebrowning. That would be a cool feature, especially with SPM and non-Xcode proj Swift code.
If your project supports the Swift Package Manager, you don’t need an Xcode project to generate docs for it. For example:
Which generates this: https://static.realm.io/jazzy_demo/Vapor
At some point, I’ll build a more direct way to do this with a single command using jazzy.
But right now, it’s not too complicated, just three commands:
swift build
,sourcekitten doc
,jazzy
.@cianiandreadev, there is still no progress towards Linux support within the Jazzy project itself—Jazzy is built on top of Xcode.
However, if…
…then Workspace can be easily set up with Travis CI to run Jazzy remotely and push the documentation to a
gh‐pages
branch. (You can pull that branch to copy the documentation elsewhere too.) Here is an example of a project that does it this way.In this manner Jazzy can be used even if all you have locally are Linux machines.
I’m not familiar with RemObjects Fire, but I use jazzy with the Swift Package Manager.
Making a different type of project look enough like a package to let the Swift Package Manager generate the Xcode project may be relatively simple. Try something like this as a bare‐bones starting point:
With real paths, the above script is already sufficient to run jazzy, provided the project contains only
.swift
files . You may need to tailor the script for details like the module name or to remove any filetypes the Swift Package Manager does not understand.I wrote it in shell so it is fast to try, but the script can also be re‐writen in whatever language you like (Jazzy is in Ruby). Once you get it working for your project, if you decide to modify it to be widely‐applicable and no longer hard coded for your particular project, you can submit a pull request.
I suspect the simplest way to integrate this into Jazzy itself would be a Jazzy configuration option (something like
not_an_xcode_project
) that causes the before and after sections of the above script (converted to Ruby) to run near the beginning and end of Jazzy’s execution.Note: All this still assumes Xcode itself is present on the system. Making Jazzy work without it would be tantamount to starting Jazzy over from scratch. Ergo, Jazzy will never run on Linux.