sweetpad icon indicating copy to clipboard operation
sweetpad copied to clipboard

Empty build settings

Open mehmetbaykar opened this issue 1 year ago • 11 comments

Empty Build Settings Error When Building Swift Package Library Products

Description

When attempting to build a library product from a Swift Package with multiple targets using sweetpad (v0.1.42), I encounter an "Empty build settings" error. This occurs because sweetpad doesn't automatically configure build settings for SPM library products, unlike Xcode which handles this configuration automatically.

Current Behavior

  • Attempting to build a library product results in error:
{
  "message": "Empty build settings",
  "level": 3,
  "command": "sweetpad.build.build",
  "error": {}
}
  • Currently requires manual configuration through Xcode for each library product
  • Need to add executable target in build settings for each package target manually

Expected Behavior

  • Automatic configuration of build settings for SPM library products (similar to Xcode)
  • Ability to build library products without manual configuration
  • Support for multi-target Swift packages out of the box

Steps to Reproduce

  1. Create a Swift package with multiple targets
  2. Define library products in Package.swift
  3. Attempt to build one of the package library products using sweetpad
  4. Observe "Empty build settings" error

Environment

  • sweetpad version: 0.1.42
  • Editor: Cursor
  • OS: macOS
  • Swift Package Manager: Multiple targets configuration

Suggested Solution

Implement automatic build settings configuration for SPM library products:

  1. Detect all library products in Package.swift
  2. Auto-configure build settings for each library product
  3. Support different library types (static, dynamic)
  4. Provide fallback configuration similar to Xcode's default behavior

Additional Context

This is particularly important for workflow automation as currently developers need to switch to Xcode for initial configuration, which defeats the purpose of using an IDE extension for Swift development. Library products are especially important as they're commonly used as dependencies in larger projects.

Impact

This issue affects development workflow by:

  • Requiring manual Xcode configuration
  • Breaking CI/CD pipelines
  • Increasing project setup time
  • Making it difficult to work with multi-target packages and their library products

Would you like me to:

  • [ ] Add more detailed logging for build settings
  • [ ] Support automatic library product configuration
  • [ ] Provide CLI fallback when build settings are missing
  • [ ] Add documentation for manual configuration workarounds

mehmetbaykar avatar Nov 23 '24 22:11 mehmetbaykar

I've seen this issue with xcode projects too, I had to open the project and build on Xcode first before Sweetpad would work. Strange.

cameroncooke avatar Nov 28 '24 10:11 cameroncooke

I'm seeing the same issue as OP. Opening on Xcode and building first does not resolve the issue.

mdoukmak avatar Dec 06 '24 07:12 mdoukmak

Just wanted to +1 this. I have a project with multiple targets and library products defined in a Package.swift file and I can't build any of them. They all build fine in Xcode but give me the "Empty build settings" with SweetPad.

SilverTab avatar Jan 06 '25 15:01 SilverTab

@hyzyla any thoughts on this? I'm unable to build any local Swift package in my workspace.

cameroncooke avatar Jan 06 '25 18:01 cameroncooke

Hi!, same issue here, project with multiples packages and targets and only the main target is building, but ok building from Xcode. For those who have the same setup, are Code completion, Jump to Definition... working in files that are inside those targets? for me is only working in the files inside the main on, not sure if is related with this building issue.

javiermorgaz avatar Jan 27 '25 09:01 javiermorgaz

Same for me. I just got things set up a couple days ago, liked it, and decided to actually pay for Cursor. Everything worked for a bit but now I just get that "Empty build settings" error any time I try to build or run.

Did anyone figure this out?

tylerjames avatar Feb 05 '25 15:02 tylerjames

Hello! Sorry for the radio silence on my end. I've tried to fix this issue in the latest version of the VSCode extension (0.1.52). Could someone try it out with new version. I found out that the build settings can simply be ignored when building SPM packages https://github.com/sweetpad-dev/sweetpad/commit/0803bbbcf9a68618245916b1d1f541c835d14cf4

hyzyla avatar Feb 22 '25 21:02 hyzyla

Everything seems to work as expected for me! Well done!!

SilverTab avatar Feb 23 '25 14:02 SilverTab

Works great for me as well! Thanks so much!

cjrieck avatar Feb 25 '25 21:02 cjrieck

Now I can build my packages and jump to definition works neat from one package to another. Thanks a lot! 👏

javiermorgaz avatar Feb 28 '25 09:02 javiermorgaz

Hey, I am on 0.1.59 and still getting the following output when trying build and run on SPM package:

Build Succeeded

🚷 Error: Empty build settings

I see for others it works now but for me it was updated to latest version but still getting this error and go to definition does not work.

rssole avatar Apr 14 '25 12:04 rssole