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

Support for different custom build configurations #83

Closed
wants to merge 1 commit into from

Conversation

gatherheart
Copy link

Description

I reported an issue last week, and it turns out that SPM is missing builds when the "Custom Build Configuration" (such as Test) only exists in the main app.

There have been a lot of reports about this.

  1. how-to-use-a-custom-build-configuration-in-a-swift-package
  2. spm-in-xcode

As SPM does not support custom build configurations, only the configurations that contain "debug" in their names make the Xcode builder put the DEBUG flag in the build options.

I reported it through Feedback Assistant (FB12343218) and now waiting for its response.

HotReloading module should be removed from the release build anyway,
What about putting DEBUG flag in the overall flags?
Could you please check these changes?

Fixes #82 issue

Type of change

Please delete options that are not relevant.

  • [V ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Using SwiftUI-Kit,
I tested it with multiple schemes and multiple build configurations, and everything worked fine.
I checked on the Device and it was fine.

Added DEBUG flags for HotReloading and HotReloadingGuts modules
@johnno1962
Copy link
Owner

johnno1962 commented Jun 14, 2023

Hi again, thanks for filing the report and this PR. I filed something too and I'll add your FB number. Your proposed PR is exactly what I tried when I said "there were other problems" which I have since fixed because the C header files are not compiled for the module export to Swift with -DDEBUG even with your change which a separate Xcode bug.

I'm going to have to decline this PR was I don't really want to force a debug build if the user is building for release (which they should never be doing with HotReloading configured anyway). What caused this problem is this recent commit where I was trying to ensure people never release with HotReloading active. I may back it out as due to the problem we found all the commit does is break HotReloading for some people using other configuration names. Releasing with HotReloading configured should only bloat your app package a little and attempt a random local area network connection then give up. It is already mentioned a coupe of times in the READMEs you should never release with the HotReloading Swift Package configured which is the important thing.

I need to think about this some more. As things stand it errs on the side of caution which is a good thing. I trying to encourage most people to use the pre-built bundles if they are not injecting on a device anyway. This leaves people injecting on a device with a non-Debug config name which should be a fairly small number of people to inconvenience but it is better than leaving open the possibility of shipping active HotReloading code with their app even if that would normally not be a problem.

@gatherheart
Copy link
Author

Oh, I see your intentions. You want to make sure it's okay to include it in the release build. That's great.
I'll try to work around it or wait for new features in Xcode.

Thanks!

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

Successfully merging this pull request may close these issues.

Cannot use HotReloading with Other debug configurations (ex. Dev, Test Configuration)
2 participants