This commit is contained in:
Pritesh Nandgaonkar
2018-06-01 11:50:29 +01:00
parent fbbf8cf16b
commit 674eeddd62
12 changed files with 810 additions and 698 deletions

View File

@@ -10,7 +10,9 @@ target 'SonarKit' do
# Pods for SonarKit
# Third party deps podspec link
pod 'EasyWSClient', :podspec => 'third-party-podspecs/EasyWSClient.podspec'
#pod 'EasyWSClient', :podspec => 'third-party-podspecs/EasyWSClient.podspec'
pod 'RSocket', :podspec => 'third-party-podspecs/RSocket.podspec'
pod 'LibEvent', :podspec => 'third-party-podspecs/LibEvent.podspec'
pod 'DoubleConversion', :podspec => 'third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => 'third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => 'third-party-podspecs/Folly.podspec'

View File

@@ -6,6 +6,7 @@ swift_version = "4.1"
target 'Sample' do
pod 'RSocket', :podspec => '../third-party-podspecs/RSocket.podspec'
pod 'EasyWSClient', :podspec => '../third-party-podspecs/EasyWSClient.podspec'
pod 'DoubleConversion', :podspec => '../third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../third-party-podspecs/glog.podspec'

View File

@@ -11,9 +11,11 @@ PODS:
- glog
- glog (0.3.5)
- PeerTalk (0.0.2)
- Sonar (1.0.0):
- EasyWSClient
- RSocket (0.10.0):
- Folly
- Sonar (1.0.0):
- Folly
- RSocket
- SonarKit (1.0.0):
- CocoaAsyncSocket (~> 7.6)
- Folly
@@ -61,6 +63,7 @@ DEPENDENCIES:
- Folly (from `../third-party-podspecs/Folly.podspec`)
- glog (from `../third-party-podspecs/glog.podspec`)
- PeerTalk (from `https://github.com/rsms/peertalk`)
- RSocket (from `../third-party-podspecs/RSocket.podspec`)
- Sonar (from `../../xplat/Sonar/SonarKitCPP.podspec`)
- SonarKit (from `../SonarKit.podspec`)
- SonarKit/SKIOSNetworkPlugin (from `../SonarKit.podspec`)
@@ -87,6 +90,8 @@ EXTERNAL SOURCES:
:podspec: "../third-party-podspecs/glog.podspec"
PeerTalk:
:git: https://github.com/rsms/peertalk
RSocket:
:podspec: "../third-party-podspecs/RSocket.podspec"
Sonar:
:podspec: "../../xplat/Sonar/SonarKitCPP.podspec"
SonarKit:
@@ -94,7 +99,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
ComponentKit:
:commit: f801317e71f88fbb5a398cd726fc0375255f43ba
:commit: b95daa7e2cfdfe0a23a42d7fba9b5d4c2a3fa26f
:git: https://github.com/facebook/ComponentKit.git
EasyWSClient:
:commit: 9b87dc488048900a8cd684f51ddc98143682dbc3
@@ -102,11 +107,14 @@ CHECKOUT OPTIONS:
PeerTalk:
:commit: 588303b43efa5082d654b6f75d1b84a6ba4b5b9e
:git: https://github.com/rsms/peertalk
RSocket:
:commit: 804eabc02afdec8756a16517e4513ec9301a3315
:git: https://github.com/rsocket/rsocket-cpp.git
Sonar:
:commit: 26c298ad3401157ac2b7336218c1dde63260dc0c
:commit: 749a10a3d9d0dc50e5a9d3bc169fc395d04bc2a7
:git: https://github.com/facebook/Sonar.git
SonarKit:
:commit: 26c298ad3401157ac2b7336218c1dde63260dc0c
:commit: 749a10a3d9d0dc50e5a9d3bc169fc395d04bc2a7
:git: https://github.com/facebook/Sonar.git
SPEC CHECKSUMS:
@@ -115,14 +123,15 @@ SPEC CHECKSUMS:
ComponentKit: 7bd0ad508946aeb68dd52ed8739ced9846ff3671
DoubleConversion: 310ccd7cdf00175c32883664f84fe026025604df
EasyWSClient: 7ec8effe7d86f6061a47d19a55355769c9edfd2f
Folly: 2d29ed217455246ae583ff1980f9ce882af31e80
Folly: 56bd0a5ea77ab53f6d2d9430630abf032f7a2f47
glog: f175af2df1f453be65bd355b287a07c842927a99
PeerTalk: f5389c286e4d477e59b73dfbf25c5c70a2464761
Sonar: 815b6c6357c78564d9132f6389605b285a06f052
SonarKit: 29b45073b54d7f5db13e53b7afe6fb6f36c6bea7
RSocket: e586a757b9930d5883f4f6c6777b63f039fa29b1
Sonar: 11c708680d507fbd8e92f7680b7ee5c12f266cc3
SonarKit: 4339c0d24ea14b6886d2076f4425e09e37e4f877
Yoga: e6f1fed82138c17da5332e15e5770abf0e9cc386
YogaKit: bb90d11e297e06abef7e0cfb20e035a6bd00cdc4
PODFILE CHECKSUM: cab936292346d86ef8900c8f67d3c707dc421709
PODFILE CHECKSUM: f67d4f69bb6ca79134e34c687d56ca73a63640df
COCOAPODS: 1.5.2
COCOAPODS: 1.5.2

