use of com.facebook.buck.distributed.DistBuildState in project buck by facebook.
the class DistBuildFactory method createDistBuildExecutor.
public static DistBuildSlaveExecutor createDistBuildExecutor(BuildJobState jobState, CommandRunnerParams params, WeightedListeningExecutorService executorService, DistBuildService service, DistBuildMode mode, int coordinatorPort, Optional<StampedeId> stampedeId, Optional<Path> globalCacheDir) throws IOException {
DistBuildState state = DistBuildState.load(Optional.of(params.getBuckConfig()), jobState, params.getCell(), params.getKnownBuildRuleTypesFactory());
Preconditions.checkArgument(state.getCells().size() > 0);
// Create a cache factory which uses a combination of the distributed build config,
// overridden with the local buck config (i.e. the build slave).
Cell rootCell = Preconditions.checkNotNull(state.getCells().get(0));
ArtifactCacheFactory distBuildArtifactCacheFactory = params.getArtifactCacheFactory().cloneWith(rootCell.getBuckConfig());
DistBuildSlaveExecutor executor = new DistBuildSlaveExecutor(DistBuildExecutorArgs.builder().setBuckEventBus(params.getBuckEventBus()).setPlatform(params.getPlatform()).setClock(params.getClock()).setArtifactCache(distBuildArtifactCacheFactory.newInstance(true)).setState(state).setObjectMapper(params.getObjectMapper()).setRootCell(params.getCell()).setParser(params.getParser()).setExecutorService(executorService).setActionGraphCache(params.getActionGraphCache()).setCacheKeySeed(params.getBuckConfig().getKeySeed()).setConsole(params.getConsole()).setProvider(new MultiSourceContentsProvider(service, globalCacheDir)).setExecutors(params.getExecutors()).setDistBuildMode(mode).setCoordinatorPort(coordinatorPort).setStampedeId(stampedeId.orElse(new StampedeId().setId("LOCAL_FILE"))).setVersionedTargetGraphCache(params.getVersionedTargetGraphCache()).build());
return executor;
}
Aggregations