Skip to content

Commit 0c0fa1b

Browse files
committed
Attempt to fix Windows build error
See gh-33766
1 parent 66dc3ed commit 0c0fa1b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private Map<String, Object> createContentSource() {
135135
Path playbookPath = getOutputFile().get().getAsFile().toPath().getParent();
136136
Path antoraSrc = getProjectPath(getProject()).resolve(ANTORA_SOURCE_DIR);
137137
StringBuilder url = new StringBuilder(".");
138-
relativizeFromRootProject(playbookPath).normalize().forEach((path) -> url.append("/.."));
138+
relativizeFromRootProject(playbookPath).normalize().forEach((path) -> url.append(File.separator).append(".."));
139139
source.put("url", url.toString());
140140
source.put("branches", "HEAD");
141141
source.put("version", getProject().getVersion().toString());
@@ -159,7 +159,7 @@ private void addAntoraContentStartPaths(Set<String> startPaths) {
159159
private void addDir(Map<String, Object> data) {
160160
Path playbookDir = toRealPath(getOutputFile().get().getAsFile().toPath()).getParent();
161161
Path outputDir = toRealPath(getProject().getBuildDir().toPath().resolve("site"));
162-
data.put("output", Map.of("dir", "./" + playbookDir.relativize(outputDir).toString()));
162+
data.put("output", Map.of("dir", "." + File.separator + playbookDir.relativize(outputDir).toString()));
163163
}
164164

165165
@SuppressWarnings("unchecked")

buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ void writePlaybookGeneratesExpectedContent() throws Exception {
4646
task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*");
4747
task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content"));
4848
});
49-
Path actual = this.temp.toPath()
50-
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml");
51-
System.out.println(Files.readString(actual));
52-
assertThat(actual).hasSameTextualContentAs(
53-
Path.of("src/test/resources/org/springframework/boot/build/antora/expected-playbook.yml"));
49+
String actual = Files.readString(this.temp.toPath()
50+
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml"));
51+
String expected = Files
52+
.readString(Path.of("src/test/resources/org/springframework/boot/build/antora/expected-playbook.yml"));
53+
System.out.println(actual);
54+
assertThat(actual).isEqualToNormalizingNewlines(expected);
5455
}
5556

5657
private void writePlaybookYml(ThrowingConsumer<GenerateAntoraPlaybook> customizer) throws Exception {

0 commit comments

Comments
 (0)