diff options
author | 2017-07-07 21:13:27 +0200 | |
---|---|---|
committer | 2017-07-10 09:16:15 +0200 | |
commit | 8ff3d2d61d1638553ef1315ca0f52a8357feca2f (patch) | |
tree | 34ddc11774706076a59e3c7b32e3f201771524ff /src/main/java/com/google | |
parent | 739d80ccbd795bac7727a6d89bbb92f5436675cf (diff) |
Clean up string representations for artifacts
If --incompatible_descriptive_string_representations is passed, artifacts
are converted to strings using `str`, `repr` and `print` functions
differently (more descriptive, without leaking information that shouldn't
be accessible).
PiperOrigin-RevId: 161230209
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/Artifact.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java index 2416ed6d3b..de568b8465 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java +++ b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java @@ -878,6 +878,15 @@ public class Artifact @Override public void repr(SkylarkPrinter printer) { - printer.append(toString()); // TODO(bazel-team): implement a readable representation + if (isSourceArtifact()) { + printer.append("<source file " + rootRelativePath + ">"); + } else { + printer.append("<generated file " + rootRelativePath + ">"); + } + } + + @Override + public void reprLegacy(SkylarkPrinter printer) { + printer.append(toString()); } } |