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 2019/12/18 07:52:23 UTC

[isis] 01/25: ISIS-2062: updates scripts to generate docs

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 4a4bb5f5e799414ea13f089a2f292f67137e4315
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Dec 13 17:26:34 2019 +0000

    ISIS-2062: updates scripts to generate docs
---
 adoc-gen.sh                                        |  8 +++++
 scripts/ci/_adoc-copy-examples.sh                  | 16 +++++++++
 scripts/ci/{build-site.sh => _adoc-gen-config.sh}  | 29 +--------------
 ...{print-environment.sh => _print-environment.sh} |  0
 scripts/ci/build-core.sh                           |  2 +-
 scripts/ci/build-demo-app.sh                       |  2 +-
 scripts/ci/build-site.sh                           | 42 ++++++----------------
 scripts/ci/build-smoketests.sh                     |  2 +-
 8 files changed, 38 insertions(+), 63 deletions(-)

diff --git a/adoc-gen.sh b/adoc-gen.sh
new file mode 100644
index 0000000..5da5cf2
--- /dev/null
+++ b/adoc-gen.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+sh scripts/ci/_adoc-copy-examples.sh
+sh scripts/ci/_adoc-gen-config.sh
+
+echo
+echo
+
+git status --porcelain
diff --git a/scripts/ci/_adoc-copy-examples.sh b/scripts/ci/_adoc-copy-examples.sh
new file mode 100644
index 0000000..33ed8b6
--- /dev/null
+++ b/scripts/ci/_adoc-copy-examples.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e
+
+SCRIPT_DIR=$( dirname "$0" )
+if [ -z "$PROJECT_ROOT_PATH" ]; then
+  PROJECT_ROOT_PATH=`cd $SCRIPT_DIR/../.. ; pwd`
+fi
+
+
+
+echo "doc gen: copying over examples ..."
+for examples_sh in $(find $PROJECT_ROOT_PATH -name examples.sh -print)
+do
+  echo $examples_sh
+  sh $examples_sh
+done
diff --git a/scripts/ci/build-site.sh b/scripts/ci/_adoc-gen-config.sh
similarity index 65%
copy from scripts/ci/build-site.sh
copy to scripts/ci/_adoc-gen-config.sh
index 353dc5f..b741440 100644
--- a/scripts/ci/build-site.sh
+++ b/scripts/ci/_adoc-gen-config.sh
@@ -18,18 +18,14 @@ if [ -z "$REVISION" ]; then
 fi
 
 
-SITE_CONFIG=$1
 
 
 ##
 ## run groovy
 ##
-GROOVY_CMD=`command -v groovy`
-
-bash $SCRIPT_DIR/print-environment.sh "build-site"
+GROOVY_CMD=$(command -v groovy)
 
 echo ""
-echo "\$SITE_CONFIG: ${SITE_CONFIG}"
 echo "\$GROOVY_CMD : ${GROOVY_CMD}"
 echo ""
  
@@ -49,26 +45,3 @@ else
 fi
 
 
-##
-## copy over examples
-##
-echo "copying over examples ..."
-for examples_sh in $(find $PROJECT_ROOT_PATH -name examples.sh -print)
-do
-  echo $examples_sh
-  sh $examples_sh
-done
-
-
-##
-## run antora
-##
-echo "running antora ..."
-if [ -z "$ANTORA_CMD" ]; then
-  ANTORA_CMD=$(npm bin)/antora
-fi
-
-$ANTORA_CMD --stacktrace $SITE_CONFIG
-
-# add a marker, that tells github not to use jekyll on the github pages folder
-touch ${PROJECT_ROOT_PATH}/antora/target/site/.nojekyll
diff --git a/scripts/ci/print-environment.sh b/scripts/ci/_print-environment.sh
similarity index 100%
rename from scripts/ci/print-environment.sh
rename to scripts/ci/_print-environment.sh
diff --git a/scripts/ci/build-core.sh b/scripts/ci/build-core.sh
index 193b4bc..15bfaca 100644
--- a/scripts/ci/build-core.sh
+++ b/scripts/ci/build-core.sh
@@ -23,7 +23,7 @@ if [ -z "$SETTINGS_XML" ]; then
   SETTINGS_XML=$PROJECT_ROOT_PATH/.m2/settings.xml
 fi
 
