Feature podspec modules #793

Closed
pkrmf wants to merge 6 commits from feature-podspec-modules into master
pkrmf commented 2018-07-10 16:42:57 -07:00 (Migrated from github.com)

This PR adds support for using Yoga Swift dependents when Yoga is pulled as a static library.

What is the problem?

Currently swift projects trying to pull static libraries are unable to import the module. The reason for that is because the DEFINES_MODULES build setting is set toNO. If a Swift Framework is trying to pod spec lint --use-libraries with Yoga as a dependency, the validation will fail. With the DEFINES_MODULE enabled, the product will be treated as defining its own module. This enables automatic production of LLVM module map files when appropriate, and allows the product to be imported as a module.

A workaround to this issue would be passing the :modular_headers flag to the Podfile, but that would not fix the pod spec lint validation for framework/library dependencies, it would just allow consuming applications to build and run.

Example of an existing issue

An example of this issue would be SonarKit. SonarKit wasn't able to validate its podspec due to YogaKit (Swift Framework) depending on Yoga and SonarKit validating with the --use-libraries flag due to the c++ dependencies. We had to create a new version of Yoga 1.9 podspec and make sure to set the DEFINES_MODULE flag of the pod target. After that, we were able to pod spec lint SonarKit.podspec successfully.

After merging a new tag should be created and the new podspec should be pushed to cocoapods master repository.

This PR adds support for using Yoga Swift dependents when Yoga is pulled as a static library. ### What is the problem? Currently swift projects trying to pull static libraries are unable to import the module. The reason for that is because the `DEFINES_MODULES` build setting is set to`NO`. If a Swift Framework is trying to `pod spec lint --use-libraries` with `Yoga` as a dependency, the validation will fail. With the `DEFINES_MODULE` enabled, the product will be treated as defining its own module. This enables automatic production of LLVM module map files when appropriate, and allows the product to be imported as a module. A workaround to this issue would be passing the `:modular_headers` flag to the `Podfile`, but that would not fix the `pod spec lint` validation for framework/library dependencies, it would just allow consuming applications to build and run. ### Example of an existing issue An example of this issue would be [SonarKit](https://github.com/facebook/Sonar/blob/master/iOS/SonarKit.podspec). `SonarKit` wasn't able to validate its podspec due to `YogaKit` (Swift Framework) depending on `Yoga` and SonarKit validating with the `--use-libraries` flag due to the c++ dependencies. We had to create a new version of [Yoga 1.9 podspec](https://github.com/facebook/Sonar/blob/master/Specs/Yoga/1.9/Yoga.podspec.json) and make sure to set the `DEFINES_MODULE` flag of the pod target. After that, we were able to `pod spec lint` `SonarKit.podspec` successfully. After merging a new `tag` should be created and the new podspec should be pushed to cocoapods master repository.
priteshrnandgaonkar commented 2018-07-11 06:54:58 -07:00 (Migrated from github.com)

Lets keep semantic versioning as 1.9.0 where the last digit would be for patched version. To get the latest pod people can refer ~> 1.9 in their Podfile

Lets keep semantic versioning as `1.9.0` where the last digit would be for patched version. To get the latest pod people can refer `~> 1.9` in their Podfile
pkrmf commented 2018-07-11 17:08:16 -07:00 (Migrated from github.com)

@priteshrnandgaonkar Done!

@priteshrnandgaonkar Done!
pkrmf commented 2018-07-11 17:08:48 -07:00 (Migrated from github.com)

@priteshrnandgaonkar Let's make sure to generate a new 1.9.0 tag after merge

@priteshrnandgaonkar Let's make sure to generate a new 1.9.0 tag after merge
facebook-github-bot (Migrated from github.com) reviewed 2018-07-12 06:11:39 -07:00
facebook-github-bot (Migrated from github.com) left a comment

@priteshrnandgaonkar has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@priteshrnandgaonkar has imported this pull request. If you are a Facebook employee, you can view this diff [on Phabricator](https://phabricator.intern.facebook.com/D8820126).
pkrmf commented 2018-07-12 18:15:00 -07:00 (Migrated from github.com)

@priteshrnandgaonkar could we make sure we push the Yoga.podspec and then YogaKit.podspec to cocoapods master repo?

@priteshrnandgaonkar could we make sure we push the Yoga.podspec and then YogaKit.podspec to cocoapods master repo?

Pull request closed

Sign in to join this conversation.
No description provided.