You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/02/23 00:11:39 UTC

[isis] 01/11: ISIS-2444: reworking projdoc tooling to split out into separate antora modules in a 'refguide' antora component

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 922d17b58b716e1bb6009ccbb64173339f5d310b
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Feb 22 07:02:38 2021 +0000

    ISIS-2444: reworking projdoc tooling to split out into separate antora modules in a 'refguide' antora component
---
 .run/isis-tooling-cli (overview).run.xml             |  6 +++---
 scripts/ci/_adoc-gen-projdoc.sh                      |  2 +-
 .../isis/tooling/cli/projdoc/ProjectDocWriter.java   | 20 ++++++++++++++++++--
 .../cli/test/adocfix/IncludeStatementFixerTest.java  | 19 ++++++++++---------
 4 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/.run/isis-tooling-cli (overview).run.xml b/.run/isis-tooling-cli (overview).run.xml
index 4dafc48..11c8124 100644
--- a/.run/isis-tooling-cli (overview).run.xml	
+++ b/.run/isis-tooling-cli (overview).run.xml	
@@ -4,7 +4,7 @@
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
     <option name="MAIN_CLASS_NAME" value="org.apache.isis.tooling.cli.Cli" />
     <module name="isis-tooling-cli" />
-    <option name="PROGRAM_PARAMETERS" value="-p . -o antora/components/system/modules/generated overview" />
+    <option name="PROGRAM_PARAMETERS" value="-p . -o antora/components/refguide overview" />
     <extension name="net.ashald.envfile">
       <option name="IS_ENABLED" value="false" />
       <option name="IS_SUBST" value="false" />
@@ -24,7 +24,7 @@
     <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
     <option name="MAIN_CLASS_NAME" value="org.apache.isis.tooling.cli.Cli" />
     <module name="isis-tooling-cli" />
-    <option name="PROGRAM_PARAMETERS" value="-p . -o antora/components/system/modules/generated overview" />
+    <option name="PROGRAM_PARAMETERS" value="-p . -o antora/components/refguide overview" />
     <extension name="net.ashald.envfile">
       <option name="IS_ENABLED" value="false" />
       <option name="IS_SUBST" value="false" />
@@ -39,4 +39,4 @@
       <option name="Make" enabled="true" />
     </method>
   </configuration>
-</component>
\ No newline at end of file
+</component>
diff --git a/scripts/ci/_adoc-gen-projdoc.sh b/scripts/ci/_adoc-gen-projdoc.sh
index 266511a..2c7f57b 100644
--- a/scripts/ci/_adoc-gen-projdoc.sh
+++ b/scripts/ci/_adoc-gen-projdoc.sh
@@ -35,7 +35,7 @@ fi
 
 
 MODE=projdoc
-GENERATED_PATH="${PROJECT_ROOT_PATH}/antora/components/system/modules/generated"
+GENERATED_PATH="${PROJECT_ROOT_PATH}/antora/components/refguide"
 
 ##
 ## run java
diff --git a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/projdoc/ProjectDocWriter.java b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/projdoc/ProjectDocWriter.java
index 3ef42f4..7cb3bb4 100644
--- a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/projdoc/ProjectDocWriter.java
+++ b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/projdoc/ProjectDocWriter.java
@@ -127,13 +127,29 @@ final class ProjectDocWriter {
             final @NonNull CliConfig.Commands.Index index
             ) {
 
-        val indexFolder = index.getDocumentIndexFolder(global.getOutputRootFolder());
+        // eg: was: antora/components/system/modules/generated
+        // eg: now: antora/components/refguide
+        final File outputRootFolder = global.getOutputRootFolder();
+        val indexFolder = index.getDocumentIndexFolder(outputRootFolder);
 
         val destFolderBuilder = _Refs.<File>objectRef(indexFolder);
 
+        // eg org/apache/isis/applib/annotation
         unit.getNamespace().stream()
+        // eg applib/annotation
         .skip(global.getNamespacePartsSkipCount())
-        .forEach(subDir->destFolderBuilder.update(currentDir->new File(currentDir, subDir)));
+        .peek(subDir-> {
+            // applib
+            // ... so updates to antora/components/refguide/modules/applib
+            destFolderBuilder.update(currentDir -> new File(currentDir, "modules"));
+            destFolderBuilder.update(currentDir -> new File(currentDir, subDir));
+        })
+        // annotation
+        .skip(1)
+        .forEach(subDir-> {
+            // annotation
+            destFolderBuilder.update(currentDir -> new File(currentDir, subDir));
+        });
 
         val destFolder = destFolderBuilder.getValueElseDefault(indexFolder);
         destFolder.mkdirs();
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/adocfix/IncludeStatementFixerTest.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/adocfix/IncludeStatementFixerTest.java
index 33935ae..31f0753 100644
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/adocfix/IncludeStatementFixerTest.java
+++ b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/adocfix/IncludeStatementFixerTest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.function.Consumer;
 
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import org.apache.isis.commons.collections.Can;
@@ -35,28 +36,28 @@ import lombok.val;
 
 class IncludeStatementFixerTest {
 
-    @Test// @Disabled
+    @Test @Disabled("to reinstate after changing to refguide format")
     void adocDocMining() throws IOException {
-        
+
         val adocFiles = ProjectSampler.adocFiles(ProjectSampler.apacheIsisRoot());
-     
+
         val names = _Sets.<String>newTreeSet();
-        
+
         Can.ofCollection(adocFiles)
         .stream()
         .filter(source->
             !source.toString().contains("\\system\\generated\\")
             && !source.toString().contains("/system/generated/"))
-        
+
         //.filter(source->source.toString().contains("XmlSnapshotService"))
         .forEach(file->parseAdoc(file, names::add));
-        
+
         names.forEach(System.out::println);
     }
-    
+
     private void parseAdoc(final @NonNull File file, Consumer<String> onName) {
         val lines = _Text.readLinesFromFile(file, StandardCharsets.UTF_8);
-        
+
         IncludeStatements.find(lines)
         .filter(include->!include.isLocal()
                 && "system".equals(include.getComponent())
@@ -65,5 +66,5 @@ class IncludeStatementFixerTest {
             onName.accept(include.toString());
         });
     }
-    
+
 }