swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
728 stars 50 forks source link

Build doesn't copy resources #380

Closed SpectralDragon closed 2 years ago

SpectralDragon commented 2 years ago

Describe the bug I working on project with few targets and each target contains specific resources. But when I compile SPM package from VS Code, then resources copied only from executable target. When I build it from Xcode, all resources copied correctly.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/LiteCode/AdaEngine/tree/develop
  2. Download project and open Package.swift with VSCode
  3. Build project in Debug mode and you will receive fatal error in MetalRenderBackend.swift::126 Bundle.current.url(forResource: descriptor.shaderName, withExtension: "metallib")!
  4. If you will check bundle AdaEngine_AdaEngine.bundle, than you can see, that bundle contains only Vulkan folder, instead of Contents/Resources folder

Expected behavior All resources copied correctly.

Environment

Additional context Readme file with instructions is not correct right now, Vulkan isn't needed.

adam-fowler commented 2 years ago

This is a Swift Package Manager issue. You should file a bug with https://github.com/apple/swift-package-manager. I assume you get the same results if you run swift build on the command line?

SpectralDragon commented 2 years ago

I assume you get the same results if you run swift build on the command line?

I'll check it

SpectralDragon commented 2 years ago

Yeah, you was right, the problem is swift package running on xcode and on SPM will shipping two different products. In first scenario where swift package builds on Xcode the bundles contains typical macos/ios NSBundle with Contents folders. In second scenario swift compiler builds a product with simple Bundle. And also, SPM wasn't process a metal libs =/

Thanks!