Skip to content

Commit

Permalink
Allow tree artifact value to skip archived tree artifact it's when no…
Browse files Browse the repository at this point in the history
…t present.

PiperOrigin-RevId: 367309352
  • Loading branch information
alexjski authored and copybara-github committed Apr 7, 2021
1 parent d9dfe29 commit b899b77
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static java.util.concurrent.TimeUnit.MINUTES;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -366,8 +367,19 @@ private TreeArtifactValue constructTreeArtifactValueFromFilesystem(SpecialArtifa
if (archivedTreeArtifactsEnabled) {
ArchivedTreeArtifact archivedTreeArtifact =
ArchivedTreeArtifact.create(parent, derivedPathPrefix);
tree.setArchivedRepresentation(
archivedTreeArtifact, constructFileArtifactValueFromFilesystem(archivedTreeArtifact));
FileStatus statNoFollow =
artifactPathResolver.toPath(archivedTreeArtifact).statIfFound(Symlinks.NOFOLLOW);
if (statNoFollow != null) {
tree.setArchivedRepresentation(
archivedTreeArtifact,
constructFileArtifactValue(
archivedTreeArtifact,
FileStatusWithDigestAdapter.adapt(statNoFollow),
/*injectedDigest=*/ null));
} else {
logger.atInfo().atMostEvery(5, MINUTES).log(
"Archived tree artifact: %s not created", archivedTreeArtifact);
}
}

return tree.build();
Expand Down

0 comments on commit b899b77

Please sign in to comment.