use of com.google.devtools.build.lib.rules.objc.XcodeProvider.Builder in project bazel by bazelbuild.
the class CompilationSupport method addXcodeSettings.
/**
* Sets compilation-related Xcode project information on the given provider builder.
*
* @param common common information about this rule's attributes and its dependencies
* @return this compilation support
*/
CompilationSupport addXcodeSettings(Builder xcodeProviderBuilder, ObjcCommon common) {
for (CompilationArtifacts artifacts : common.getCompilationArtifacts().asSet()) {
xcodeProviderBuilder.setCompilationArtifacts(artifacts);
}
// The include directory options ("-I") are parsed out of copts. The include directories are
// added as non-propagated header search paths local to the associated Xcode target.
Iterable<String> copts = Iterables.concat(objcConfiguration.getCopts(), attributes.copts());
Iterable<String> includeDirOptions = Iterables.filter(copts, INCLUDE_DIR_OPTION_IN_COPTS);
Iterable<String> coptsWithoutIncludeDirs = Iterables.filter(copts, Predicates.not(INCLUDE_DIR_OPTION_IN_COPTS));
ImmutableList.Builder<PathFragment> nonPropagatedHeaderSearchPaths = new ImmutableList.Builder<>();
for (String includeDirOption : includeDirOptions) {
nonPropagatedHeaderSearchPaths.add(new PathFragment(includeDirOption.substring(2)));
}
// We also need to add the -isystem directories from the CC header providers. ObjCommon
// adds these to the objcProvider, so let's just get them from there.
Iterable<PathFragment> includeSystemPaths = common.getObjcProvider().get(INCLUDE_SYSTEM);
xcodeProviderBuilder.addHeaders(attributes.hdrs()).addHeaders(attributes.textualHdrs()).addUserHeaderSearchPaths(ObjcCommon.userHeaderSearchPaths(common.getObjcProvider(), buildConfiguration)).addHeaderSearchPaths("$(WORKSPACE_ROOT)", attributes.headerSearchPaths(buildConfiguration.getGenfilesFragment())).addHeaderSearchPaths("$(WORKSPACE_ROOT)", includeSystemPaths).addHeaderSearchPaths("$(SDKROOT)/usr/include", attributes.sdkIncludes()).addNonPropagatedHeaderSearchPaths("$(WORKSPACE_ROOT)", nonPropagatedHeaderSearchPaths.build()).addCompilationModeCopts(objcConfiguration.getCoptsForCompilationMode()).addCopts(coptsWithoutIncludeDirs);
return this;
}
Aggregations