jazzy icon indicating copy to clipboard operation
jazzy copied to clipboard

Cannot use --swift-version with swift.org toolchain

Open ianpartridge opened this issue 8 years ago • 16 comments

$ jazzy --swift-version DEVELOPMENT-SNAPSHOT-2016-06-06-a
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:164:in `block in <class:Config>': jazzy only supports Swift 2.0 or later. (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:36:in `instance_exec'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:36:in `set'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:55:in `block in attach_to_option_parser'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1364:in `call'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1364:in `block in parse_in_order'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1351:in `catch'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1351:in `parse_in_order'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1345:in `order!'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1437:in `permute!'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb:1459:in `parse!'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:368:in `parse_command_line'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/config.rb:326:in `parse!'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'

However, this does work:

$ TOOLCHAIN_DIR=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-06-06-a.xctoolchain jazzy

I would like to be able to use a swift.org toolchain with --swift-version, or swift_version: in .jazzy.yml

ianpartridge avatar Jul 13 '16 12:07 ianpartridge

@ianpartridge what's the output of swift -version using the custom toolchain via xcrun?

segiddins avatar Jul 14 '16 03:07 segiddins

$ xcrun --toolchain org.swift.3020160606a swift -version
Apple Swift version 3.0-dev (LLVM cb08d1dbbd, Clang 383859a9c4, Swift 9e8266aaeb)
Target: x86_64-apple-macosx10.9

ianpartridge avatar Jul 14 '16 08:07 ianpartridge

So if you specify 3.0-dev as your swift version, does that work?

segiddins avatar Jul 14 '16 14:07 segiddins

No.

$ jazzy --swift-version 3.0-dev
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/version.rb:191:in `initialize': Malformed version number string 3.0-dev (ArgumentError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/version.rb:182:in `new'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/version.rb:182:in `create'
    from /Library/Ruby/Gems/2.0.0/gems/xcinvoke-0.2.1/lib/xcinvoke/xcode.rb:52:in `find_swift_version'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/sourcekitten.rb:139:in `run_sourcekitten'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/doc_builder.rb:64:in `block in build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/doc_builder.rb:62:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/lib/jazzy/doc_builder.rb:62:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.0/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'

ianpartridge avatar Jul 14 '16 14:07 ianpartridge

https://github.com/segiddins/xcinvoke/pull/5 might help with this

segiddins avatar Jul 16 '16 01:07 segiddins

I recommend using TOOLCHAIN_DIR for now.

jpsim avatar Jul 18 '16 18:07 jpsim

From my understanding, this isn't a problem with Jazzy? Can we close this?

pigeon-archive avatar Nov 23 '16 22:11 pigeon-archive

This is a problem with jazzy because it's a problem with one of jazzy's dependencies (xcinvoke).

jpsim avatar Nov 26 '16 06:11 jpsim

Didn't realize xcinvoke was open source. Definitely. I'll add it to my list of items to get around to at some point. We can file an issue/PR on that repository so we can get it closed here. 😸

pigeon-archive avatar Nov 26 '16 06:11 pigeon-archive

There's already a PR segiddins/xcinvoke#5. However, since jazzy is and will be affected not only until that PR is merged and released, but until we adopt it in our Gemfile, we're better off keeping this issue open

jpsim avatar Nov 26 '16 06:11 jpsim

Sounds good!

pigeon-archive avatar Nov 26 '16 06:11 pigeon-archive

Help reviewing that PR would definitely make getting it merged/released go faster ;)

segiddins avatar Nov 27 '16 16:11 segiddins

@segiddins @pcantrell is this supported with xcinvoke 0.3.0?

jpsim avatar Dec 01 '16 19:12 jpsim

Nope, still haven't gotten review on the alternate toolchain PR

segiddins avatar Dec 01 '16 19:12 segiddins

I wasn't even aware there was such a PR. I'll take a look.

jpsim avatar Dec 01 '16 20:12 jpsim

Heh, actually my comment above indicates that I was aware of it, I just forgot.

jpsim avatar Dec 01 '16 20:12 jpsim

Closing this now, docs suggest using DEVELOPER_DIR for this kind of scenario.

johnfairh avatar Nov 20 '22 09:11 johnfairh