2019-07-04 21:17:06 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
2019-07-04 21:17:06 +03:00
|
|
|
*
|
|
|
|
* @generated by an internal plugin build system
|
2019-07-04 21:17:06 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
|
|
|
|
|
2019-07-04 21:17:06 +03:00
|
|
|
// OSS-compatibility layer
|
2019-07-04 21:17:06 +03:00
|
|
|
|
|
|
|
#import "CoreModulesPlugins.h"
|
|
|
|
|
|
|
|
#import <string>
|
|
|
|
#import <unordered_map>
|
|
|
|
|
|
|
|
Class RCTCoreModulesClassProvider(const char *name) {
|
Make update-plugins.js script support multiple libraries
Summary:
Some NativeModules belong to their own buck target (separate from `ReactInternal`). We shouldn't move those NativeModules to `CoreModuels`, because that would unnecessarily bloat `CoreModules`.
In this diff, I extended the `update-plugins.js` script to also generate plugin stubs for those additional targets. This way, we can convert those NativeModules to TurboModules without moving them to CoreModules.
Now, in `update-plugins.js`, we have this array:
```
const libraries = [
{
name: 'CoreModules',
outputFiles: {
ios: ['CoreModulesPlugins.h', 'CoreModulesPlugins.mm'],
android: [],
},
outputPath: {
ios: `${GITHUB_DIR}/React/CoreModules`,
android: '',
},
},
];
```
To codegen another pair of plugin files for another target, simply insert to this array.
**Note:** We'll have to modify RNTesterTurboModuleProvider, but I can take care of that when I setup RNTester for TurboModules.
Reviewed By: fkgozali
Differential Revision: D17671288
fbshipit-source-id: 412d2e730682f82740241506f241dcfb4d302e99
2019-10-01 21:07:08 +03:00
|
|
|
static std::unordered_map<std::string, Class (*)(void)> sCoreModuleClassMap = {
|
|
|
|
{"AccessibilityManager", RCTAccessibilityManagerCls},
|
|
|
|
{"Appearance", RCTAppearanceCls},
|
|
|
|
{"DeviceInfo", RCTDeviceInfoCls},
|
|
|
|
{"ExceptionsManager", RCTExceptionsManagerCls},
|
2019-10-10 19:39:08 +03:00
|
|
|
{"ImageLoader", RCTImageLoaderCls},
|
Make update-plugins.js script support multiple libraries
Summary:
Some NativeModules belong to their own buck target (separate from `ReactInternal`). We shouldn't move those NativeModules to `CoreModuels`, because that would unnecessarily bloat `CoreModules`.
In this diff, I extended the `update-plugins.js` script to also generate plugin stubs for those additional targets. This way, we can convert those NativeModules to TurboModules without moving them to CoreModules.
Now, in `update-plugins.js`, we have this array:
```
const libraries = [
{
name: 'CoreModules',
outputFiles: {
ios: ['CoreModulesPlugins.h', 'CoreModulesPlugins.mm'],
android: [],
},
outputPath: {
ios: `${GITHUB_DIR}/React/CoreModules`,
android: '',
},
},
];
```
To codegen another pair of plugin files for another target, simply insert to this array.
**Note:** We'll have to modify RNTesterTurboModuleProvider, but I can take care of that when I setup RNTester for TurboModules.
Reviewed By: fkgozali
Differential Revision: D17671288
fbshipit-source-id: 412d2e730682f82740241506f241dcfb4d302e99
2019-10-01 21:07:08 +03:00
|
|
|
{"PlatformConstants", RCTPlatformCls},
|
|
|
|
{"Clipboard", RCTClipboardCls},
|
|
|
|
{"I18nManager", RCTI18nManagerCls},
|
|
|
|
{"SourceCode", RCTSourceCodeCls},
|
|
|
|
{"ActionSheetManager", RCTActionSheetManagerCls},
|
2019-10-15 19:12:56 +03:00
|
|
|
{"AlertManager", RCTAlertManagerCls},
|
Make update-plugins.js script support multiple libraries
Summary:
Some NativeModules belong to their own buck target (separate from `ReactInternal`). We shouldn't move those NativeModules to `CoreModuels`, because that would unnecessarily bloat `CoreModules`.
In this diff, I extended the `update-plugins.js` script to also generate plugin stubs for those additional targets. This way, we can convert those NativeModules to TurboModules without moving them to CoreModules.
Now, in `update-plugins.js`, we have this array:
```
const libraries = [
{
name: 'CoreModules',
outputFiles: {
ios: ['CoreModulesPlugins.h', 'CoreModulesPlugins.mm'],
android: [],
},
outputPath: {
ios: `${GITHUB_DIR}/React/CoreModules`,
android: '',
},
},
];
```
To codegen another pair of plugin files for another target, simply insert to this array.
**Note:** We'll have to modify RNTesterTurboModuleProvider, but I can take care of that when I setup RNTester for TurboModules.
Reviewed By: fkgozali
Differential Revision: D17671288
fbshipit-source-id: 412d2e730682f82740241506f241dcfb4d302e99
2019-10-01 21:07:08 +03:00
|
|
|
};
|
|
|
|
|
2019-07-04 21:17:06 +03:00
|
|
|
auto p = sCoreModuleClassMap.find(name);
|
|
|
|
if (p != sCoreModuleClassMap.end()) {
|
|
|
|
auto classFunc = p->second;
|
|
|
|
return classFunc();
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
|