无法使用realm/Jazzy为测试项目生成文档

问题描述 投票:0回答:1

我一直在尝试为我们的单元和具有 cocoapods 的项目的 ui 测试生成文档。我创建了一个简单的项目来演示我的错误(粘贴在下面)。该项目的链接是 JazzyTest

我正在使用脚本来调用 jazzy,当为 app 子句运行脚本时,一切都按预期工作,并且文档在 JazzyTest/docs 文件夹中生成。然而,当我尝试对 JazzyTestTests 执行相同操作时,它失败了,而日志显示构建已成功(也链接在下面)。

安装版本:

$ jazzy -v
jazzy version: 0.15.1

我正在采取的步骤如下:

  1. 将存储库克隆到新目录
  2. cd JazzyTest
  3. pod install
  4. cd ..
  5. ./generateDocs.sh app
    <- To verify it's all good
  6. ./generateDocs.sh ui
    <- Problem occurs at this step

感谢您的宝贵时间!

xcodebuild 目标/方案输出:

$ xcodebuild -workspace JazzyTest.xcworkspace -list
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace JazzyTest.xcworkspace -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Information about workspace "JazzyTest":
    Schemes:
        CoreBluetoothMock
        CoreBluetoothMock-PrivacyInfo
        JazzyTest
        MSAL
        MSAL-MSAL
        Pods-Apps-JazzyTest
        Pods-Apps-JazzyTest-JazzyTestTests
        Pods-Apps-JazzyTestUITests

控制台错误:

/Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/executable.rb:39:in `execute_command': /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/bin/sourcekitten ["doc", "--module-name", "JazzyTestTests", "--", "-workspace", "JazzyTest.xcworkspace", "-scheme", "JazzyTest", "-destination\\=platform\\=ios\\ simulator", "name\\=iPad\\ \\(9th\\ generation\\)"] (RuntimeError)

2024-08-01 11:49:38.890 xcodebuild[39479:3252048]  DVTPlugInQuery: Requested but did not find extension point with identifier 'Xcode.InterfaceBuilderBuildSupport.PlatformDefinition'. This is programmer error; code should only request extension points that are defined by itself or its dependencies.

Running xcodebuild

Checking xcodebuild -showBuildSettings

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/0t/m6b2x0tj5rsfxvr3_3fxvb1m0000gn/T/xcodebuild-F8463AF5-18A0-40E6-844C-148A05D4177E.log

Error: Failed to generate documentation

    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/sourcekitten.rb:229:in `run_sourcekitten'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:83:in `block (2 levels) in build'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:81:in `chdir'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:81:in `block in build'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:71:in `map'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/lib/jazzy/doc_builder.rb:71:in `build'
    from /Users/user/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/jazzy-0.15.1/bin/jazzy:16:in `<top (required)>'
    from /Users/user/.rbenv/versions/3.3.1/bin/jazzy:25:in `load'
    from /Users/user/.rbenv/versions/3.3.1/bin/jazzy:25:in `<main>'

这是日志文件的链接

swift xcode cocoapods xcodebuild jazzy
1个回答
0
投票

Xcode 添加了“构建测试”选项,此选项是构建测试项目以使 jazzy 能够生成文档的关键。我必须更新

build-tool-arguments
并添加
build-for-testing
。添加该标志后,jazzy 就能够使用测试模块来为其生成文档。

此外,如果您使用

test
标志,这将按照本期中所述的方式工作:为所有模块生成文档,包括测试文档 #504,但是,这将导致在文档生成期间执行测试。

所以爵士乐的调用来自:

jazzy \
    --author "Micro-Leads Inc" \
    --author_url https://www.micro-leads.com/ \
    --github_url https://www.github.com/ \
    --min-acl private \
    --build-tool-arguments -workspace,JazzyTest.xcworkspace,-scheme,JazzyTest,-destination='platform=ios simulator' \
    --module JazzyTestTests \
    --output docTests

至:

jazzy \
    --author "Micro-Leads Inc" \
    --author_url https://www.micro-leads.com/ \
    --github_url https://www.github.com/ \
    --min-acl private \
    --build-tool-arguments -workspace,JazzyTest.xcworkspace,-scheme,JazzyTest,-destination='platform=ios simulator',build-for-testing \
    --module JazzyTestTests \
    --output docTests
© www.soinside.com 2019 - 2024. All rights reserved.