Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ReactCommon/yoga/Yoga-umbrella.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif

#import "yoga/YGEnums.h"
#import "yoga/YGMacros.h"
#import "yoga/YGNode.h"
#import "yoga/YGStyle.h"
#import "yoga/YGValue.h"
#import "yoga/Yoga.h"

FOUNDATION_EXPORT double yogaVersionNumber;
FOUNDATION_EXPORT const unsigned char yogaVersionString[];
6 changes: 6 additions & 0 deletions ReactCommon/yoga/Yoga.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module yoga {
umbrella header "Yoga-umbrella.h"

export *
module * { export * }
}
24 changes: 19 additions & 5 deletions ReactCommon/yoga/Yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,25 @@ Pod::Spec.new do |spec|

# Set this environment variable when *not* using the `:path` option to install the pod.
# E.g. when publishing this spec to a spec repo.
source_files = 'yoga/**/*.{cpp,h}'
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
source_files = 'yoga/**/*.{cpp,h}', 'Yoga-umbrella.h'
source_files = source_files.map { |file| File.join('ReactCommon/yoga', file) } if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
spec.source_files = source_files

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
spec.module_map = 'Yoga.modulemap'

# CocoaPods custom `module_map` + `header_dir` doesn't put the umbrella header in right place.
# Ideally, modulemap should be placed with the umbrella header, that would work for both use_frameworks! mode and non use_frameworks! mode.
# This script copy the umbrella header back to right place.
spec.script_phase = {
:name => 'Copy umbrella header',
:input_files => ["$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h"],
:output_files => ["$PODS_ROOT/Headers/Private/Yoga/Yoga-umbrella.h"],
:execution_position => :before_compile,
:shell_path => '/bin/bash',

# In use_frameworks! mode, the umbrella header will by copied to right place.
# This copy command will fail because "$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h" doesn't exist.
# The command is just a no-op in use_frameworks! mode.
:script => 'cp -f "$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h" "$PODS_ROOT/Headers/Private/Yoga/Yoga-umbrella.h" || true',
}
end
12 changes: 6 additions & 6 deletions scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ def modify_flags_for_new_architecture(installer, cpp_flags)
config_file.save_as(xcconfig_path)
end
end
# Add RCT_NEW_ARCH_ENABLED to Pods project xcconfig
installer.pods_project.targets.each do |target|
# if target.name == 'React-Core'
if target.name == 'React-Core'
puts "#{target.name}"
target.build_configurations.each do |config|

# Add RCT_NEW_ARCH_ENABLED to generated pod target projects
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
if pod_name == 'React-Core'
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['OTHER_CPLUSPLUSFLAGS'] = cpp_flags
end
end
Expand Down