parent
66dc3edb34
commit
0c0fa1bc70
|
@ -135,7 +135,7 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask {
|
||||||
Path playbookPath = getOutputFile().get().getAsFile().toPath().getParent();
|
Path playbookPath = getOutputFile().get().getAsFile().toPath().getParent();
|
||||||
Path antoraSrc = getProjectPath(getProject()).resolve(ANTORA_SOURCE_DIR);
|
Path antoraSrc = getProjectPath(getProject()).resolve(ANTORA_SOURCE_DIR);
|
||||||
StringBuilder url = new StringBuilder(".");
|
StringBuilder url = new StringBuilder(".");
|
||||||
relativizeFromRootProject(playbookPath).normalize().forEach((path) -> url.append("/.."));
|
relativizeFromRootProject(playbookPath).normalize().forEach((path) -> url.append(File.separator).append(".."));
|
||||||
source.put("url", url.toString());
|
source.put("url", url.toString());
|
||||||
source.put("branches", "HEAD");
|
source.put("branches", "HEAD");
|
||||||
source.put("version", getProject().getVersion().toString());
|
source.put("version", getProject().getVersion().toString());
|
||||||
|
@ -159,7 +159,7 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask {
|
||||||
private void addDir(Map<String, Object> data) {
|
private void addDir(Map<String, Object> data) {
|
||||||
Path playbookDir = toRealPath(getOutputFile().get().getAsFile().toPath()).getParent();
|
Path playbookDir = toRealPath(getOutputFile().get().getAsFile().toPath()).getParent();
|
||||||
Path outputDir = toRealPath(getProject().getBuildDir().toPath().resolve("site"));
|
Path outputDir = toRealPath(getProject().getBuildDir().toPath().resolve("site"));
|
||||||
data.put("output", Map.of("dir", "./" + playbookDir.relativize(outputDir).toString()));
|
data.put("output", Map.of("dir", "." + File.separator + playbookDir.relativize(outputDir).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -46,11 +46,12 @@ class GenerateAntoraPlaybookTests {
|
||||||
task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*");
|
task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*");
|
||||||
task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content"));
|
task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content"));
|
||||||
});
|
});
|
||||||
Path actual = this.temp.toPath()
|
String actual = Files.readString(this.temp.toPath()
|
||||||
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml");
|
.resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml"));
|
||||||
System.out.println(Files.readString(actual));
|
String expected = Files
|
||||||
assertThat(actual).hasSameTextualContentAs(
|
.readString(Path.of("src/test/resources/org/springframework/boot/build/antora/expected-playbook.yml"));
|
||||||
Path.of("src/test/resources/org/springframework/boot/build/antora/expected-playbook.yml"));
|
System.out.println(actual);
|
||||||
|
assertThat(actual).isEqualToNormalizingNewlines(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writePlaybookYml(ThrowingConsumer<GenerateAntoraPlaybook> customizer) throws Exception {
|
private void writePlaybookYml(ThrowingConsumer<GenerateAntoraPlaybook> customizer) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue