Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

Add support for SPM test targets #13

Open
jnordberg opened this issue Aug 10, 2018 · 1 comment
Open

Add support for SPM test targets #13

jnordberg opened this issue Aug 10, 2018 · 1 comment

Comments

@jnordberg
Copy link

I have a iOS project setup with the swift-code standard template and the imports work fine but in the test target I get a No such module error.

@helje5
Copy link
Member

helje5 commented Aug 10, 2018

Hm, well, I guess support for "Include Unit Tests" and "Include UI Tests" could be added to the app template (as supported by the regular templates).

If you look at the Build Settings of the app target, you can see the settings required to make it work in the test target, you should be able to just copy/paste them. Seems to be:

OTHER_LDFLAGS = $(inherited) -lXcodeSPMDependencies
HEADER_SEARCH_PATHS = $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(CURRENT_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION) $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)
LIBRARY_SEARCH_PATHS = $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(CURRENT_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION) $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)
SWIFT_INCLUDE_PATHS = $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/$(CURRENT_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION) $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)

(you have to replace $(PRODUCT_NAME) with the name of test app you test (which will have the dependencies)).

@helje5 helje5 changed the title Using dependencies in test targets Add support for SPM test targets Aug 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants