diff --git a/React/Base/RCTDefines.h b/React/Base/RCTDefines.h index 564ae996ca1..68fa8422815 100644 --- a/React/Base/RCTDefines.h +++ b/React/Base/RCTDefines.h @@ -46,6 +46,43 @@ #endif #endif +/** + * RCT_REMOTE_PROFILE: RCT_PROFILE + RCT_ENABLE_INSPECTOR + enable the + * connectivity functionality to control the profiler remotely, such as via Chrome DevTools or + * Flipper. + */ +#ifndef RCT_REMOTE_PROFILE +#define RCT_REMOTE_PROFILE RCT_DEV +#endif + +/** + * Enable the code to support making calls to the underlying sampling profiler mechanism. + */ +#ifndef RCT_PROFILE +#define RCT_PROFILE RCT_REMOTE_PROFILE +#endif + +#ifndef RCT_ENABLE_INSPECTOR +#if (RCT_DEV || RCT_REMOTE_PROFILE) && __has_include() +#define RCT_ENABLE_INSPECTOR 1 +#else +#define RCT_ENABLE_INSPECTOR 0 +#endif +#endif + +/** + * Sanity check that these compile-time flags are compatible. RCT_REMOTE_PROFILE requires RCT_PROFILE and + * RCT_ENABLE_INSPECTOR + */ +#if RCT_REMOTE_PROFILE +#if !RCT_PROFILE +#error "RCT_PROFILE needs to be set to fulfill RCT_REMOTE_PROFILE" +#endif // RCT_PROFILE +#if !RCT_ENABLE_INSPECTOR +#error "RCT_ENABLE_INSPECTOR needs to be set to fulfill RCT_REMOTE_PROFILE" +#endif // RCT_ENABLE_INSPECTOR +#endif // RCT_REMOTE_PROFILE + /** * RCT_DEV_MENU can be used to toggle the dev menu separately from RCT_DEV. * By default though, it will inherit from RCT_DEV. @@ -63,14 +100,6 @@ #define RCT_ENABLE_LOADING_FROM_PACKAGER RCT_DEV_MENU #endif -#ifndef RCT_ENABLE_INSPECTOR -#if RCT_DEV && __has_include() -#define RCT_ENABLE_INSPECTOR 1 -#else -#define RCT_ENABLE_INSPECTOR 0 -#endif -#endif - #ifndef RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION #if RCT_DEV && (__has_include("RCTPackagerConnection.h") || __has_include()) #define RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION 1 diff --git a/React/CoreModules/RCTDevSettings.mm b/React/CoreModules/RCTDevSettings.mm index ceda9c55a37..e243eb0e0ad 100644 --- a/React/CoreModules/RCTDevSettings.mm +++ b/React/CoreModules/RCTDevSettings.mm @@ -53,7 +53,7 @@ void RCTDevSettingsSetEnabled(BOOL enabled) devSettingsMenuEnabled = enabled; } -#if RCT_DEV_MENU +#if RCT_DEV_MENU || RCT_REMOTE_PROFILE @interface RCTDevSettingsUserDefaultsDataSource : NSObject @@ -618,7 +618,9 @@ RCT_EXPORT_METHOD(addMenuItem : (NSString *)title) - (RCTDevSettings *)devSettings { -#if RCT_DEV_MENU +#if RCT_REMOTE_PROFILE + return [self moduleForClass:[RCTDevSettings class]]; +#elif RCT_DEV_MENU return devSettingsMenuEnabled ? [self moduleForClass:[RCTDevSettings class]] : nil; #else return nil; diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index f527f50a1a2..08397c36ab0 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -11,7 +11,7 @@ #import #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE @interface RCTInspectorDevServerHelper : NSObject diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index 687297d8c46..cf404f3900c 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -7,7 +7,7 @@ #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE #import #import diff --git a/React/Inspector/RCTInspector.h b/React/Inspector/RCTInspector.h index 49acfcd7224..8738c9b7900 100644 --- a/React/Inspector/RCTInspector.h +++ b/React/Inspector/RCTInspector.h @@ -8,7 +8,7 @@ #import #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE @class RCTInspectorRemoteConnection; diff --git a/React/Inspector/RCTInspector.mm b/React/Inspector/RCTInspector.mm index ff1c007dd09..4e31ecbb180 100644 --- a/React/Inspector/RCTInspector.mm +++ b/React/Inspector/RCTInspector.mm @@ -7,7 +7,7 @@ #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE #include diff --git a/React/Inspector/RCTInspectorPackagerConnection.h b/React/Inspector/RCTInspectorPackagerConnection.h index 184b05d5970..96bb8416b77 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.h +++ b/React/Inspector/RCTInspectorPackagerConnection.h @@ -8,7 +8,7 @@ #import #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE @interface RCTBundleStatus : NSObject @property (atomic, assign) BOOL isLastBundleDownloadSuccess; diff --git a/React/Inspector/RCTInspectorPackagerConnection.m b/React/Inspector/RCTInspectorPackagerConnection.m index 532c2d9c78b..af5c223e474 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.m +++ b/React/Inspector/RCTInspectorPackagerConnection.m @@ -7,7 +7,7 @@ #import -#if RCT_DEV +#if RCT_DEV || RCT_REMOTE_PROFILE #import #import