@@ -47,11 +47,25 @@ Pod::Spec.new do |spec|
47
47
48
48
# Set this environment variable when *not* using the `:path` option to install the pod.
49
49
# E.g. when publishing this spec to a spec repo.
50
- source_files = 'yoga/**/*.{cpp,h}'
51
- source_files = File . join ( 'ReactCommon/yoga' , source_files ) if ENV [ 'INSTALL_YOGA_WITHOUT_PATH_OPTION' ]
50
+ source_files = 'yoga/**/*.{cpp,h}' , 'Yoga-umbrella.h'
51
+ source_files = source_files . map { | file | File . join ( 'ReactCommon/yoga' , file ) } if ENV [ 'INSTALL_YOGA_WITHOUT_PATH_OPTION' ]
52
52
spec . source_files = source_files
53
53
54
- header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGNode,YGStyle,YGValue}.h'
55
- header_files = File . join ( 'ReactCommon/yoga' , header_files ) if ENV [ 'INSTALL_YOGA_WITHOUT_PATH_OPTION' ]
56
- spec . public_header_files = header_files
54
+ spec . module_map = 'Yoga.modulemap'
55
+
56
+ # CocoaPods custom `module_map` + `header_dir` doesn't put the umbrella header in right place.
57
+ # Ideally, modulemap should be placed with the umbrella header, that would work for both use_frameworks! mode and non use_frameworks! mode.
58
+ # This script copy the umbrella header back to right place.
59
+ spec . script_phase = {
60
+ :name => 'Copy umbrella header' ,
61
+ :input_files => [ "$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h" ] ,
62
+ :output_files => [ "$PODS_ROOT/Headers/Private/Yoga/Yoga-umbrella.h" ] ,
63
+ :execution_position => :before_compile ,
64
+ :shell_path => '/bin/bash' ,
65
+
66
+ # In use_frameworks! mode, the umbrella header will by copied to right place.
67
+ # This copy command will fail because "$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h" doesn't exist.
68
+ # The command is just a no-op in use_frameworks! mode.
69
+ :script => 'cp -f "$PODS_ROOT/Headers/Public/Yoga/yoga/Yoga-umbrella.h" "$PODS_ROOT/Headers/Private/Yoga/Yoga-umbrella.h" || true' ,
70
+ }
57
71
end
0 commit comments