Correctly handle the case where HEADER_SEARCH_PATHS is a single string

Reviewed By: ericvicenti

Differential Revision: D5519379

fbshipit-source-id: a07ea0629f98c23e1027202cc7a7957233780643
This commit is contained in:
Hector Ramos 2017-08-04 15:14:59 -07:00 committed by Facebook Github Bot
parent ac43548063
commit 23f72a9eb9
3 changed files with 18 additions and 9 deletions

View File

@ -877,9 +877,7 @@
);
PRODUCT_NAME = Basic;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
);
HEADER_SEARCH_PATHS = "$(inherited)";
};
name = Debug;
};
@ -897,9 +895,7 @@
);
PRODUCT_NAME = Basic;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
);
HEADER_SEARCH_PATHS = "$(inherited)";
};
name = Release;
};

View File

@ -23,4 +23,15 @@ describe('ios::mapHeaderSearchPaths', () => {
expect(callback.mock.calls.length).toBe(2);
});
it('calls the function with an array of paths, given a project with one', () => {
const callback = jest.fn();
mapHeaderSearchPaths(project, callback);
const paths = callback.mock.calls[0][0];
expect(paths instanceof Array).toBe(true);
expect(paths.length).toBe(1);
expect(paths[0]).toBe('"$(inherited)"');
});
});

View File

@ -31,9 +31,11 @@ module.exports = function headerSearchPathIter(project, func) {
.indexOf('"-lc++"') >= 0;
if (shouldVisitBuildSettings) {
buildSettings.HEADER_SEARCH_PATHS = func(
buildSettings.HEADER_SEARCH_PATHS || defaultHeaderPaths
);
const searchPaths = buildSettings.HEADER_SEARCH_PATHS ?
[].concat(buildSettings.HEADER_SEARCH_PATHS) :
defaultHeaderPaths;
buildSettings.HEADER_SEARCH_PATHS = func(searchPaths);
}
});
};