diff options
Diffstat (limited to 'vpp-integration/api-docs/core')
4 files changed, 12 insertions, 21 deletions
diff --git a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ClassPathTypeIndex.java b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ClassPathTypeIndex.java index e204d6321..4eeac5953 100644 --- a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ClassPathTypeIndex.java +++ b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ClassPathTypeIndex.java @@ -40,8 +40,8 @@ public class ClassPathTypeIndex implements LinkGenerator { */ private final Map<String, String> index; - public ClassPathTypeIndex(final String projectRoot, final String version) { - index = buildIndex(projectRoot, version); + public ClassPathTypeIndex(final String projectRoot) { + index = buildIndex(projectRoot); } /** @@ -58,7 +58,7 @@ public class ClassPathTypeIndex implements LinkGenerator { return index.get(clazz.replace("/", ".")); } - private Map<String, String> buildIndex(final String projectRoot, final String version) { + private Map<String, String> buildIndex(final String projectRoot) { try { return Files.walk(Paths.get(projectRoot)) .filter(path -> path.toString().contains("src/main/java")) @@ -66,7 +66,7 @@ public class ClassPathTypeIndex implements LinkGenerator { .map(Path::toString) .map(s -> s.replace(projectRoot, "")) .distinct() - .collect(Collectors.toMap(ClassPathTypeIndex::key, o -> generateLink(o, version))); + .collect(Collectors.toMap(ClassPathTypeIndex::key, o -> generateLink(o))); } catch (IOException e) { throw new IllegalStateException(format("%s not found", projectRoot), e); } diff --git a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/LinkGenerator.java b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/LinkGenerator.java index 3226639b1..2fd96ddc1 100644 --- a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/LinkGenerator.java +++ b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/LinkGenerator.java @@ -18,16 +18,8 @@ package io.fd.hc2vpp.docs.core; public interface LinkGenerator { - static String resolveBranch(final String version) { - if (version.contains("SNAPSHOT")) { - return "master"; - } else { - return "stable%2F" + version.replace(".", ""); - } - } - - default String generateLink(final String raw, final String version) { + default String generateLink(final String raw) { //https://git.fd.io/hc2vpp/tree/interface-role/api/src/main/yang/interface-role@2017-06-15.yang?h=stable%2F1707 - return "https://git.fd.io/hc2vpp/tree" + raw + "?h=" + resolveBranch(version); + return "https://git.fd.io/hc2vpp/tree" + raw + "?h={project-branch}"; } } diff --git a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ModelLinkIndex.java b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ModelLinkIndex.java index c1b299826..3a6268f3d 100644 --- a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ModelLinkIndex.java +++ b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ModelLinkIndex.java @@ -35,10 +35,9 @@ class ModelLinkIndex implements LinkGenerator { /** * @param projectRoot for ex.: /home/jsrnicek/Projects/hc2vpp - * @param version for ex.: 17.07 to get generateLink for correct branch */ - ModelLinkIndex(final String projectRoot, final String version) { - modelLinkIndex = buildIndex(projectRoot, version); + ModelLinkIndex(final String projectRoot) { + modelLinkIndex = buildIndex(projectRoot); } private static String key(String raw) { @@ -55,7 +54,7 @@ class ModelLinkIndex implements LinkGenerator { .orElse("https://datatracker.ietf.org/")); } - private Map<String, String> buildIndex(final String projectRoot, final String version) { + private Map<String, String> buildIndex(final String projectRoot) { try { return Files.walk(Paths.get(projectRoot)) .filter(path -> path.toString().contains("src/main/yang")) @@ -63,7 +62,7 @@ class ModelLinkIndex implements LinkGenerator { .map(Path::toString) .map(s -> s.replace(projectRoot, "")) .distinct() - .collect(Collectors.toMap(ModelLinkIndex::key, o -> generateLink(o, version))); + .collect(Collectors.toMap(ModelLinkIndex::key, o -> generateLink(o))); } catch (IOException e) { throw new IllegalStateException(format("%s not found", projectRoot), e); } diff --git a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/YangTypeLinkIndex.java b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/YangTypeLinkIndex.java index 8220d7f78..e0c2b5022 100644 --- a/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/YangTypeLinkIndex.java +++ b/vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/YangTypeLinkIndex.java @@ -27,8 +27,8 @@ public class YangTypeLinkIndex { private final ModelLinkIndex modelLinkIndex; private final ModelTypeIndex modelTypeIndex; - public YangTypeLinkIndex(final String projectRoot, final String version) { - modelLinkIndex = new ModelLinkIndex(projectRoot, version); + public YangTypeLinkIndex(final String projectRoot) { + modelLinkIndex = new ModelLinkIndex(projectRoot); try { modelTypeIndex = new ModelTypeIndex(); } catch (IOException e) { |