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

Add support for SPM test targets #13

Open

Description

@jnordberg

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.

Activity

  1. helje5 commented on Aug 10, 2018

    @helje5
    Member

    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)).

  2. changed the title [-]Using dependencies in test targets[/-] [+]Add support for SPM test targets[/+] on Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions