use of com.google.devtools.build.lib.actions.ArtifactFactory in project bazel by bazelbuild.
the class ExecutionTool method createBuilder.
private Builder createBuilder(BuildRequest request, ActionCache actionCache, SkyframeExecutor skyframeExecutor, ModifiedFileSet modifiedOutputFiles) {
BuildRequest.BuildRequestOptions options = request.getBuildOptions();
boolean keepGoing = request.getViewOptions().keepGoing;
Path actionOutputRoot = env.getDirectories().getActionConsoleOutputDirectory();
Predicate<Action> executionFilter = CheckUpToDateFilter.fromOptions(request.getOptions(ExecutionOptions.class));
// jobs should have been verified in BuildRequest#validateOptions().
Preconditions.checkState(options.jobs >= -1);
// Treat 0 jobs as a single task.
int actualJobs = options.jobs == 0 ? 1 : options.jobs;
skyframeExecutor.setActionOutputRoot(actionOutputRoot);
ArtifactFactory artifactFactory = env.getSkyframeBuildView().getArtifactFactory();
return new SkyframeBuilder(skyframeExecutor, new ActionCacheChecker(actionCache, artifactFactory, executionFilter, ActionCacheChecker.CacheConfig.builder().setEnabled(options.useActionCache).setVerboseExplanations(options.verboseExplanations).build()), keepGoing, actualJobs, request.getPackageCacheOptions().checkOutputFiles ? modifiedOutputFiles : ModifiedFileSet.NOTHING_MODIFIED, options.finalizeActions, fileCache, request.getBuildOptions().progressReportInterval);
}
use of com.google.devtools.build.lib.actions.ArtifactFactory 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