From 60da5071a679f4043afc42b9be2aba613f1ebb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 28 Jan 2020 13:12:35 -0800 Subject: [PATCH] Make C++ requirement opt-in (#27730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: When building as a framework these headers get automatically added to the framework umbrella header for React-Core. Instead of converting all the React sources to ObjC++ files and still forcing external users that build native source (and link against a framework build) to also compile as ObjC++, this makes the attribution related methods that were added in https://github.com/facebook/react-native/commit/fdcdca4 opt-in to ObjC++ builds. This is also the reason for the current failure of the CI `test_ios_frameworks` run. I’m unsure if this change really warrants an entry in the CHANGELOG, as it’s more of an amendment of the (afaik) unreleased [change](https://github.com/facebook/react-native/commit/fdcdca4). [iOS] [Fixed] - Make framework builds work again by making `RCTImageLoader` C++ requirement opt-in Pull Request resolved: https://github.com/facebook/react-native/pull/27730 Test Plan: I tested static and dynamic (framework) builds and ran the test suite. This change should make the `test_ios_frameworks` CI run _build_ again, ~~but it may still fail overall as in my local testing one of the tests leads to a segfault (which I will try to address separately)~~. Reviewed By: PeteTheHeat Differential Revision: D19348846 Pulled By: fkgozali fbshipit-source-id: 8a74e6f7ad3ddce2cf10b080b9a5d7b399bd5fc0 --- Libraries/Image/RCTImageLoaderWithAttributionProtocol.h | 3 +++ Libraries/Image/RCTImageURLLoaderWithAttribution.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h index 2e9d20ec543..f577b524278 100644 --- a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h +++ b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h @@ -12,6 +12,8 @@ @protocol RCTImageLoaderWithAttributionProtocol +// TODO (T61325135): Remove C++ checks +#ifdef __cplusplus /** * Same as the variant in RCTImageURLLoaderProtocol, but allows passing attribution * information that each image URL loader can process. @@ -25,5 +27,6 @@ progressBlock:(RCTImageLoaderProgressBlock)progressBlock partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; +#endif @end diff --git a/Libraries/Image/RCTImageURLLoaderWithAttribution.h b/Libraries/Image/RCTImageURLLoaderWithAttribution.h index ed2c9bab7a8..f5ee3e0c4f9 100644 --- a/Libraries/Image/RCTImageURLLoaderWithAttribution.h +++ b/Libraries/Image/RCTImageURLLoaderWithAttribution.h @@ -7,6 +7,8 @@ #import +// TODO (T61325135): Remove C++ checks +#ifdef __cplusplus namespace facebook { namespace react { @@ -17,6 +19,7 @@ struct ImageURLLoaderAttribution { } // namespace react } // namespace facebook +#endif /** * Same as the RCTImageURLLoader interface, but allows passing in optional `attribution` information. @@ -24,6 +27,8 @@ struct ImageURLLoaderAttribution { */ @protocol RCTImageURLLoaderWithAttribution +// TODO (T61325135): Remove C++ checks +#ifdef __cplusplus /** * Same as the RCTImageURLLoader variant above, but allows optional `attribution` information. */ @@ -35,5 +40,6 @@ struct ImageURLLoaderAttribution { progressHandler:(RCTImageLoaderProgressBlock)progressHandler partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; +#endif @end