Skip to content

Commit

Permalink
TM iOS: refactor header dir for TM
Browse files Browse the repository at this point in the history
Summary:
For better cocoapods compatibility, refactored TM podspec to be a subspec of ReactCommon, then use `<ReactCommon/` header prefix for all TM files.

Relevant efforts:
#25619
#25393

Reviewed By: hramos

Differential Revision: D16231697

fbshipit-source-id: 38d3418b19978ff54aa0c61b064ac45ac0e1c36c
  • Loading branch information
fkgozali authored and facebook-github-bot committed Jul 13, 2019
1 parent 1914d9a commit 6e7ce9c
Show file tree
Hide file tree
Showing 37 changed files with 98 additions and 160 deletions.
2 changes: 1 addition & 1 deletion Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Pod::Spec.new do |s|
s.dependency "RCTRequired", version
s.dependency "RCTTypeSafety", version
s.dependency "React-Core", version
s.dependency "React-turbomodule-core", version
s.dependency "ReactCommon/turbomodule/core", version
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTCxxConvert.h>
#import <React/RCTManagedPointer.h>
#import <ReactCommon/RCTTurboModule.h>
#import <folly/Optional.h>
#import <jsireact/RCTTurboModule.h>
#import <vector>


Expand Down
2 changes: 1 addition & 1 deletion RNTester/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def pods()

# Enable TurboModule
use_react_native!(path: "..")
pod 'React-turbomodule-samples', :path => '../ReactCommon/turbomodule/samples'
pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon'

