Search in sources :

Example 1 with ArtifactFactory

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);
}
Also used : Path(com.google.devtools.build.lib.vfs.Path) ExecutionOptions(com.google.devtools.build.lib.exec.ExecutionOptions) Action(com.google.devtools.build.lib.actions.Action) WorkspaceStatusAction(com.google.devtools.build.lib.analysis.WorkspaceStatusAction) ArtifactFactory(com.google.devtools.build.lib.actions.ArtifactFactory) ActionCacheChecker(com.google.devtools.build.lib.actions.ActionCacheChecker)

Example 2 with ArtifactFactory

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));
}
Also used : Root(com.google.devtools.build.lib.actions.Root) BuildInfoType(com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoType) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) RepositoryName(com.google.devtools.build.lib.cmdline.RepositoryName) BuildInfoKey(com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey) BuildInfoContext(com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoContext) ArtifactFactory(com.google.devtools.build.lib.actions.ArtifactFactory) BuildInfoKeyAndConfig(com.google.devtools.build.lib.skyframe.BuildInfoCollectionValue.BuildInfoKeyAndConfig) BuildInfoFactory(com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory)

Aggregations

ArtifactFactory (com.google.devtools.build.lib.actions.ArtifactFactory)2 Action (com.google.devtools.build.lib.actions.Action)1 ActionCacheChecker (com.google.devtools.build.lib.actions.ActionCacheChecker)1 Root (com.google.devtools.build.lib.actions.Root)1 WorkspaceStatusAction (com.google.devtools.build.lib.analysis.WorkspaceStatusAction)1 BuildInfoFactory (com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory)1 BuildInfoContext (com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoContext)1 BuildInfoKey (com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey)1 BuildInfoType (com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoType)1 RepositoryName (com.google.devtools.build.lib.cmdline.RepositoryName)1 ExecutionOptions (com.google.devtools.build.lib.exec.ExecutionOptions)1 BuildInfoKeyAndConfig (com.google.devtools.build.lib.skyframe.BuildInfoCollectionValue.BuildInfoKeyAndConfig)1 Path (com.google.devtools.build.lib.vfs.Path)1 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1