From 63c171169299bab5128304e79b3b1b9b36048ce3 Mon Sep 17 00:00:00 2001 From: shahan Date: Mon, 23 Jul 2018 17:14:17 -0700 Subject: ArtifactFactory.getSourceArtifact returns SourceArtifact. PiperOrigin-RevId: 205751282 --- .../build/lib/actions/ArtifactFactory.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/main/java/com/google/devtools') diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java index dad4779b81..aff7b83f02 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java @@ -17,6 +17,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.Striped; +import com.google.devtools.build.lib.actions.Artifact.SourceArtifact; import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType; import com.google.devtools.build.lib.cmdline.PackageIdentifier; import com.google.devtools.build.lib.cmdline.RepositoryName; @@ -163,26 +164,27 @@ public class ArtifactFactory implements ArtifactResolver { } @Override - public Artifact getSourceArtifact(PathFragment execPath, Root root, ArtifactOwner owner) { + public SourceArtifact getSourceArtifact(PathFragment execPath, Root root, ArtifactOwner owner) { Preconditions.checkArgument( execPath.isAbsolute() == root.isAbsolute(), "%s %s %s", execPath, root, owner); Preconditions.checkNotNull(owner, "%s %s", execPath, root); Preconditions.checkNotNull( sourceArtifactRoots, "Not initialized for %s %s %s", execPath, root, owner); - return getArtifact( - Preconditions.checkNotNull( - sourceArtifactRoots.get(root), - "%s has no ArtifactRoot (%s) in %s", - root, + return (SourceArtifact) + getArtifact( + Preconditions.checkNotNull( + sourceArtifactRoots.get(root), + "%s has no ArtifactRoot (%s) in %s", + root, + execPath, + sourceArtifactRoots), execPath, - sourceArtifactRoots), - execPath, - owner, - null); + owner, + null); } @Override - public Artifact getSourceArtifact(PathFragment execPath, Root root) { + public SourceArtifact getSourceArtifact(PathFragment execPath, Root root) { return getSourceArtifact(execPath, root, ArtifactOwner.NullArtifactOwner.INSTANCE); } -- cgit v1.2.3