summaryrefslogtreecommitdiffstats
path: root/vpp-integration/api-docs
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-integration/api-docs')
-rw-r--r--vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ClassPathTypeIndex.java8
-rw-r--r--vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/LinkGenerator.java12
-rw-r--r--vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/ModelLinkIndex.java9
-rw-r--r--vpp-integration/api-docs/core/src/main/java/io/fd/hc2vpp/docs/core/YangTypeLinkIndex.java4
-rw-r--r--vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy4
5 files changed, 14 insertions, 23 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) {
diff --git a/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy b/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy
index 437def689..99e41ce75 100644
--- a/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy
+++ b/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy
@@ -77,9 +77,9 @@ class ApiDocsIndexGenerator {
String outPath = project.build.outputDirectory
log.info "Generating yang type generateLink index"
- YangTypeLinkIndex yangTypeIndex = new YangTypeLinkIndex(projectRoot, project.version)
+ YangTypeLinkIndex yangTypeIndex = new YangTypeLinkIndex(projectRoot)
log.info "Classpath type generateLink index"
- ClassPathTypeIndex classPathIndex = new ClassPathTypeIndex(projectRoot, project.version)
+ ClassPathTypeIndex classPathIndex = new ClassPathTypeIndex(projectRoot)
log.info "Generating VPP API to YANG mapping"
PLUGIN_CLASSES.stream()