View File

@@ -17,8 +17,9 @@ Pod::Spec.new do |spec|
spec.dependency 'Sonar'
spec.dependency 'CocoaAsyncSocket', '~> 7.6'
spec.dependency 'PeerTalk'
spec.source_files = 'iOS/FBDefines/*.{h,cpp,m,mm}', 'iOS/SonarKit/**/*.{h,cpp,m,mm}'
spec.source_files = 'iOS/FBDefines/*.{h,cpp,m,mm}', 'iOS/SonarKit/**/*.{h,cpp,m,mm}', 'iOS/SonarKit/FBCxxUtils/*.{h, mm}',
spec.public_header_files = 'iOS/SonarKit/CppBridge/*.{h}',
'iOS/SonarKit/FBCxxUtils/*.{h}',
'iOS/SonarKit/SonarClient.h',
'iOS/SonarKit/SonarDeviceData.h',
'iOS/SonarKit/SonarPlugin.h',
@@ -30,7 +31,7 @@ Pod::Spec.new do |spec|
spec.compiler_flags = '-DFB_SONARKIT_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0'
spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\"/** \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/ComponentKit\"/**" }
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\"/** \"$(PODS_ROOT)/boost-for-react-native\" \"/usr/local/include\" \"/usr/local/Cellar/openssl/1.0.2o_1/include\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/ComponentKit\"/**" }
spec.platforms = { :ios => "8.0", :tvos => "9.2" }
spec.subspec "SonarKitLayoutPlugin" do |ss|

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#import <Foundation/Foundation.h>
#include <folly/dynamic.h>
namespace facebook {
namespace cxxutils {
folly::dynamic convertIdToFollyDynamic(id json);
id convertFollyDynamicToId(const folly::dynamic &dyn);
} }

View File

@@ -0,0 +1,110 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#import "FBCxxFollyDynamicConvert.h"
#import <objc/runtime.h>
namespace facebook {
namespace cxxutils {
/*
* The implementation is taken from RCTFollyConvert(https://fburl.com/vzw8ql2q)
*/
id convertFollyDynamicToId(const folly::dynamic &dyn) {
// I could imagine an implementation which avoids copies by wrapping the
// dynamic in a derived class of NSDictionary. We can do that if profiling
// implies it will help.
switch (dyn.type()) {
case folly::dynamic::NULLT:
return (id)kCFNull;
case folly::dynamic::BOOL:
return dyn.getBool() ? @YES : @NO;
case folly::dynamic::INT64:
return @(dyn.getInt());
case folly::dynamic::DOUBLE:
return @(dyn.getDouble());
case folly::dynamic::STRING:
return [[NSString alloc] initWithBytes:dyn.c_str() length:dyn.size()
encoding:NSUTF8StringEncoding];
case folly::dynamic::ARRAY: {
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:dyn.size()];
for (auto &elem : dyn) {
[array addObject:convertFollyDynamicToId(elem)];
}
return array;
}
case folly::dynamic::OBJECT: {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:dyn.size()];
for (auto &elem : dyn.items()) {
dict[convertFollyDynamicToId(elem.first)] = convertFollyDynamicToId(elem.second);
}
return dict;
}
}
}
folly::dynamic convertIdToFollyDynamic(id json)
{
if (json == nil || json == (id)kCFNull) {
return nullptr;
} else if ([json isKindOfClass:[NSNumber class]]) {
const char *objCType = [json objCType];
switch (objCType[0]) {
// This is a c++ bool or C99 _Bool. On some platforms, BOOL is a bool.
case _C_BOOL:
return (bool) [json boolValue];
case _C_CHR:
// On some platforms, objc BOOL is a signed char, but it
// might also be a small number. Use the same hack JSC uses
// to distinguish them:
// https://phabricator.intern.facebook.com/diffusion/FBS/browse/master/fbobjc/xplat/third-party/jsc/safari-600-1-4-17/JavaScriptCore/API/JSValue.mm;b8ee03916489f8b12143cd5c0bca546da5014fc9$901
if ([json isKindOfClass:[@YES class]]) {
return (bool) [json boolValue];
} else {
return [json longLongValue];
}
case _C_UCHR:
case _C_SHT:
case _C_USHT:
case _C_INT:
case _C_UINT:
case _C_LNG:
case _C_ULNG:
case _C_LNG_LNG:
case _C_ULNG_LNG:
return [json longLongValue];
case _C_FLT:
case _C_DBL:
return [json doubleValue];
// default:
// fall through
}
} else if ([json isKindOfClass:[NSString class]]) {
NSData *data = [json dataUsingEncoding:NSUTF8StringEncoding];
return std::string(reinterpret_cast<const char*>(data.bytes),
data.length);
} else if ([json isKindOfClass:[NSArray class]]) {
folly::dynamic array = folly::dynamic::array;
for (id element in json) {
array.push_back(convertIdToFollyDynamic(element));
}
return array;
} else if ([json isKindOfClass:[NSDictionary class]]) {
__block folly::dynamic object = folly::dynamic::object();
[json enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, __unused BOOL *stop) {
object.insert(convertIdToFollyDynamic(key),
convertIdToFollyDynamic(value));
}];
return object;
}
return nil;
}
} }

