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

Mocktail, HTTPMessage Support for SPM #340

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fabrizioCorut
Copy link

@fabrizioCorut fabrizioCorut commented Jan 25, 2021

Description

Mocktail and HTTPMessage features were not visible for users that drag OHTTPStubs as a dependency using Swift Package Manager because the default behaviour of Swift Package Manager is to compile all the sources that are found under: Sources/$(PACKAGE_NAME), hence, the only compiled sources were Sources/OHHTTPStubs. Sources/Mocktail and Sources/HTTPMessage were ignored.

Tests

While this is not that critical, the same principle applies for the Tests as well but I could not get it to work. Currently the Mocktail tests are not ran.
Whatever I do, the Mocktail tests are not seeing the resources, even though I'm declaring them in the Package.swift file. Some help with this regard would be nice. It seems that the files are not found in the bundle.

I tried to keep the changeset to a minimum, sadly, with a custom path for the target we would have had to modify all the #include directives which are currently solved for free if you include all your headers in the include folder. Hence, the small change that I did include:
• moving the Mocktail and HTTPMessage folders in the Sources/OHHTTPStubs folder;
• moving the .h files in their include folders to Sources/OHHTTPStubs/include;
• moving the core functionality (old OHHTTPStubs/*.m files) in a new folder: Sources/OHHTTPStubs/OHHTTPStubs so we keep the old structure;
• updating the Xcode project to reflect the new hierarchy so it compiles;

Motivation and Context

The problem is descried in #331 ~ SPM users were not able to see the Mocktail and HTTPMessage functionalities because they were not included in the framework build process.

Final remarks

There is nothing to add to the README file since this was supposed to work out of the box. No credits needed, just moved some folders around.

Coruț Fabrizio added 5 commits January 25, 2021 17:43
…es/$(PROJ_NAME)/ hence, the HTTPMessage and Mocktail functionalities were not even compiled.

Moved them and their includes into the OHHTTPStubs and created a separate folder for the core functionality, in order to keep the files nicely split.
The same principles applies to the tests as well: only files found in the Tests/$(PACKAGE_NAME)Tests folder will be taken into consideration.
@natebird natebird mentioned this pull request Feb 1, 2021
9 tasks
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.

None yet

1 participant