Open DerSeegler opened 3 years ago
You should check the rest of the log file: sourcekitten is saying that it doesn't contain a swiftc command to build the module [ProjectName]Test
.
First of all thanks for your quick answer, and sorry for my late response.
You are totally right. The command I posted doesn't build the test module. So I adapted the command to the following:
sourcekitten doc --module-name [ProjectName]Test -- -workspace [ProjectName].xcworkspace -scheme "[ProjectName] Dev" -destination id=F1BC1B0A-E7DE-4FF2-89C5-F0590305FAB8 clean test > swiftDoc.json
The log now ends with:
Result bundle written to path:
/Users/[user]/Library/Developer/Xcode/DerivedData/[ProjectName]-gndxzgdzvemytffwnupttgzjqyjm/Logs/Test/Run-[ProjectName] Dev-2021.11.01_2-19-04-+0100.xcresult
** BUILD SUCCEEDED **
Testing started
But Sourcekitten still says the same error.
The build command sourcekitten
is looking for starts with /usr/bin/swiftc
and contains the flag -module-name [ProjectName]Test
. Maybe check through the log and see what modules are being built?
Yes it contains it:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target '[ProjectName]Tests' from project '[ProjectName]')
cd /Users/[UserName]/[ProjectName]/src
export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name [ProjectName]Tests
[...]
That says [ProjectName]Tests
but your CLI command says [ProjectName]Test
(without the 's').
Is the typo in this GitHub issue or the actual problem? I'm only grasping at this nitpicky straw because it's the only thing I can think of -- this works elsewhere for loads of users!
Wow great find. That was indeed the problem. Now it runs through without errors, but the resulting json only contains []
.
If that keeps happening after clearing up .build
, build
, and DerivedData for the project then I think that's as far as we can take it without a recreating project.
This works for me on a rare Xcode-test-setup project I have:
; sourcekitten doc --module-name TMLPersistentContainerTests -- clean build-for-testing -scheme TMLPersistentContainer-macOS > test.json
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:E26C7320-8430-5C92-B867-3503C5EE80F5 }
{ platform:macOS, name:Any Mac }
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:E26C7320-8430-5C92-B867-3503C5EE80F5 }
{ platform:macOS, name:Any Mac }
Running xcodebuild
Parsing MultiItem1_1+CoreDataClass.swift (1/35)
Parsing MultiItem1_1+CoreDataProperties.swift (2/35)
Parsing MultiItem2_1+CoreDataClass.swift (3/35)
Parsing MultiItem2_1+CoreDataProperties.swift (4/35)
[...]
Parsing TestSimpleMigrate.swift (35/35)
; wc -l test.json
13775 test.json
Hm, maybe it has something to do with the fact, that I am using an old version, because the new version enforces that signing is disabled, which makes my build fail:
: no identity found
: no identity found
: no identity found
: no identity found
: no identity found
Command PhaseScriptExecution failed with a nonzero exit code
** TEST BUILD FAILED **
I'm trying to generate the documentation for our unit test module, and I am getting an error. It worked for the main module though, and it also worked for the tests a couple of years ago, so not sure what's changed.
My command is:
sourcekitten doc --module-name [ProjectName]Test -- -workspace [ProjectName].xcworkspace -scheme "[ProjectName] Dev" clean build > swiftDoc.json
And I get the following error:
But the xcodebuild log shows " BUILD SUCCEEDED " as the last line.
Sourcekitten version: 0.31.1 Xcode version 13.0