aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
index 19af953380..339592ed3c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
@@ -781,7 +781,7 @@ public class SkylarkRuleClassFunctions {
sb.append("]");
} else if (value instanceof String) {
sb.append("\"");
- sb.append(escapeString((String) value));
+ sb.append(jsonEscapeString((String) value));
sb.append("\"");
} else if (value instanceof Integer || value instanceof Boolean) {
sb.append(value);
@@ -794,6 +794,12 @@ public class SkylarkRuleClassFunctions {
throw new EvalException(loc, errorMessage);
}
}
+
+ private String jsonEscapeString(String string) {
+ return escapeString(string.replace("\\", "\\\\")
+ .replace("\r", "\\r")
+ .replace("\t", "\\t"));
+ }
};
@SkylarkSignature(name = "output_group",