Skip to content

Commit af1a619

Browse files
committed
expose all yoga headers but not for modular headers
1 parent 55adbf2 commit af1a619

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

ReactCommon/yoga/Yoga-umbrella.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifdef __OBJC__
2+
#import <UIKit/UIKit.h>
3+
#else
4+
#ifndef FOUNDATION_EXPORT
5+
#if defined(__cplusplus)
6+
#define FOUNDATION_EXPORT extern "C"
7+
#else
8+
#define FOUNDATION_EXPORT extern
9+
#endif
10+
#endif
11+
#endif
12+
13+
#import "yoga/YGEnums.h"
14+
#import "yoga/YGMacros.h"
15+
#import "yoga/YGNode.h"
16+
#import "yoga/YGStyle.h"
17+
#import "yoga/YGValue.h"
18+
#import "yoga/Yoga.h"
19+
20+
FOUNDATION_EXPORT double yogaVersionNumber;
21+
FOUNDATION_EXPORT const unsigned char yogaVersionString[];

ReactCommon/yoga/Yoga.modulemap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
framework module yoga {
2+
umbrella header "Yoga-umbrella.h"
3+
4+
export *
5+
module * { export * }
6+
}

ReactCommon/yoga/Yoga.podspec

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,25 @@ Pod::Spec.new do |spec|
4747

4848
# Set this environment variable when *not* using the `:path` option to install the pod.
4949
# 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']
5252
spec.source_files = source_files
5353

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+
}
5771
end

0 commit comments

Comments
 (0)