use of com.google.devtools.build.lib.analysis.OutputGroupProvider in project bazel by bazelbuild.
the class AndroidStudioInfoAspect method create.
@Override
public ConfiguredAspect create(ConfiguredTarget base, RuleContext ruleContext, AspectParameters parameters) {
ConfiguredAspect.Builder builder = new Builder(this, parameters, ruleContext);
AndroidStudioInfoFilesProvider.Builder providerBuilder = new AndroidStudioInfoFilesProvider.Builder();
DependenciesResult dependenciesResult = processDependencies(base, ruleContext, providerBuilder);
AndroidStudioInfoFilesProvider provider = createIdeBuildArtifact(base, ruleContext, dependenciesResult, providerBuilder);
NestedSetBuilder<Artifact> ideCompileArtifacts = NestedSetBuilder.stableOrder();
// Add artifacts required for compilation
OutputGroupProvider outputGroupProvider = base.getProvider(OutputGroupProvider.class);
if (outputGroupProvider != null) {
ideCompileArtifacts.addTransitive(outputGroupProvider.getOutputGroup(OutputGroupProvider.FILES_TO_COMPILE));
}
builder.addOutputGroup(IDE_INFO, provider.getIdeInfoFiles()).addOutputGroup(IDE_INFO_TEXT, provider.getIdeInfoTextFiles()).addOutputGroup(IDE_RESOLVE, provider.getIdeResolveFiles()).addOutputGroup(IDE_COMPILE, ideCompileArtifacts.build()).addProvider(provider);
return builder.build();
}
use of com.google.devtools.build.lib.analysis.OutputGroupProvider in project bazel by bazelbuild.
the class AndroidStudioInfoAspect method makePyIdeInfo.
private static PyIdeInfo makePyIdeInfo(ConfiguredTarget base, RuleContext ruleContext, NestedSetBuilder<Artifact> ideResolveArtifacts) {
PyIdeInfo.Builder builder = PyIdeInfo.newBuilder();
Collection<Artifact> sourceFiles = getSources(ruleContext);
for (Artifact sourceFile : sourceFiles) {
builder.addSources(makeArtifactLocation(sourceFile));
}
// Ensure we add all generated sources to the ide-resolve output group.
// See {@link PyCommon#collectTransitivePythonSources}.
OutputGroupProvider outputGroupProvider = base.getProvider(OutputGroupProvider.class);
if (outputGroupProvider != null) {
ideResolveArtifacts.addTransitive(outputGroupProvider.getOutputGroup(OutputGroupProvider.FILES_TO_COMPILE));
}
return builder.build();
}
use of com.google.devtools.build.lib.analysis.OutputGroupProvider in project bazel by bazelbuild.
the class CcLibrary method collectHiddenTopLevelArtifacts.
private static NestedSet<Artifact> collectHiddenTopLevelArtifacts(RuleContext ruleContext, CcCompilationOutputs ccCompilationOutputs) {
// Ensure that we build all the dependencies, otherwise users may get confused.
NestedSetBuilder<Artifact> artifactsToForceBuilder = NestedSetBuilder.stableOrder();
CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
boolean isLipoCollector = cppConfiguration.isLipoContextCollector();
boolean processHeadersInDependencies = cppConfiguration.processHeadersInDependencies();
boolean usePic = CppHelper.usePic(ruleContext, false);
artifactsToForceBuilder.addTransitive(ccCompilationOutputs.getFilesToCompile(isLipoCollector, processHeadersInDependencies, usePic));
for (OutputGroupProvider dep : ruleContext.getPrerequisites("deps", Mode.TARGET, OutputGroupProvider.class)) {
artifactsToForceBuilder.addTransitive(dep.getOutputGroup(OutputGroupProvider.HIDDEN_TOP_LEVEL));
}
return artifactsToForceBuilder.build();
}
Aggregations