use of com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey 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.analysis.buildinfo.BuildInfoFactory.BuildInfoKey in project bazel by bazelbuild.
the class SkyframeExecutor method injectBuildInfoFactories.
/**
* Injects the build info factory map that will be used when constructing build info
* actions/artifacts. Unchanged across the life of the Blaze server, although it must be injected
* each time the evaluator is created.
*/
private void injectBuildInfoFactories() {
ImmutableMap.Builder<BuildInfoKey, BuildInfoFactory> factoryMapBuilder = ImmutableMap.builder();
for (BuildInfoFactory factory : buildInfoFactories) {
factoryMapBuilder.put(factory.getKey(), factory);
}
PrecomputedValue.BUILD_INFO_FACTORIES.set(injectable(), factoryMapBuilder.build());
}
use of com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey 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));
}
use of com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey in project bazel by bazelbuild.
the class CachingAnalysisEnvironment method collectDebugInfoAndCrash.
// See SkyframeBuildView#getWorkspaceStatusValues for the code that this method is attempting to
// verify.
private NullPointerException collectDebugInfoAndCrash(BuildInfoKey key, BuildConfiguration config) throws InterruptedException {
String debugInfo = key + " " + config;
Preconditions.checkState(skyframeEnv.valuesMissing(), debugInfo);
Map<BuildInfoKey, BuildInfoFactory> buildInfoFactories = Preconditions.checkNotNull(PrecomputedValue.BUILD_INFO_FACTORIES.get(skyframeEnv), debugInfo);
BuildInfoFactory buildInfoFactory = Preconditions.checkNotNull(buildInfoFactories.get(key), debugInfo);
Preconditions.checkState(buildInfoFactory.isEnabled(config), debugInfo);
throw new NullPointerException("BuildInfoCollectionValue shouldn't have been null");
}
Aggregations