Search in sources :

Example 6 with OutputGroupProvider

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();
}
Also used : ConfiguredAspect(com.google.devtools.build.lib.analysis.ConfiguredAspect) OutputGroupProvider(com.google.devtools.build.lib.analysis.OutputGroupProvider) NestedSetBuilder(com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder) Builder(com.google.devtools.build.lib.analysis.ConfiguredAspect.Builder) Builder(com.google.devtools.build.lib.analysis.ConfiguredAspect.Builder) Artifact(com.google.devtools.build.lib.actions.Artifact) LibraryArtifact(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)

Example 7 with OutputGroupProvider

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();
}
Also used : PyIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.PyIdeInfo) OutputGroupProvider(com.google.devtools.build.lib.analysis.OutputGroupProvider) Artifact(com.google.devtools.build.lib.actions.Artifact) LibraryArtifact(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)

Example 8 with OutputGroupProvider

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();
}
Also used : OutputGroupProvider(com.google.devtools.build.lib.analysis.OutputGroupProvider) Artifact(com.google.devtools.build.lib.actions.Artifact)

Aggregations

OutputGroupProvider (com.google.devtools.build.lib.analysis.OutputGroupProvider)8 Artifact (com.google.devtools.build.lib.actions.Artifact)7 AnalysisResult (com.google.devtools.build.lib.analysis.BuildView.AnalysisResult)3 AspectValue (com.google.devtools.build.lib.skyframe.AspectValue)3 LibraryArtifact (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.LibraryArtifact)3 Test (org.junit.Test)3 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)2 ConfiguredAspect (com.google.devtools.build.lib.analysis.ConfiguredAspect)1 Builder (com.google.devtools.build.lib.analysis.ConfiguredAspect.Builder)1 InputFileConfiguredTarget (com.google.devtools.build.lib.analysis.InputFileConfiguredTarget)1 OutputFileConfiguredTarget (com.google.devtools.build.lib.analysis.OutputFileConfiguredTarget)1 TopLevelArtifactContext (com.google.devtools.build.lib.analysis.TopLevelArtifactContext)1 Label (com.google.devtools.build.lib.cmdline.Label)1 NestedSetBuilder (com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder)1 ExecutionOptions (com.google.devtools.build.lib.exec.ExecutionOptions)1 OutErr (com.google.devtools.build.lib.util.io.OutErr)1 PyIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.PyIdeInfo)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1