diff --git a/React/CoreModules/RCTImageEditingManager.h b/Libraries/Image/RCTImageEditingManager.h similarity index 100% rename from React/CoreModules/RCTImageEditingManager.h rename to Libraries/Image/RCTImageEditingManager.h diff --git a/React/CoreModules/RCTImageEditingManager.m b/Libraries/Image/RCTImageEditingManager.m similarity index 100% rename from React/CoreModules/RCTImageEditingManager.m rename to Libraries/Image/RCTImageEditingManager.m diff --git a/React/CoreModules/RCTImageLoader.h b/Libraries/Image/RCTImageLoader.h similarity index 100% rename from React/CoreModules/RCTImageLoader.h rename to Libraries/Image/RCTImageLoader.h diff --git a/React/CoreModules/RCTImageLoader.mm b/Libraries/Image/RCTImageLoader.mm similarity index 99% rename from React/CoreModules/RCTImageLoader.mm rename to Libraries/Image/RCTImageLoader.mm index 356ffd640f2..9348e483438 100644 --- a/React/CoreModules/RCTImageLoader.mm +++ b/Libraries/Image/RCTImageLoader.mm @@ -20,7 +20,7 @@ #import #import -#import "CoreModulesPlugins.h" +#import "RCTImagePlugins.h" static NSInteger RCTImageBytesForImage(UIImage *image) { diff --git a/Libraries/Image/RCTImagePlugins.h b/Libraries/Image/RCTImagePlugins.h new file mode 100644 index 00000000000..d50419461fe --- /dev/null +++ b/Libraries/Image/RCTImagePlugins.h @@ -0,0 +1,40 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @generated by an internal plugin build system + */ + +#ifdef RN_DISABLE_OSS_PLUGIN_HEADER + +// FB Internal: FBRCTImagePlugins.h is autogenerated by the build system. +#import "FBRCTImagePlugins.h" + +#else + +// OSS-compatibility layer + +#import + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" + +#ifdef __cplusplus +extern "C" { +#endif + +// RCTTurboModuleManagerDelegate should call this to resolve module classes. +Class RCTImageClassProvider(const char *name); + +// Lookup functions +Class RCTImageLoaderCls(void) __attribute__((used)); + +#ifdef __cplusplus +} +#endif + +#pragma GCC diagnostic pop + +#endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/Libraries/Image/RCTImagePlugins.mm b/Libraries/Image/RCTImagePlugins.mm new file mode 100644 index 00000000000..708056f8e40 --- /dev/null +++ b/Libraries/Image/RCTImagePlugins.mm @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @generated by an internal plugin build system + */ + +#ifndef RN_DISABLE_OSS_PLUGIN_HEADER + +// OSS-compatibility layer + +#import "RCTImagePlugins.h" + +#import +#import + +Class RCTImageClassProvider(const char *name) { + static std::unordered_map sCoreModuleClassMap = { + {"ImageLoader", RCTImageLoaderCls}, + }; + + auto p = sCoreModuleClassMap.find(name); + if (p != sCoreModuleClassMap.end()) { + auto classFunc = p->second; + return classFunc(); + } + return nil; +} + +#endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/React/CoreModules/RCTImageStoreManager.h b/Libraries/Image/RCTImageStoreManager.h similarity index 100% rename from React/CoreModules/RCTImageStoreManager.h rename to Libraries/Image/RCTImageStoreManager.h diff --git a/React/CoreModules/RCTImageStoreManager.m b/Libraries/Image/RCTImageStoreManager.m similarity index 100% rename from React/CoreModules/RCTImageStoreManager.m rename to Libraries/Image/RCTImageStoreManager.m diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index 62bb32cfea9..c71f996bf1f 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -17,6 +17,9 @@ else source[:tag] = "v#{version}" end +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' +folly_version = '2018.10.22.00' + Pod::Spec.new do |s| s.name = "React-RCTImage" s.version = version @@ -26,11 +29,19 @@ Pod::Spec.new do |s| s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "9.0", :tvos => "9.2" } + s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source - s.source_files = "*.{m}" + s.source_files = "*.{m,mm}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTImage" + s.pod_target_xcconfig = { + "USE_HEADERMAP" => "YES", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Folly\"" + } + s.dependency "Folly", folly_version + s.dependency "FBReactNativeSpec", version s.dependency "React-Core/RCTImageHeaders", version s.dependency "React-RCTNetwork", version end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index d3973e94811..5668cb8dcf3 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -212,6 +212,8 @@ PODS: - React-jsi (= 1000.0.0) - React-RCTNetwork (= 1000.0.0) - React-RCTImage (1000.0.0): + - FBReactNativeSpec (= 1000.0.0) + - Folly (= 2018.10.22.00) - React-Core/RCTImageHeaders (= 1000.0.0) - React-RCTNetwork (= 1000.0.0) - React-RCTLinking (1000.0.0): @@ -372,7 +374,7 @@ SPEC CHECKSUMS: React-RCTActionSheet: 090e7bd7c5774d919c47c4eeff78223a7fd8c19c React-RCTAnimation: 73d536fff417a101724d9529189c95a94263710c React-RCTBlob: acd519b1d6ec5d66f98b7cf8e70d0cd76642426f - React-RCTImage: 7f5c9bff34905f1bc216be512ba0ae68f872208a + React-RCTImage: 4d2a090c491e29665f27f87c58feb4dfcb2f4cfa React-RCTLinking: d7d7f792e63a8d57380cecbb9b7a3b31f92d1bb6 React-RCTNetwork: c8f9d40297f35ea3792ea81866f33e8b45c25935 React-RCTPushNotification: acffa8af6a20e6d41b041a8c4cb4bea0de9df0dd diff --git a/React/CoreModules/BUCK b/React/CoreModules/BUCK index 2128fab5a96..ceca398bcf3 100644 --- a/React/CoreModules/BUCK +++ b/React/CoreModules/BUCK @@ -51,9 +51,6 @@ rn_apple_library( ) + react_module_plugin_providers( name = "ExceptionsManager", native_class_func = "RCTExceptionsManagerCls", - ) + react_module_plugin_providers( - name = "ImageLoader", - native_class_func = "RCTImageLoaderCls", ) + react_module_plugin_providers( name = "PlatformConstants", native_class_func = "RCTPlatformCls", @@ -77,7 +74,6 @@ rn_apple_library( reexport_all_header_dependencies = True, visibility = ["PUBLIC"], exported_deps = [ - "fbsource//xplat/js:RCTImageApple", "fbsource//xplat/js/react-native-github:ReactInternalApple", "fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple", ], diff --git a/React/CoreModules/CoreModulesPlugins.h b/React/CoreModules/CoreModulesPlugins.h index 6eb37cc375d..9576ade6da9 100644 --- a/React/CoreModules/CoreModulesPlugins.h +++ b/React/CoreModules/CoreModulesPlugins.h @@ -33,7 +33,6 @@ Class RCTAccessibilityManagerCls(void) __attribute__((used)); Class RCTAppearanceCls(void) __attribute__((used)); Class RCTDeviceInfoCls(void) __attribute__((used)); Class RCTExceptionsManagerCls(void) __attribute__((used)); -Class RCTImageLoaderCls(void) __attribute__((used)); Class RCTPlatformCls(void) __attribute__((used)); Class RCTClipboardCls(void) __attribute__((used)); Class RCTI18nManagerCls(void) __attribute__((used)); diff --git a/React/CoreModules/CoreModulesPlugins.mm b/React/CoreModules/CoreModulesPlugins.mm index ddfd86244e8..1fa0ac0d191 100644 --- a/React/CoreModules/CoreModulesPlugins.mm +++ b/React/CoreModules/CoreModulesPlugins.mm @@ -22,7 +22,6 @@ Class RCTCoreModulesClassProvider(const char *name) { {"Appearance", RCTAppearanceCls}, {"DeviceInfo", RCTDeviceInfoCls}, {"ExceptionsManager", RCTExceptionsManagerCls}, - {"ImageLoader", RCTImageLoaderCls}, {"PlatformConstants", RCTPlatformCls}, {"Clipboard", RCTClipboardCls}, {"I18nManager", RCTI18nManagerCls}, diff --git a/ReactCommon/fabric/imagemanager/BUCK b/ReactCommon/fabric/imagemanager/BUCK index 9e54505d0e5..08d3d6d7559 100644 --- a/ReactCommon/fabric/imagemanager/BUCK +++ b/ReactCommon/fabric/imagemanager/BUCK @@ -59,7 +59,6 @@ rn_xplat_cxx_library( ios_deps = [ "fbsource//xplat/js:RCTImage", "fbsource//xplat/js/react-native-github:RCTCxxBridge", - "fbsource//xplat/js/react-native-github/React/CoreModules:CoreModules", ], ios_exported_headers = subdir_glob( [