24
iOS/SonarKit/Info.plist Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@@ -25,6 +25,7 @@ Pod::Spec.new do |spec|
'folly/memory/detail/MallocImpl.cpp',
'folly/String.cpp',
'folly/*.cpp',
'folly/portability/*.cpp',
'folly/ScopeGuard.h',
'folly/lang/ColdClass.cpp',
'folly/lang/Assume.h',
@@ -44,10 +45,8 @@ Pod::Spec.new do |spec|
spec.header_dir = 'folly'
spec.libraries = "stdc++"
spec.private_header_files = 'folly/portability/Stdlib.h',
'folly/portability/Malloc.h',
'folly/portability/Stdlib.h',
'folly/portability/Stdio.h',
'folly/portability/PThread.h'
'folly/portability/Stdio.h'
spec.public_header_files = 'folly/portability/Config.h',
'folly/Executor.h',
'folly/Function.h',
@@ -81,14 +80,16 @@ Pod::Spec.new do |spec|
'folly/FBString.h',
'folly/hash/Hash.h',
'folly/memory/Malloc.h',
'folly/io/async/AsyncTimeout.h',
'folly/**/*.h',
'folly/memory/detail/MallocImpl.h',
'folly/String.h',
'folly/*.h'
'folly/*.h',
'folly/portability/PThread.h'
spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++11",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\"" }
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"/usr/local/Cellar/openssl/1.0.2o_1/include\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\"" }
# Pinning to the same version as React.podspec.
spec.platforms = { :ios => "8.0", :tvos => "10.0" }

View File

@@ -0,0 +1,14 @@
# This podspec is not being used instead the hard coded path to local LibEvent is used.
# TODO use this spec instead of hard coded path `/usr/local/include`
Pod::Spec.new do |spec|
spec.name = 'LibEvent'
spec.version = '2.1.8'
spec.license = { :file => 'LICENSE'}
spec.homepage = 'https://github.com/rsocket/rsocket-cpp'
spec.summary = 'LibEvent'
spec.authors = 'LibEvent'
spec.source = { :git => 'https://github.com/libevent/libevent.git', :tag => "release-2.1.8-stable"}
spec.module_name = 'LibEvent'
spec.source_files = '**/*.h'
spec.platforms = { :ios => "8.0", :tvos => "9.2" }
end

View File

@@ -0,0 +1,50 @@
Pod::Spec.new do |spec|
spec.name = 'RSocket'
spec.version = '0.10.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/rsocket/rsocket-cpp'
spec.summary = 'C++ implementation of RSocket'
spec.authors = 'Facebook'
spec.source = { :git => 'https://github.com/rsocket/rsocket-cpp.git', :branch => "master"}
spec.module_name = 'RSocket'
spec.source_files = 'rsocket/benchmarks/*',
'rsocket/framing/*',
'rsocket/internal/*',
'rsocket/statemachine/*',
'rsocket/transports/*',
'yarnpl/**/*'
spec.libraries = "stdc++"
spec.compiler_flags = '-std=c++1y'
spec.dependency 'Folly'
spec.compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0 -frtti
-fexceptions
-std=c++14
-Wno-error
-Wno-unused-local-typedefs
-Wno-unused-variable
-Wno-sign-compare
-Wno-comment
-Wno-return-type
-Wno-global-constructors'
spec.preserve_paths = 'rsocket/benchmarks/*.h',
'rsocket/framing/*.h',
'rsocket/internal/*.h',
'rsocket/statemachine/*.h',
'rsocket/transports/*.h',
'rsocket/*.h',
'yarnpl/flowable/*.h',
'yarnpl/observable/*.h',
'yarnpl/perf/*.h',
'yarnpl/single/*.h',
'yarnpl/utils/*.h',
'yarnpl/*.h',
'**/*.h'
spec.header_mappings_dir = './*'
spec.header_dir = './*'
spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\"/** \"/usr/local/include\" \"/usr/local/Cellar/openssl/1.0.2o_1/include\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/DoubleConversion\"/**" }
spec.platforms = { :ios => "8.0", :tvos => "9.2" }
end