-sh $SCRIPT_DIR/print-environment.sh "build-core"
+sh $SCRIPT_DIR/_print-environment.sh "build-core"
 
 if [ ! -z "$REVISION" ]; then
 
diff --git a/scripts/ci/build-demo-app.sh b/scripts/ci/build-demo-app.sh
index 4cc2438..5b2dcc2 100644
--- a/scripts/ci/build-demo-app.sh
+++ b/scripts/ci/build-demo-app.sh
@@ -20,7 +20,7 @@ if [ -z "$MVN_STAGES" ]; then
   MVN_STAGES="clean install"
 fi
 
-sh $SCRIPT_DIR/print-environment.sh "build-demo-app"
+sh $SCRIPT_DIR/_print-environment.sh "build-demo-app"
 
 export FLAVOR=$1
 export ISIS_VERSION=$REVISION
diff --git a/scripts/ci/build-site.sh b/scripts/ci/build-site.sh
index 353dc5f..3fbcd8a 100644
--- a/scripts/ci/build-site.sh
+++ b/scripts/ci/build-site.sh
@@ -20,44 +20,22 @@ fi
 
 SITE_CONFIG=$1
 
+bash $SCRIPT_DIR/_print-environment.sh "build-site"
 
-##
-## run groovy
-##
-GROOVY_CMD=`command -v groovy`
+bash $SCRIPT_DIR/_adoc-copy-examples.sh
+bash $SCRIPT_DIR/_adoc-gen-config.sh
 
-bash $SCRIPT_DIR/print-environment.sh "build-site"
 
-echo ""
-echo "\$SITE_CONFIG: ${SITE_CONFIG}"
-echo "\$GROOVY_CMD : ${GROOVY_CMD}"
-echo ""
- 
-# for now meant to run with nightly builds only 
-if [ -z "${GROOVY_CMD}" ]; then
-  echo "doc gen: no groovy, skipping"
-else
-  if [ ! -f "$PROJECT_ROOT_PATH/core/config/target/classes/META-INF/spring-configuration-metadata.json" ]; then
-    echo "doc gen: no spring-configuration-metadata.json to parse: skipping"
-  else
-    # generate automated site content (adoc files)
-    echo "doc gen: generating config .adoc from Spring metadata ..."
-    ${GROOVY_CMD} $SCRIPT_DIR/../generateConfigDocs.groovy \
-      -f $PROJECT_ROOT_PATH/core/config/target/classes/META-INF/spring-configuration-metadata.json \
-      -o $PROJECT_ROOT_PATH/core/config/src/main/doc/modules/config/examples/generated
-  fi
+##
+## check if anything had not been sync'd
+##
+WC=$(git status --porcelain | wc -l)
+if [ "$WC" -ne "0" ]; then
+  echo "Some examples are out of date; run sync-examples.sh and commit, then try again" >&2
+  exit 1
 fi
 
 
-##
-## copy over examples
-##
-echo "copying over examples ..."
-for examples_sh in $(find $PROJECT_ROOT_PATH -name examples.sh -print)
-do
-  echo $examples_sh
-  sh $examples_sh
-done
 
 
 ##
diff --git a/scripts/ci/build-smoketests.sh b/scripts/ci/build-smoketests.sh
index 2fba972..392a82e 100644
--- a/scripts/ci/build-smoketests.sh
+++ b/scripts/ci/build-smoketests.sh
@@ -20,7 +20,7 @@ if [ -z "$MVN_STAGES" ]; then
   MVN_STAGES="clean install"
 fi
 
-sh $SCRIPT_DIR/print-environment.sh "build-smoketests"
+sh $SCRIPT_DIR/_print-environment.sh "build-smoketests"
 
 #
 # update version (but just for the modules we need to build)