aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar vladmos <vladmos@google.com>2017-07-07 21:13:27 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-10 09:16:15 +0200
commit8ff3d2d61d1638553ef1315ca0f52a8357feca2f (patch)
tree34ddc11774706076a59e3c7b32e3f201771524ff /src/main/java/com
parent739d80ccbd795bac7727a6d89bbb92f5436675cf (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')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Artifact.java11
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());
}
}