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

Error generating documentation: Could not find SPM module #1381

Closed
sbooth opened this issue Apr 1, 2024 · 3 comments
Closed

Error generating documentation: Could not find SPM module #1381

sbooth opened this issue Apr 1, 2024 · 3 comments

Comments

@sbooth
Copy link

sbooth commented Apr 1, 2024

Thank you for this project!

I'm having trouble getting jazzy to generate documentation for my SPM-based library. Here is an example to reproduce the issue using a vanilla Swift package:

% sw_vers 
ProductName:		macOS
ProductVersion:		14.4.1
BuildVersion:		23E224
% ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]
% jazzy -v
jazzy version: 0.14.4
% mkdir SwiftPackage
% cd SwiftPackage 
% swift package init
Creating library package: SwiftPackage
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/SwiftPackage/SwiftPackage.swift
Creating Tests/
Creating Tests/SwiftPackageTests/
Creating Tests/SwiftPackageTests/SwiftPackageTests.swift
% swift build
Building for debugging...
[4/4] Compiling SwiftPackage SwiftPackage.swift
Build complete! (1.34s)
% jazzy
Running swift build
Could not find SPM module '(any)'. Here are the modules available:

Error: Failed to generate documentation
/*/.gem/gems/jazzy-0.14.4/lib/jazzy/executable.rb:39:in `execute_command': /*/.gem/gems/jazzy-0.14.4/bin/sourcekitten ["doc", "--spm", "--"] (RuntimeError)

Running swift build

Could not find SPM module '(any)'. Here are the modules available:



Error: Failed to generate documentation

	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/sourcekitten.rb:269:in `run_sourcekitten'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:82:in `block in build'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:80:in `chdir'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:80:in `build'
	from /*/.gem/gems/jazzy-0.14.4/bin/jazzy:16:in `<top (required)>'
	from /*/.gem/bin/jazzy:25:in `load'
	from /*/.gem/bin/jazzy:25:in `<main>'

I also tried

% jazzy -m SwiftPackage
Running swift build
Could not find SPM module 'SwiftPackage'. Here are the modules available:

Error: Failed to generate documentation
/*/.gem/gems/jazzy-0.14.4/lib/jazzy/executable.rb:39:in `execute_command': /*/.gem/gems/jazzy-0.14.4/bin/sourcekitten ["doc", "--spm", "--module-name", "SwiftPackage", "--"] (RuntimeError)

Running swift build

Could not find SPM module 'SwiftPackage'. Here are the modules available:



Error: Failed to generate documentation

	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/sourcekitten.rb:269:in `run_sourcekitten'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:82:in `block in build'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:80:in `chdir'
	from /*/.gem/gems/jazzy-0.14.4/lib/jazzy/doc_builder.rb:80:in `build'
	from /*/.gem/gems/jazzy-0.14.4/bin/jazzy:16:in `<top (required)>'
	from /*/.gem/bin/jazzy:25:in `load'
	from /*/.gem/bin/jazzy:25:in `<main>'

with similar results. I also tried invoking sourcekitten directly to try and narrow things down but wasn't able to get it working.

The only custom ruby-related setup I have are the following lines in .zshrc:

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
@johnfairh
Copy link
Collaborator

Are you maybe using Xcode 15.3 / Swift 5.10?

Jazzy (sourcekitten) doesn't support that yet due to incompatible changes in SwiftPM. Fixes are backed up behind Github actions supporting Xcode 15.3 - should be soon.

@sbooth
Copy link
Author

sbooth commented Apr 1, 2024

Yes, that would appear to be the problem.

% swift --version
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: x86_64-apple-macosx14.0

Hopefully GitHub will implement Xcode 15.3 support soon. 🤞

@johnfairh
Copy link
Collaborator

Finally fixed & released in 0.15.0.

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

No branches or pull requests

2 participants