Skip to content

Commit

Permalink
@allow-large-files [Flipper][RN] Integrated Flipper in RNTester appli…
Browse files Browse the repository at this point in the history
…cation

Summary:
Changelog: [iOS] [Fixed]

Integrated Flipper in RNTester application and made sure that flipper connects with RNTester application

allow-large-files

Reviewed By: rickhanlonii

Differential Revision: D19813213

fbshipit-source-id: f0c7a5a42ffaccd488582b0f42ce37aea946c636
  • Loading branch information
priteshrnandgaonkar authored and facebook-github-bot committed Feb 12, 2020
1 parent c0c644c commit cb80e3b
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 18 deletions.
50 changes: 49 additions & 1 deletion RNTester/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,62 @@ def pods()
# Additional Pods which aren't included in the default Podfile
pod 'React-ART', :path => '../Libraries/ART'
pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS'

pod 'Yoga',:path => '../ReactCommon/yoga', :modular_headers => true
# Additional Pods which are classed as unstable
#
# To use fabric: add `fabric_enabled` option to the use_react_native method above, like below
# use_react_native!(path: "..", fabric_enabled: true)
end


def flipper_pods()
flipperkit_version = '0.30.1'
pod 'FlipperKit', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitLayoutPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitReactPlugin', '~>' + flipperkit_version, :configuration => 'Debug'

if ENV['USE_FRAMEWORKS'] == '1'
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket',
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']

pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::Target::BuildType.static_library
end
end
end
end
end
end

# Post Install processing for Flipper
def flipper_post_install(installer)
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << ' -DFB_SONARKIT_ENABLED=1 '
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end

target 'RNTester' do
pods()
flipper_pods()
end

target 'RNTesterUnitTests' do
Expand All @@ -39,6 +86,7 @@ target 'RNTesterIntegrationTests' do
end

post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
puts target.name
end
Expand Down
82 changes: 81 additions & 1 deletion RNTester/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.3)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (1000.0.0)
- FBReactNativeSpec (1000.0.0):
Expand All @@ -9,6 +11,52 @@ PODS:
- React-Core (= 1000.0.0)
- React-jsi (= 1000.0.0)
- ReactCommon/turbomodule/core (= 1000.0.0)
- Flipper (0.30.2):
- Flipper-Folly (~> 2.1)
- Flipper-RSocket (~> 1.0)
- Flipper-DoubleConversion (1.1.7)
- Flipper-Folly (2.1.1):
- boost-for-react-native
- CocoaLibEvent (~> 1.0)
- Flipper-DoubleConversion
- Flipper-Glog
- OpenSSL-Universal (= 1.0.2.19)
- Flipper-Glog (0.3.6)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.0.0):
- Flipper-Folly (~> 2.0)
- FlipperKit (0.30.2):
- FlipperKit/Core (= 0.30.2)
- FlipperKit/Core (0.30.2):
- Flipper (~> 0.30.2)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- FlipperKit/CppBridge (0.30.2):
- Flipper (~> 0.30.2)
- FlipperKit/FBCxxFollyDynamicConvert (0.30.2):
- Flipper-Folly (~> 2.1)
- FlipperKit/FBDefines (0.30.2)
- FlipperKit/FKPortForwarding (0.30.2):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.30.2)
- FlipperKit/FlipperKitLayoutPlugin (0.30.2):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.30.2)
- FlipperKit/FlipperKitNetworkPlugin (0.30.2):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.30.2):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.30.2):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.30.2):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- Folly (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
Expand All @@ -19,6 +67,9 @@ PODS:
- DoubleConversion
- glog
- glog (0.3.5)
- OpenSSL-Universal (1.0.2.19):
- OpenSSL-Universal/Static (= 1.0.2.19)
- OpenSSL-Universal/Static (1.0.2.19)
- RCTRequired (1000.0.0)
- RCTTypeSafety (1000.0.0):
- FBLazyVector (= 1000.0.0)
Expand Down Expand Up @@ -280,11 +331,18 @@ PODS:
- ReactCommon/callinvoker (= 1000.0.0)
- ReactCommon/turbomodule/core (= 1000.0.0)
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)

DEPENDENCIES:
- DoubleConversion (from `../third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../Libraries/FBReactNativeSpec`)
- FlipperKit (~> 0.30.1)
- FlipperKit/FlipperKitLayoutPlugin (~> 0.30.1)
- FlipperKit/FlipperKitReactPlugin (~> 0.30.1)
- FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.30.1)
- FlipperKit/SKIOSNetworkPlugin (~> 0.30.1)
- Folly (from `../third-party-podspecs/Folly.podspec`)
- glog (from `../third-party-podspecs/glog.podspec`)
- RCTRequired (from `../Libraries/RCTRequired`)
Expand Down Expand Up @@ -318,6 +376,17 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- boost-for-react-native
- CocoaAsyncSocket
- CocoaLibEvent
- Flipper
- Flipper-DoubleConversion
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- OpenSSL-Universal
- YogaKit

EXTERNAL SOURCES:
DoubleConversion:
Expand Down Expand Up @@ -379,11 +448,21 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 9806caa151956ce2238f70bde6649a6e3468d2c2
FBReactNativeSpec: 36a4e4488cc758ffceea8e1b3b5c6dab3ed99fa2
Flipper: 10b225e352595f521be0e5badddd90e241336e89
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: 2de3d03e0acc7064d5e4ed9f730e2f217486f162
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: 1260a31c05c238eabfa9bb8a64e3983049048371
FlipperKit: 88b7f0d0cf907ddc2137b85eeb7f3d4d8d9395c8
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355
RCTRequired: f04f9813bccb37099f642722b46e879fc47c7e78
RCTTypeSafety: 26a1a3b30655098b72d3954e3e7d0f9a7a059e95
React: 7b262249ab4afa1d300c9e90f50edcc2a5f72bcd
Expand All @@ -407,7 +486,8 @@ SPEC CHECKSUMS:
React-RCTVibration: e2856bb9408f7e8eccfe870e123e5644ab744219
ReactCommon: c3834cbee58b60f71c8155c04a3f44e60ec017fb
Yoga: f7fa200d8c49f97b54c9421079e781fb900b5cae
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 31cb1ffc6e72e1bbb948da2fb648d4f7aca92168
PODFILE CHECKSUM: 317625c4a1217b69f61b4979b58e9ef2f376f583

COCOAPODS: 1.8.4
30 changes: 30 additions & 0 deletions RNTester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#endif


#if DEBUG
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#endif
#endif

#import <ReactCommon/RCTTurboModuleManager.h>

#import "RNTesterTurboModuleProvider.h"
Expand Down Expand Up @@ -84,6 +97,7 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[self initializeFlipper:application];
return YES;
}

Expand All @@ -95,6 +109,22 @@ - (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
fallbackResource:nil];
}

- (void)initializeFlipper:(UIApplication *)application
{
#if DEBUG
#ifdef FB_SONARKIT_ENABLED
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application
withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
#endif
#endif
}

- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
Expand Down
Loading

0 comments on commit cb80e3b

Please sign in to comment.