Skip to content

Failure to produce offline documentation if you consume C++ libraries via Swift C++/Interop #63

@migueldeicaza

Description

@migueldeicaza

If you create a project that references a C++ library with the new swiftSettings: [.interoperabilityMode(.Cxx)]
mode in Package.swift, the system fails to generate symbols, which causes it to silently fail and produce
an incomplete documentation package.

Additionally, there is no warning issued, so you only find out about these problems much later on, from the
Web interface that merely produces an "Unknown error" message on the web.

This is new ground, I am using Xcode 15, beta 7, but the problem also happens with Xcode 15, beta 5.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected behavior

I have linked a simple repro here

Using this command should produce working documentation, in particular, you can tell if it worked because the directory /tmp/docs/documentation is present:

Clone the repro:

$ git clone https://github.com/migueldeicaza/SwiftDocCPlusPlusBug.git

When you run generate-documentation targeting /tmp/docs as the output directory:

$ swift package --allow-writing-to-directory /tmp/docs generate-documentation --target demo --disable-indexing --transform-for-static-hosting --hosting-base-path /SwiftNavigation --output-path /tmp/docs --diagnostic-level information

This should produce a directory in /tmp/docs/documentation and the symbols in .build/arm64-apple-macosx/extracted-symbols/demo/demo/demo.symbols.json

Actual behavior

Notice that /tmp/docs/documentation does not exist, and there is a warning:

/private/tmp/demo/Sources/demo/demo.docc/Documentation.md:1:3: warning: No symbol matched 'demo'. Can't resolve 'demo'.

Additionally the .build/arm64-apple-macosx/extracted-symbols/demo/demo directory is empty and lacks the demo.symbols.json

Steps to Reproduce

Small test case is here:

https://github.com/migueldeicaza/SwiftDocCPlusPlusBug

Instructions to reproduce the issue once cloned:

swift package --allow-writing-to-directory /tmp/docs generate-documentation --target demo --disable-indexing --transform-for-static-hosting --hosting-base-path /SwiftNavigation --output-path /tmp/docs --diagnostic-level information

Swift-DocC Plugin Version Information

Swift-DocC plugin version: 26ac575 (1.3.0)
Swift Compiler version: swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.106 clang-1500.0.40.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions