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

Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder" #35

Closed
huwr opened this issue Nov 6, 2022 · 5 comments

Comments

@huwr
Copy link

huwr commented Nov 6, 2022

Hi,

I'm having an issue building this package. It's only started since we moved to Xcode 14 and 14.1. When archiving with xcodebuild it reports:

2022-11-06 22:12:10.919 xcodebuild[5632:81577] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x600003fa1400: name:Documentation.docc path:group:Documentation.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/XXXXXX-flaewjllgygaoobtikmjykvcbuow/SourcePackages/checkouts/xctest-dynamic-overlay/Sources/XCTestDynamicOverlay/Documentation.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

Or more easily:

Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder"

Really unsure as to what we can do here. We're brining XCTDynamicOverlay as a transitive dependency via SwiftUI-Navigation.

If it helps, here's a (sanitised) version of our xcodebuild command:

xcodebuild -workspace XXXXXX.xcworkspace -scheme XXXXXX -sdk iphoneos -disableAutomaticPackageResolution -archivePath 'Build/XXXXXX.xcarchive' archive -xcconfig XXXXXX/XXXXXX/Resources/Config/Distribution-AppStore.xcconfig XXXXXX_BUILD_NUMBER=477
@huwr
Copy link
Author

huwr commented Nov 6, 2022

Little more background: A very similar issue occurred over in Nuke: kean/Nuke#609 Their solution was actually to remove the docc folders 😢

@huwr
Copy link
Author

huwr commented Nov 8, 2022

Okay, I'm closing the issue because it's not actually a problem. It was a bit of a red-herring. My main issue was solved in a very similar way to other people's here.

@huwr huwr closed this as completed Nov 8, 2022
@mbrandonw
Copy link
Member

Hi @huwr, thanks for looking into it more and letting us know what the underlying issue was. Glad we don't have to move docs out of Sources/, but also still bizarre how a provisioning profile setting would surface an error about docs. 😐

@huwr
Copy link
Author

huwr commented Nov 8, 2022

Yeah. It's actually a totally separate issue. I still have the original error, in fact, but it is not causing any archive failures! I downgraded temporarily back to SwiftUI-Navigation 0.2.0 (which didn't have XCTestDynamicOverlay) and the warning went away, but the archive failure persisted. It turns out, there was errors elsewhere that my CI had made less than obvious. Just thought I'd leave the link to the solution in the thread in case someone finds this same issue and is having a similar trouble.

@marinofelipe
Copy link

What solved for me in the project I work on was to add the .docc relative path to the target's exclude

.target(
    name: "MyTarget",
    // ...
    exclude: ["PathToDocc/MyDocs.docc"]
  ),

The paths to source and resource files that you don’t want to include in the target.
https://developer.apple.com/documentation/packagedescription/target/exclude

It looks like xcodebuild / Swift compiler considers that as valid (re)source path which causes those log entries.
After excluding the logs were gone, and docc can still be compiled via the Build Documentation option / xcodebuild docbuild

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

3 participants