# Additional Pods which aren't included in the default Podfile
pod 'React-ART', :path => '../Libraries/ART'
Expand Down
44 changes: 15 additions & 29 deletions RNTester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PODS:
- RCTRequired (= 1000.0.0)
- RCTTypeSafety (= 1000.0.0)
- React-Core (= 1000.0.0)
- React-turbomodule-core (= 1000.0.0)
- ReactCommon/turbomodule/core (= 1000.0.0)
- Folly (2018.10.22.00):
- boost-for-react-native
- DoubleConversion
Expand Down Expand Up @@ -122,34 +122,23 @@ PODS:
- React-Core (= 1000.0.0)
- React-RCTWebSocket (1000.0.0):
- React-Core (= 1000.0.0)
- React-turbomodule-core (1000.0.0):
- ReactCommon/turbomodule/core (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-Core/CxxBridge (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jscallinvoker (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-core/core-ios (= 1000.0.0)
- React-turbomodule-core/core-ios (1000.0.0):
- ReactCommon/turbomodule/samples (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-Core/CxxBridge (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jscallinvoker (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-samples (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-core (= 1000.0.0)
- React-turbomodule-samples/samples-ios (= 1000.0.0)
- React-turbomodule-samples/samples-ios (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-core (= 1000.0.0)
- ReactCommon/turbomodule/core (= 1000.0.0)
- yoga (1000.0.0.React)

DEPENDENCIES:
Expand Down Expand Up @@ -182,8 +171,8 @@ DEPENDENCIES:
- React-RCTText (from `../Libraries/Text`)
- React-RCTVibration (from `../Libraries/Vibration`)
- React-RCTWebSocket (from `../Libraries/WebSocket`)
- React-turbomodule-core (from `../ReactCommon/turbomodule/core`)
- React-turbomodule-samples (from `../ReactCommon/turbomodule/samples`)
- ReactCommon/turbomodule/core (from `../ReactCommon`)
- ReactCommon/turbomodule/samples (from `../ReactCommon`)
- yoga (from `../ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -249,18 +238,16 @@ EXTERNAL SOURCES:
:path: "../Libraries/Vibration"
React-RCTWebSocket:
:path: "../Libraries/WebSocket"
React-turbomodule-core:
:path: "../ReactCommon/turbomodule/core"
React-turbomodule-samples:
:path: "../ReactCommon/turbomodule/samples"
ReactCommon:
:path: "../ReactCommon"
yoga:
:path: "../ReactCommon/yoga"

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
FBLazyVector: 34431b7e61740bed29b082ff81500b0ffafaffa0
FBReactNativeSpec: 60bf4c6b7cd868b2878f2d3556e37ecfd5e51a17
FBReactNativeSpec: 0b697c23db60351a2ae629e110581cdefbe5e939
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
RCTRequired: 33f3b89d2d82ef01c02b9b4f8146c43762e509d8
Expand All @@ -287,10 +274,9 @@ SPEC CHECKSUMS:
React-RCTText: 469ec754592c92fc639825e558908c2f0e783e2c
React-RCTVibration: ade3c169b54f3bc16c9a9918e17e48ef66aee6ba
React-RCTWebSocket: cb5317e9a4adc37191660f819fb21d63433584ef
React-turbomodule-core: 5cce62fb65bd0b19f249bc1c4c54b82b3cf9a749
React-turbomodule-samples: ef5c144b510530cb108d4bdb8615dc3943a802fd
ReactCommon: 85e9a652d56873ab4e91820ecd759ca006dc1b56
yoga: b72aa5b3708cc93c5897f8297122d6eba1331e07

PODFILE CHECKSUM: 5ebd7e7531d9b6db21435251001600722f432414
PODFILE CHECKSUM: f866eab42001b1d59349bce6b20d00912cdc700c

COCOAPODS: 1.7.1
2 changes: 1 addition & 1 deletion RNTester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

#ifdef RN_TURBO_MODULE_ENABLED
#import <jsireact/RCTTurboModuleManager.h>
#import <ReactCommon/RCTTurboModuleManager.h>

#import "RNTesterTurboModuleProvider.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion RNTester/RNTester/RNTesterTurboModuleProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#ifdef RN_TURBO_MODULE_ENABLED

#import <jsireact/RCTTurboModule.h>
#import <ReactCommon/RCTTurboModule.h>

namespace facebook {
namespace react {
Expand Down
4 changes: 2 additions & 2 deletions RNTester/RNTester/RNTesterTurboModuleProvider.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#import "RNTesterTurboModuleProvider.h"

#import <React/CoreModulesPlugins.h>
#import <jsireact/SampleTurboCxxModule.h>
#import <jsireact/RCTSampleTurboModule.h>
#import <ReactCommon/SampleTurboCxxModule.h>
#import <ReactCommon/RCTSampleTurboModule.h>

// NOTE: This entire file should be codegen'ed.

Expand Down
8 changes: 0 additions & 8 deletions RNTester/RNTesterPods.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@
E7DB211822B2BD53005AC45F /* libReact-RCTText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTText.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTVibration.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB211C22B2BD53005AC45F /* libReact-RCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTWebSocket.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB211E22B2BD53005AC45F /* libReact-turbomodule-core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-turbomodule-core.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB212022B2BD53005AC45F /* libReact-turbomodule-samples.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-turbomodule-samples.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB212222B2BD53005AC45F /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB212422B2C342005AC45F /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = "<group>"; };
E7DB212622B2C342005AC45F /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -272,8 +270,6 @@
E7DB211822B2BD53005AC45F /* libReact-RCTText.a */,
E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */,
E7DB211C22B2BD53005AC45F /* libReact-RCTWebSocket.a */,
E7DB211E22B2BD53005AC45F /* libReact-turbomodule-core.a */,
E7DB212022B2BD53005AC45F /* libReact-turbomodule-samples.a */,
E7DB212222B2BD53005AC45F /* libyoga.a */,
8508AD3C1DC3509924E63948 /* libPods-RNTester.a */,
5DC8BF45A723792FE216DDD4 /* libPods-RNTesterIntegrationTests.a */,
Expand Down Expand Up @@ -768,8 +764,6 @@
"-l\"React-jsi\"",
"-l\"React-jsiexecutor\"",
"-l\"React-jsinspector\"",
"-l\"React-turbomodule-core\"",
"-l\"React-turbomodule-samples\"",
"-l\"glog\"",
"-l\"stdc++\"",
"-l\"yoga\"",
Expand Down Expand Up @@ -848,8 +842,6 @@
"-l\"React-jsi\"",
"-l\"React-jsiexecutor\"",
"-l\"React-jsinspector\"",
"-l\"React-turbomodule-core\"",
"-l\"React-turbomodule-samples\"",
"-l\"glog\"",
"-l\"stdc++\"",
"-l\"yoga\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# Header search path for all source files in this module.
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jsireact
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ReactCommon

# Header search path for modules that depend on this module
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
Expand All @@ -22,8 +22,8 @@ LOCAL_SHARED_LIBRARIES = libfb
# Name of this module.
LOCAL_MODULE := jscallinvokerholder

# Compile all local c++ files under ./platform/android/jsireact
LOCAL_SRC_FILES := $(LOCAL_PATH)/jsireact/JSCallInvokerHolder.cpp
# Compile all local c++ files
LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/JSCallInvokerHolder.cpp

# Build the files in this directory as a shared library
include $(BUILD_STATIC_LIBRARY)
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "
rn_xplat_cxx_library(
name = "jni",
srcs = [
"jsireact/OnLoad.cpp",
"jsireact/TurboModuleManager.cpp",
"ReactCommon/OnLoad.cpp",
"ReactCommon/TurboModuleManager.cpp",
],
header_namespace = "",
exported_headers = {
"jsireact/TurboModuleManager.h": "jsireact/TurboModuleManager.h",
"jsireact/TurboModuleManagerDelegate.h": "jsireact/TurboModuleManagerDelegate.h",
"ReactCommon/TurboModuleManager.h": "ReactCommon/TurboModuleManager.h",
"ReactCommon/TurboModuleManagerDelegate.h": "ReactCommon/TurboModuleManagerDelegate.h",
},
compiler_flags = [
"-fexceptions",
Expand Down Expand Up @@ -40,11 +40,11 @@ rn_xplat_cxx_library(
rn_xplat_cxx_library(
name = "jscallinvokerholder",
srcs = [
"jsireact/JSCallInvokerHolder.cpp",
"ReactCommon/JSCallInvokerHolder.cpp",
],
header_namespace = "",
exported_headers = {
"jsireact/JSCallInvokerHolder.h": "jsireact/JSCallInvokerHolder.h",
"ReactCommon/JSCallInvokerHolder.h": "ReactCommon/JSCallInvokerHolder.h",
},
compiler_flags = [
"-fexceptions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <fb/fbjni.h>
#include <jsi/jsi.h>

#include <jsireact/TurboModuleBinding.h>
#include <jsireact/TurboCxxModule.h>
#include <ReactCommon/TurboModuleBinding.h>
#include <ReactCommon/TurboCxxModule.h>
#include <react/jni/JMessageQueueThread.h>

#include "TurboModuleManager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#include <memory>
#include <fb/fbjni.h>
#include <jsi/jsi.h>
#include <jsireact/TurboModule.h>
#include <jsireact/JavaTurboModule.h>
#include <ReactCommon/TurboModule.h>
#include <ReactCommon/JavaTurboModule.h>
#include <react/jni/CxxModuleWrapper.h>
#include <react/jni/JMessageQueueThread.h>
#include <jsireact/JSCallInvokerHolder.h>
#include <jsireact/TurboModuleManagerDelegate.h>
#include <ReactCommon/JSCallInvokerHolder.h>
#include <ReactCommon/TurboModuleManagerDelegate.h>

namespace facebook {
namespace react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma once

#include <fb/fbjni.h>
#include <jsireact/JavaTurboModule.h>
#include <ReactCommon/JavaTurboModule.h>
#include <jsireact/JSCallInvoker.h>
#include <string>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <folly/Memory.h>
#include <jni/Countable.h>
#include <jni/LocalReference.h>
#include <jsireact/JSCallInvokerHolder.h>
#include <ReactCommon/JSCallInvokerHolder.h>

#include "CxxModuleWrapper.h"
#include "JavaScriptExecutorHolder.h"
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <fb/fbjni.h>
#include <folly/Memory.h>
#include <jsireact/JSCallInvokerHolder.h>
#include <ReactCommon/JSCallInvokerHolder.h>
#include <jsireact/BridgeJSCallInvoker.h>

#include "CxxModuleWrapper.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

require "json"

package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
version = package['version']

source = { :git => 'https://github.com/facebook/react-native.git' }
Expand All @@ -22,28 +22,39 @@ folly_version = '2018.10.22.00'
boost_compiler_flags = '-Wno-documentation'

Pod::Spec.new do |s|
s.name = "React-turbomodule-core"
s.name = "ReactCommon"
s.module_name = "ReactCommon"
s.version = version
s.summary = "-" # TODO
s.homepage = "http://facebook.github.io/react-native/"
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "9.0", :tvos => "9.2" }
s.source = source
s.source_files = "*.{cpp,h}"
s.header_dir = "ReactCommon" # Use global header_dir for all subspecs for use_framework compatibility
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.header_dir = "jsireact"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_TURBO_MODULE_ENABLED" }

s.dependency "React-Core/CxxBridge", version
s.dependency "React-cxxreact", version
s.dependency "React-jsi", version
s.dependency "Folly", folly_version
s.dependency "React-jscallinvoker", version

s.subspec "core-ios" do |ss|
ss.source_files = "platform/ios/*.{mm,cpp,h}"
ss.header_dir = "jsireact"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }

s.subspec "turbomodule" do |ss|
ss.dependency "React-Core/CxxBridge", version
ss.dependency "React-cxxreact", version
ss.dependency "React-jsi", version
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.dependency "React-jscallinvoker", version

ss.subspec "core" do |sss|
sss.source_files = "turbomodule/core/*.{cpp,h}",
"turbomodule/core/platform/ios/*.{mm,cpp,h}"
end

ss.subspec "samples" do |sss|
sss.source_files = "turbomodule/samples/*.{cpp,h}",
"turbomodule/samples/platform/ios/*.{mm,cpp,h}"
sss.dependency "ReactCommon/turbomodule/core", version
end
end
end
6 changes: 3 additions & 3 deletions ReactCommon/turbomodule/core/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rn_xplat_cxx_library(
[
("", "*.h"),
],
prefix = "jsireact",
prefix = "ReactCommon",
),
compiler_flags = [
"-fexceptions",
Expand All @@ -26,7 +26,7 @@ rn_xplat_cxx_library(
[
("platform/android", "*.h"),
],
prefix = "jsireact",
prefix = "ReactCommon",
),
fbandroid_srcs = glob(
[
Expand All @@ -50,7 +50,7 @@ rn_xplat_cxx_library(
[
("platform/ios", "*.h"),
],
prefix = "jsireact",
prefix = "ReactCommon",
),
ios_frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/turbomodule/core/TurboCxxModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include <vector>

#include <ReactCommon/TurboModuleUtils.h>
#include <jsi/JSIDynamic.h>
#include <jsireact/TurboModuleUtils.h>

using namespace facebook;
using namespace facebook::xplat::module;
Expand Down
Loading

0 comments on commit 6e7ce9c

Please sign in to comment.