Skip to content

Commit

Permalink
Update Fabric-related files to compile on OSS
Browse files Browse the repository at this point in the history
  • Loading branch information
empyrical committed Sep 1, 2020
1 parent 93e7a7a commit e9b5aa8
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ package-lock.json

# react-native-codegen
/packages/react-native-codegen/lib
/ReactCommon/fabric/components/rncore/
/ReactCommon/react/renderer/components/rncore/
/schema-native-modules.json
/schema-rncore.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#import <react/renderer/components/rncore/EventEmitters.h>
#import <react/renderer/components/rncore/Props.h>

#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"

using namespace facebook::react;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Class<RCTComponentViewProtocol> RCTParagraphCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTTextInputCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTInputAccessoryCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTImageCls(void) __attribute__((used));

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
{"TextInput", RCTTextInputCls},
{"InputAccessoryView", RCTInputAccessoryCls},
{"View", RCTViewCls},
{"Image",RCTImageCls},
};

auto p = sFabricComponentsClassMap.find(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <React/RCTUtils.h>
#import <react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h>
#import <react/renderer/components/safeareaview/SafeAreaViewState.h>
#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"
#import "RCTConversions.h"
#import "RCTFabricComponentsPlugins.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import <React/RCTRefreshableProtocol.h>
#import <React/RCTScrollViewComponentView.h>

#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"

using namespace facebook::react;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#import <react/renderer/components/rncore/Props.h>
#import <react/renderer/components/slider/SliderComponentDescriptor.h>

#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"

using namespace facebook::react;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import <react/renderer/components/rncore/Props.h>
#import <react/renderer/components/rncore/RCTComponentViewHelpers.h>

#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"

using namespace facebook::react;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import <React/RCTConversions.h>

#import "FBRCTFabricComponentsPlugins.h"
#import "RCTFabricComponentsPlugins.h"

using namespace facebook::react;

Expand Down
3 changes: 1 addition & 2 deletions React/Fabric/Mounting/RCTComponentViewFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ + (RCTComponentViewFactory *)standardComponentViewFactory
[componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTTextInputComponentView class]];

Class<RCTComponentViewProtocol> imageClass = RCTComponentViewClassWithName("Image");
[componentViewFactory registerComponentViewClass:imageClass];
[componentViewFactory registerComponentViewClass:[RCTImageComponentView class]];

auto providerRegistry = &componentViewFactory->_providerRegistry;

Expand Down
9 changes: 7 additions & 2 deletions React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Pod::Spec.new do |s|
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "10.0", :tvos => "10.0" }
s.source = source
s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}",
"Tests/**/*.{mm}"
s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}"
s.exclude_files = "**/tests/*",
"**/android/*",
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
Expand All @@ -46,4 +45,10 @@ Pod::Spec.new do |s|
s.dependency "React-Fabric", version
s.dependency "React-RCTImage", version
s.dependency "Folly/Fabric", folly_version

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = "Tests/**/*.{mm}"
test_spec.framework = "XCTest"
end

end
137 changes: 91 additions & 46 deletions ReactCommon/React-Fabric.podspec

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ReactCommon/react/renderer/graphics/React-graphics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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 Down Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.exclude_files = "**/tests/*",
"**/android/*",
"**/cxx/*"
s.header_dir = "react/graphics"
s.header_dir = "react/renderer/graphics"
s.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }

s.dependency "Folly/Fabric", folly_version
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/yoga/Yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pod::Spec.new do |spec|
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
spec.source_files = source_files

header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h'
header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h'
header_files = File.join('ReactCommon/yoga', header_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
spec.public_header_files = header_files
end
53 changes: 53 additions & 0 deletions scripts/generate-rncore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* 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.
*
* @format
*/

'use strict';

const path = require('path');
const fs = require('fs');
const glob = require('glob');
const RNCodegen = require('react-native-codegen/lib/generators/RNCodegen');
const combine = require('react-native-codegen/lib/cli/combine/combine-js-to-schema');

function generate(schema, outputDirectory) {
fs.mkdirSync(outputDirectory, {recursive: true});

RNCodegen.generate(
{
libraryName: 'rncore',
schema,
outputDirectory,
},
{generators: ['descriptors', 'events', 'props', 'shadow-nodes']},
);
}

function main() {
const rnDir = path.resolve(__dirname, '..');
const outputDirectory = path.resolve(
rnDir,
'ReactCommon',
'react',
'renderer',
'components',
'rncore',
);

const files = glob.sync('Libraries/**/*NativeComponent.js', {
cwd: path.resolve(__dirname, '..'),
});

const schema = combine(
files.map(file => path.resolve(__dirname, '..', file)),
);

generate(schema, outputDirectory);
}

main();
14 changes: 0 additions & 14 deletions scripts/generate-rncore.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def use_react_native! (options={})

if fabric_enabled
pod 'React-Fabric', :path => "#{prefix}/ReactCommon"
pod 'React-graphics', :path => "#{prefix}/ReactCommon/fabric/graphics"
pod 'React-graphics', :path => "#{prefix}/ReactCommon/react/renderer/graphics"
pod 'React-jsi/Fabric', :path => "#{prefix}/ReactCommon/jsi"
pod 'React-RCTFabric', :path => "#{prefix}/React"
pod 'RCT-Folly/Fabric', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec"
Expand Down

0 comments on commit e9b5aa8

Please sign in to comment.