From 9b96a5362a873935c50b444aa271927257c2f984 Mon Sep 17 00:00:00 2001 From: empyrical Date: Tue, 14 Apr 2020 16:39:32 -0700 Subject: [PATCH] Yoga Podspec: Export YGNode and YGStyle headers (#997) Summary: This pull request adds `YGNode.h` and `YGStyle.h` to the headers exported by Yoga's podspec. They are required by the new Fabric architecture of React Native. The modulemap and its umbrella header automatically generated by Cocoapods adds all exported headers to the `modulemap`. Having YGNode and YGStyle exported through here has problems, because they are only available in environments that have C++ available, and will produce errors otherwise. This pull request fences off the contents of those headers in an `#ifdef __cplusplus` block, so they will not cause errors when imported into environments where C++ isn't available. I had considered adding a custom modulemap to the podspec as part of this pull request, but this way seems the least "invasive", and this way you are able to add and remove exported headers in the podspec without needing to worry about updating the umbrella header at the same time. Changelog: [Internal] - Yoga Podspec: Export YGNore and YGStyle headers Pull Request resolved: https://github.com/facebook/yoga/pull/997 Reviewed By: hramos Differential Revision: D20966075 Pulled By: mdvacca fbshipit-source-id: 5f5caa6b639d11e660b968d681da9a4de6c0eb8e --- Yoga.podspec | 2 +- yoga/YGNode.h | 5 +++++ yoga/YGStyle.h | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Yoga.podspec b/Yoga.podspec index 24e1c0b8..2b09977d 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -33,6 +33,6 @@ Pod::Spec.new do |spec| '-fPIC' ] spec.source_files = 'yoga/**/*.{c,h,cpp}' - spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h' + spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h' end diff --git a/yoga/YGNode.h b/yoga/YGNode.h index 9aef1ec6..63d98fe3 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -6,6 +6,9 @@ */ #pragma once + +#ifdef __cplusplus + #include #include #include "BitUtils.h" @@ -330,3 +333,5 @@ public: bool isLayoutTreeEqualToNode(const YGNode& node) const; void reset(); }; + +#endif diff --git a/yoga/YGStyle.h b/yoga/YGStyle.h index 9bfbc442..aab7599c 100644 --- a/yoga/YGStyle.h +++ b/yoga/YGStyle.h @@ -6,6 +6,9 @@ */ #pragma once + +#ifdef __cplusplus + #include #include #include @@ -229,3 +232,5 @@ YOGA_EXPORT bool operator==(const YGStyle& lhs, const YGStyle& rhs); YOGA_EXPORT inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) { return !(lhs == rhs); } + +#endif