Skip to content

Commit 4d569dc

Browse files
committed
Configure JSON formatting for branches.json
1 parent d1d2c91 commit 4d569dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateBranchesJsonTask.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
package org.elasticsearch.gradle.internal.release;
1111

12+
import com.fasterxml.jackson.core.util.DefaultIndenter;
13+
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
1214
import com.fasterxml.jackson.databind.JsonNode;
1315
import com.fasterxml.jackson.databind.ObjectMapper;
1416
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -128,7 +130,11 @@ public void executeTask() throws IOException {
128130
updatedBranches.add(objectNode);
129131
}
130132
((ObjectNode) jsonNode).replace("branches", updatedBranches);
131-
objectMapper.writeValue(branchesFile, jsonNode);
133+
134+
DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
135+
prettyPrinter.indentArraysWith(new DefaultIndenter(" ", DefaultIndenter.SYS_LF));
136+
prettyPrinter.withoutSpacesInObjectEntries();
137+
objectMapper.writer(prettyPrinter).writeValue(branchesFile, jsonNode);
132138
}
133139

134140
private List<DevelopmentBranch> readBranches(File branchesFile) {

0 commit comments

Comments
 (0)