use of com.google.devtools.build.lib.rules.cpp.CppModuleMap in project bazel by bazelbuild.
the class CompilationSupport method registerGenerateModuleMapAction.
/**
* Registers an action that will generate a clang module map for this target, using the hdrs
* attribute of this rule.
*/
CompilationSupport registerGenerateModuleMapAction(CompilationArtifacts compilationArtifacts) {
// TODO(bazel-team): Include textual headers in the module map when Xcode 6 support is
// dropped.
// TODO(b/32225593): Include private headers in the module map.
Iterable<Artifact> publicHeaders = attributes.hdrs();
publicHeaders = Iterables.concat(publicHeaders, compilationArtifacts.getAdditionalHdrs());
CppModuleMap moduleMap = intermediateArtifacts.moduleMap();
registerGenerateModuleMapAction(moduleMap, publicHeaders);
return this;
}
use of com.google.devtools.build.lib.rules.cpp.CppModuleMap in project bazel by bazelbuild.
the class ObjcImport method create.
@Override
public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException, RuleErrorException {
ObjcCommon common = new ObjcCommon.Builder(ruleContext).setCompilationAttributes(CompilationAttributes.Builder.fromRuleContext(ruleContext).build()).setResourceAttributes(new ResourceAttributes(ruleContext)).setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext)).setAlwayslink(ruleContext.attributes().get("alwayslink", Type.BOOLEAN)).setHasModuleMap().addExtraImportLibraries(ruleContext.getPrerequisiteArtifacts("archives", Mode.TARGET).list()).addDepObjcProviders(ruleContext.getPrerequisites("bundles", Mode.TARGET, ObjcProvider.class)).build();
XcodeProvider.Builder xcodeProviderBuilder = new XcodeProvider.Builder();
NestedSetBuilder<Artifact> filesToBuild = NestedSetBuilder.stableOrder();
CompilationAttributes compilationAttributes = CompilationAttributes.Builder.fromRuleContext(ruleContext).build();
IntermediateArtifacts intermediateArtifacts = ObjcRuleClasses.intermediateArtifacts(ruleContext);
Iterable<Artifact> publicHeaders = compilationAttributes.hdrs();
CppModuleMap moduleMap = intermediateArtifacts.moduleMap();
CompilationSupport.create(ruleContext).registerGenerateModuleMapAction(moduleMap, publicHeaders).addXcodeSettings(xcodeProviderBuilder, common).validateAttributes();
new ResourceSupport(ruleContext).validateAttributes().addXcodeSettings(xcodeProviderBuilder);
new XcodeSupport(ruleContext).addXcodeSettings(xcodeProviderBuilder, common.getObjcProvider(), LIBRARY_STATIC).addDependencies(xcodeProviderBuilder, new Attribute("bundles", Mode.TARGET)).registerActions(xcodeProviderBuilder.build()).addFilesToBuild(filesToBuild);
return ObjcRuleClasses.ruleConfiguredTarget(ruleContext, filesToBuild.build()).addProvider(XcodeProvider.class, xcodeProviderBuilder.build()).addProvider(ObjcProvider.class, common.getObjcProvider()).build();
}
Aggregations