use of com.google.devtools.build.lib.skyframe.BuildInfoCollectionValue.BuildInfoKeyAndConfig in project bazel by bazelbuild.
the class SkyframeBuildView method getWorkspaceStatusValues.
/**
* Because we don't know what build-info artifacts this configured target may request, we
* conservatively register a dep on all of them.
*/
// TODO(bazel-team): Allow analysis to return null so the value builder can exit and wait for a
// restart deps are not present.
private static boolean getWorkspaceStatusValues(Environment env, BuildConfiguration config) throws InterruptedException {
env.getValue(WorkspaceStatusValue.SKY_KEY);
Map<BuildInfoKey, BuildInfoFactory> buildInfoFactories = PrecomputedValue.BUILD_INFO_FACTORIES.get(env);
if (buildInfoFactories == null) {
return false;
}
// These factories may each create their own build info artifacts, all depending on the basic
// build-info.txt and build-changelist.txt.
List<SkyKey> depKeys = Lists.newArrayList();
for (BuildInfoKey key : buildInfoFactories.keySet()) {
if (buildInfoFactories.get(key).isEnabled(config)) {
depKeys.add(BuildInfoCollectionValue.key(new BuildInfoKeyAndConfig(key, config)));
}
}
env.getValues(depKeys);
return !env.valuesMissing();
}
use of com.google.devtools.build.lib.skyframe.BuildInfoCollectionValue.BuildInfoKeyAndConfig in project bazel by bazelbuild.
the class BuildInfoCollectionFunction method compute.
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
final BuildInfoKeyAndConfig keyAndConfig = (BuildInfoKeyAndConfig) skyKey.argument();
WorkspaceStatusValue infoArtifactValue = (WorkspaceStatusValue) env.getValue(WorkspaceStatusValue.SKY_KEY);
if (infoArtifactValue == null) {
return null;
}
Map<BuildInfoKey, BuildInfoFactory> buildInfoFactories = PrecomputedValue.BUILD_INFO_FACTORIES.get(env);
if (buildInfoFactories == null) {
return null;
}
WorkspaceNameValue nameValue = (WorkspaceNameValue) env.getValue(WorkspaceNameValue.key());
if (nameValue == null) {
return null;
}
RepositoryName repositoryName = RepositoryName.createFromValidStrippedName(nameValue.maybeGetName());
final ArtifactFactory factory = artifactFactory.get();
BuildInfoContext context = new BuildInfoContext() {
@Override
public Artifact getBuildInfoArtifact(PathFragment rootRelativePath, Root root, BuildInfoType type) {
return type == BuildInfoType.NO_REBUILD ? factory.getConstantMetadataArtifact(rootRelativePath, root, keyAndConfig) : factory.getDerivedArtifact(rootRelativePath, root, keyAndConfig);
}
};
return new BuildInfoCollectionValue(buildInfoFactories.get(keyAndConfig.getInfoKey()).create(context, keyAndConfig.getConfig(), infoArtifactValue.getStableArtifact(), infoArtifactValue.getVolatileArtifact(), repositoryName));
}
Aggregations