use of com.google.devtools.build.lib.rules.cpp.CppCompileAction in project bazel by bazelbuild.
the class CrosstoolCompilationSupport method registerHeaderScanningActions.
private void registerHeaderScanningActions(Info info, ObjcProvider objcProvider, CompilationArtifacts compilationArtifacts) {
// PIC is not used for Obj-C builds, if that changes this method will need to change
if (!isHeaderThinningEnabled() || info.getCcCompilationOutputs().getObjectFiles(false).isEmpty()) {
return;
}
ImmutableList.Builder<ObjcHeaderThinningInfo> headerThinningInfos = ImmutableList.builder();
AnalysisEnvironment analysisEnvironment = ruleContext.getAnalysisEnvironment();
for (Artifact objectFile : info.getCcCompilationOutputs().getObjectFiles(false)) {
ActionAnalysisMetadata generatingAction = analysisEnvironment.getLocalGeneratingAction(objectFile);
if (generatingAction instanceof CppCompileAction) {
CppCompileAction action = (CppCompileAction) generatingAction;
Artifact sourceFile = action.getSourceFile();
if (!sourceFile.isTreeArtifact() && SOURCES_FOR_HEADER_THINNING.matches(sourceFile.getFilename())) {
headerThinningInfos.add(new ObjcHeaderThinningInfo(sourceFile, intermediateArtifacts.headersListFile(sourceFile), action.getCompilerOptions()));
}
}
}
registerHeaderScanningActions(headerThinningInfos.build(), objcProvider, compilationArtifacts);
}
Aggregations