diff --git a/pom.xml b/pom.xml index 2df4eb67..1babb82b 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ 1.26.0 25.0.2 + 26.0.0-SNAPSHOT 1.12.1 v16.13.1 @@ -218,6 +219,15 @@ true ${project.build.directory} + + org.keycloak + keycloak-client-guides + ${version.keycloak.client} + asciidoc + zip + true + ${project.build.directory} + diff --git a/src/main/java/org/keycloak/webbuilder/Guides.java b/src/main/java/org/keycloak/webbuilder/Guides.java index 32ce6fbf..6bbf84bd 100644 --- a/src/main/java/org/keycloak/webbuilder/Guides.java +++ b/src/main/java/org/keycloak/webbuilder/Guides.java @@ -30,7 +30,8 @@ public Guides(File tmpDir, File guidesDir, AsciiDoctor asciiDoctor) throws IOExc loadGuides(asciiDoctor, d, category); } - Arrays.stream(tmpDir.getParentFile().listFiles((f, s) -> s.startsWith("keycloak-guides"))).findFirst().ifPresent(f -> { + Arrays.stream(tmpDir.getParentFile().listFiles((f, s) -> s.startsWith("keycloak-guides") || s.startsWith("keycloak-client-guides"))) + .forEach(f -> { try { loadGuides(asciiDoctor, new File(f, "generated-guides/server"), GuideCategory.SERVER); loadGuides(asciiDoctor, new File(f, "generated-guides/operator"), GuideCategory.OPERATOR); @@ -238,9 +239,9 @@ public enum GuideCategory { SECURING_APPS("securing-apps", "Securing applications"), HIGH_AVAILABILITY("high-availability", "High availability"); - private String label; + private final String label; - private String id; + private final String id; GuideCategory(String id, String label) { this.id = id; diff --git a/src/main/java/org/keycloak/webbuilder/builders/ResourcesBuilder.java b/src/main/java/org/keycloak/webbuilder/builders/ResourcesBuilder.java index cea0ebcb..0fb840e0 100644 --- a/src/main/java/org/keycloak/webbuilder/builders/ResourcesBuilder.java +++ b/src/main/java/org/keycloak/webbuilder/builders/ResourcesBuilder.java @@ -4,11 +4,9 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.Arrays; -import java.util.Optional; -import java.util.stream.Stream; +import java.util.List; +import java.util.stream.Collectors; public class ResourcesBuilder extends AbstractBuilder { @@ -23,17 +21,19 @@ protected void build() throws Exception { FileUtils.copyDirectory(new File(context.getBlogDir(), "images"), new File(new File(targetResourcesDir, "images"), "blog")); FileUtils.copyDirectory(new File(context.getGuidesDir(), "images"), guidesImageDir); - Optional genGuidesDir = Arrays.stream(context.getTmpDir().getParentFile().listFiles((f, s) -> s.startsWith("keycloak-guides"))).findFirst(); - - Optional genGuidesImagesDir = genGuidesDir.flatMap( d -> Arrays.stream(new File(d, "generated-guides").listFiles(n -> n.getName().equals("images"))).findAny()); - if (genGuidesImagesDir.isPresent()) { - for (File f : genGuidesImagesDir.get().listFiles()) { - if (f.isFile()) { - FileUtils.copyFileToDirectory(f, guidesImageDir); - } else { - FileUtils.copyDirectoryToDirectory(f, guidesImageDir); - } - } + List genGuidesImagesDirs = Arrays.stream(context.getTmpDir().getParentFile() + .listFiles((f, s) -> s.startsWith("keycloak-guides") || s.startsWith("keycloak-client-guides"))) + .flatMap(d -> Arrays.stream(new File(d, "generated-guides").listFiles(n -> n.getName().equals("images")))) + .collect(Collectors.toList()); + + for (File genGuidesImagesDir : genGuidesImagesDirs) { + for (File f : genGuidesImagesDir.listFiles()) { + if (f.isFile()) { + FileUtils.copyFileToDirectory(f, guidesImageDir); + } else { + FileUtils.copyDirectoryToDirectory(f, guidesImageDir); + } + } } printStep("copied", "blog images");