mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 17:45:59 +00:00
545072b02d
Summary: A bit late to the party, but upgraded, tests replaced, all green. Also updated `pbxproj` so that we are testing against React 0.40 init result, not against something old. To cherry-pick and land once ships. Closes https://github.com/facebook/react-native/pull/11868 Differential Revision: D4411362 fbshipit-source-id: c485fd76114979d34a7e288bb70e1ecb9b3baf76
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
/**
|
|
* Given Xcode project and path, iterate over all build configurations
|
|
* and execute func with HEADER_SEARCH_PATHS from current section
|
|
*
|
|
* We cannot use builtin addToHeaderSearchPaths method since react-native init does not
|
|
* use $(TARGET_NAME) for PRODUCT_NAME, but sets it manually so that method will skip
|
|
* that target.
|
|
*
|
|
* To workaround that issue and make it more bullet-proof for different names,
|
|
* we iterate over all configurations and look for `lc++` linker flag to detect
|
|
* React Native target.
|
|
*
|
|
* Important: That function mutates `buildSettings` and it's not pure thus you should
|
|
* not rely on its return value
|
|
*/
|
|
const defaultHeaderPaths = ['"$(inherited)"'];
|
|
|
|
module.exports = function headerSearchPathIter(project, func) {
|
|
const config = project.pbxXCBuildConfigurationSection();
|
|
|
|
Object
|
|
.keys(config)
|
|
.filter(ref => ref.indexOf('_comment') === -1)
|
|
.forEach(ref => {
|
|
const buildSettings = config[ref].buildSettings;
|
|
const shouldVisitBuildSettings = (
|
|
Array.isArray(buildSettings.OTHER_LDFLAGS) ?
|
|
buildSettings.OTHER_LDFLAGS :
|
|
[]
|
|
)
|
|
.indexOf('"-lc++"') >= 0;
|
|
|
|
if (shouldVisitBuildSettings) {
|
|
buildSettings.HEADER_SEARCH_PATHS = func(
|
|
buildSettings.HEADER_SEARCH_PATHS || defaultHeaderPaths
|
|
);
|
|
}
|
|
});
|
|
};
|