Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jazzy 0.7.2 crashes with "comparison of Array with Array failed" ArgumentError #661

Closed
emaloney opened this issue Sep 21, 2016 · 16 comments · Fixed by #686
Closed

Jazzy 0.7.2 crashes with "comparison of Array with Array failed" ArgumentError #661

emaloney opened this issue Sep 21, 2016 · 16 comments · Fixed by #686

Comments

@emaloney
Copy link

Hello,

I recently updated to Jazzy 0.7.2 and have tried using it to generate documentation for an Xcode 8 project containing Swift 2.3 code. All 578 source files in our project are parsed, but when Jazzy gets to the "building site" stage, Jazzy exits with code 1 and logs:

/Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `sort_by': comparison of Array with Array failed (ArgumentError)
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `map'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:112:in `build_site'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:151:in `build_docs_for_sourcekitten_output'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:75:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'
error: /usr/local/bin/jazzy failed with an exit code of 1; check any output above for additional details.

Prior to that, I get some USR warnings, eg.:

A compile error prevented CheckoutCountryViewModel.country from receiving a unique USR. Documentation may be incomplete. Please check for compile errors by running `xcodebuild `.

`viewControllerForRouter(router:destination:)` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.

Unfortunately, this is a closed-source project so I can't share the code publicly. But if there is anything I can do to help diagnose the issue further, please let me know.

Thanks!
E.

@aborren
Copy link

aborren commented Oct 12, 2016

`kUseProductionEnvironment` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.
building site
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `sort_by': comparison of Array with Array failed (ArgumentError)
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `map'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:112:in `build_site'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:151:in `build_docs_for_sourcekitten_output'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:75:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'

Encountering the same problem. kUseProductionEnvironment is indeed declared in an '#if' block. If I remove the '#if' block it generates fine.

@everlof
Copy link

everlof commented Oct 19, 2016

Can confirm that the same has occurred to me.

Saw:

/Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `sort_by': comparison of Array with Array failed (ArgumentError)
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `map'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:112:in `build_site'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:151:in `build_docs_for_sourcekitten_output'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:75:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.7.2/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'

Running:

  • macOS Sierra (10.12)
  • Xcode 8.0 (8A218a)

My workaround was to use 0.7.1.

@isair
Copy link

isair commented Nov 15, 2016

0.7.2 and 0.7.1 gave the same error for me, but 0.7.0 worked.

@pigeon-archive
Copy link
Contributor

A few questions before I get started on the issue:

  1. Has anyone been able to reproduce this constantly?
  2. Has anyone been able to locate where the source of the problem is?

Just in case someone hasn't updated us on their progres.

@kareman
Copy link

kareman commented Nov 23, 2016

Yes, I can reproduce the problem in this project: https://github.com/kareman/SwiftShell. This code has several #if blocks.
I get the following error message:

Running xcodebuild
Parsing Bash.swift (1/9)
Parsing Command.swift (2/9)
Parsing Context.swift (3/9)
Parsing String.swift (4/9)
Parsing FileHandle.swift (5/9)
Parsing Files.swift (6/9)
Parsing Stream.swift (7/9)
Parsing Array.swift (8/9)
Parsing Lazy-split.swift (9/9)
`nullDev` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.
building site
doc_builder.rb:35: in `sort_by': comparison of Array with Array failed (ArgumentError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `map'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:112:in `build_site'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:151:in `build_docs_for_sourcekitten_output'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:75:in `build'
	from /usr/local/lib/ruby/gems/2.3.0/gems/jazzy-0.7.2/bin/jazzy:15:in `<top (required)>'
	from /usr/local/bin/jazzy:23:in `load'
	from /usr/local/bin/jazzy:23:in `<main>'

@groue
Copy link

groue commented Nov 26, 2016

Same here:

comparison of Array with Array failed
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:35:in `sort_by'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:33:in `map'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:113:in `build_site'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:152:in `build_docs_for_sourcekitten_output'
/Users/cocoadocs/.rvm/gems/ruby-2.1.3/bundler/gems/Jazzy-7242435d5756/lib/jazzy/doc_builder.rb:76:in `build'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:443:in `document_spec'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:532:in `document_spec_at_path'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:152:in `block in doc'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:147:in `each'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:147:in `doc'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:219:in `block in cocoadocs_url'
/Users/cocoadocs/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/open-uri.rb:153:in `open_uri'
/Users/cocoadocs/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/open-uri.rb:704:in `open'
/Users/cocoadocs/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/open-uri.rb:34:in `open'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:216:in `cocoadocs_url'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:167:in `cocoadocs'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:102:in `initialize'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:564:in `new'
/Users/cocoadocs/cocoadocs.org/./cocoadocs.rb:564:in `<main>'

(output from http://api.cocoadocs.org:4567/error/GRDB.swift/0.90.1)

@groue
Copy link

groue commented Nov 26, 2016

The consequence of this bug are serious: some CocoaPods just don't have any online reference documentation anymore. No reference, and broken links from other documentation resources.

@groue
Copy link

groue commented Nov 26, 2016

This bug is a crasher. I advise that it is repriorized, and that the CocoaPods team is notified when it is fixed (@orta, @kylef, @segiddins)

@svdo
Copy link

svdo commented Nov 26, 2016

I have the same issue with my RichString CocoaPod. It has a few #if os(iOS) and #if os(macOS) in there. The commit where it started to fail is c21ab54fab4cb21b4e54e00884cf672a72be67d2. In that commit, I moved some of the platform-dependent code into one file, instead of having several files that only belonged to one target (and hence did not need a #if).

The output I'm getting from jazzy, is:

Using config file /path/to/projects/RichString/.jazzy.yaml
Running xcodebuild
Parsing RichString.swift (1/6)
Parsing NSAttributedString+Rich.swift (2/6)
Parsing Font_PlatformDependent.swift (3/6)
Parsing Color_PlatformDependent.swift (4/6)
Parsing NSAttributedStringOperators.swift (5/6)
Parsing String+Rich.swift (6/6)
Found conflicting type declarations with the same name, which may indicate a build issue or a bug in Jazzy: instance method fontSize(_:), instance method fontSize(_:)
`fontSize(_:)` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.
`fontSize(_:)` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.
`fontSize(_:)` has no USR. First make sure all modules used in your project have been imported. If all used modules are imported, please report this problem by filing an issue at https://github.com/realm/jazzy/issues along with your Xcode project. If this token is declared in an `#if` block, please ignore this message.
building site
/Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `sort_by': comparison of Array with Array failed (ArgumentError)
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:35:in `block in doc_structure_for_docs'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `map'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:33:in `doc_structure_for_docs'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:112:in `build_site'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:151:in `build_docs_for_sourcekitten_output'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/lib/jazzy/doc_builder.rb:75:in `build'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/gems/jazzy-0.7.2/bin/jazzy:15:in `<top (required)>'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/bin/jazzy:23:in `load'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/bin/jazzy:23:in `<main>'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/bin/ruby_executable_hooks:15:in `eval'
	from /Users/me/.rvm/gems/ruby-2.3.0@iosdev/bin/ruby_executable_hooks:15:in `<main>'

@jpsim
Copy link
Collaborator

jpsim commented Nov 26, 2016

@orta could this have happened after the recent changes to use swift_version from CP trunk?

@jpsim
Copy link
Collaborator

jpsim commented Nov 26, 2016

I could reproduce this by running jazzy in the root of https://github.com/svdo/swift-RichString. I'm looking into it.

@jpsim
Copy link
Collaborator

jpsim commented Nov 26, 2016

I could trace it back to 5802a19, which added a third sorting field (usr) but not all declarations have a USR (like when #if conditional compilation blocks are used). It's an easy fix.

jpsim added a commit that referenced this issue Nov 26, 2016
since usr isn't present in all declarations, we need to fall back on
something.

fixes #661.
@jpsim
Copy link
Collaborator

jpsim commented Nov 26, 2016

Fixed.

@svdo
Copy link

svdo commented Nov 27, 2016

That was quick, great job @jpsim!!

Any idea when this is going to be released? I assume @orta only uses released versions of Jazzy, and I'd love the docs for my pod to work again... :)

@segiddins
Copy link
Collaborator

@svdo orta typically has cocoadocs pointing to a commit of jazzy rather than a released version, so making a PR to https://github.com/CocoaPods/cocoadocs.org might be the fastest way to get this working ;)

@svdo
Copy link

svdo commented Nov 27, 2016

Done!
CocoaPods/cocoadocs.org#488

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants