Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ java_library(
deps = [
"//src/main/java/com/google/devtools/build/docgen/annot",
"//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib:runtime/remote_repo_contents_cache",
"//src/main/java/com/google/devtools/build/lib/actions:file_metadata",
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:blaze_directories",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.google.devtools.build.lib.rules.repository.RepositoryFunction;
import com.google.devtools.build.lib.rules.repository.WorkspaceFileHelper;
import com.google.devtools.build.lib.runtime.ProcessWrapper;
import com.google.devtools.build.lib.runtime.RemoteRepoContentsCache;
import com.google.devtools.build.lib.runtime.RepositoryRemoteExecutor;
import com.google.devtools.build.lib.skyframe.IgnoredSubdirectoriesValue;
import com.google.devtools.build.lib.skyframe.PrecomputedValue;
Expand Down Expand Up @@ -125,13 +126,20 @@ public void reportSkyframeRestart(Environment env, RepositoryName repoName) {

private static class State extends WorkerSkyKeyComputeState<FetchResult> {
@Nullable FetchResult result;
final RemoteRepoContentsCache.LookupState repoContentsCacheLookupState =
new RemoteRepoContentsCache.LookupState();
}

@Override
public boolean wasJustFetched(Environment env) {
return env.getState(State::new).result != null;
}

@Override
public RemoteRepoContentsCache.LookupState getRemoteRepoContentsCacheLookupState(Environment env) {
return env.getState(State::new).repoContentsCacheLookupState;
}

private record FetchArgs(
Rule rule, Path outputDirectory, BlazeDirectories directories, Environment env, SkyKey key) {
FetchArgs toWorkerArgs(Environment env) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/remote/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/remote/util",
"//src/main/java/com/google/devtools/build/lib/remote/util:digest_utils",
"//src/main/java/com/google/devtools/build/lib/remote/zstd",
"//src/main/java/com/google/devtools/build/lib/rules:repository/repo_recorded_input",
"//src/main/java/com/google/devtools/build/lib/skyframe:action_execution_value",
"//src/main/java/com/google/devtools/build/lib/skyframe:sky_functions",
"//src/main/java/com/google/devtools/build/lib/skyframe:tree_artifact_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ public CachedActionResult downloadActionResult(
boolean inlineOutErr,
Set<String> inlineOutputFiles)
throws IOException, InterruptedException {
return getFromFuture(
downloadActionResultAsync(context, actionKey, inlineOutErr, inlineOutputFiles));
}

public ListenableFuture<CachedActionResult> downloadActionResultAsync(
RemoteActionExecutionContext context,
ActionKey actionKey,
boolean inlineOutErr,
Set<String> inlineOutputFiles) {
var spawnExecutionContext = context.getSpawnExecutionContext();

ListenableFuture<CachedActionResult> future = immediateFuture(null);
Expand Down Expand Up @@ -254,7 +263,7 @@ public CachedActionResult downloadActionResult(
directExecutor());
}

return getFromFuture(future);
return future;
}

private ListenableFuture<ActionResult> downloadActionResultFromRemote(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ public void afterCommand() {
*/
public boolean injectRemoteRepo(RepositoryName repo, Tree remoteContents, String markerFile)
throws IOException, InterruptedException {
var repoDir = externalDirectory.getChild(repo.getName());
deleteTree(repoDir);
var unused = delete(externalDirectory.getChild(repo.getMarkerFileName()));
var childMap =
remoteContents.getChildrenList().stream()
.collect(
toImmutableMap(cache.digestUtil::compute, directory -> directory, (a, b) -> a));
var repoDir = externalDirectory.getChild(repo.getName());
var filesToPrefetch = new ArrayList<PathFragment>();
injectRecursively(
externalFs,
Expand All @@ -220,7 +222,7 @@ public boolean injectRemoteRepo(RepositoryName repo, Tree remoteContents, String
}
// Create the repo directory on disk so that readdir reflects the overlaid state of the external
// directory.
nativeFs.createDirectoryAndParents(externalDirectory.getChild(repo.getName()));
nativeFs.createDirectoryAndParents(repoDir);
// Keep the marker file contents in memory so that it can be written out when the repo is
// materialized. This doubles as a presence marker for the in-memory repo contents.
markerFileContents.put(repo.getName(), markerFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException {

repositoryRemoteHelpersFactoryDelegate.init(
new RepositoryRemoteHelpersFactoryImpl(
env.getDirectories(),
actionContextProvider.getCombinedCache(),
actionContextProvider.getRemoteExecutionClient(),
buildRequestId,
Expand Down
Loading