automation/docs/generate-autogenerated-docs.sh
#!/bin/bash
set -euo pipefail
# The below variable represents the top level directory of the repository
MAIN_DIRECTORY_LOCATION=$1
echo "Generate autogenerated documents"

# Compile jans-core to pick-up any changes in annotation processors
mvn -q -f "$MAIN_DIRECTORY_LOCATION"/jans-core/pom.xml -DskipTests clean compile install

# Compile modules where classes that use these annotations exist.
# This will generate markdown files under target/classes directory in respective module
# Compilation would also generate Swagger SPEC in any module which uses appropriate annotations and undergoes any change
mvn -q -f "$MAIN_DIRECTORY_LOCATION"/jans-auth-server/pom.xml clean compile
mvn -q -f "$MAIN_DIRECTORY_LOCATION"/jans-fido2/pom.xml clean compile
mvn -q -f "$MAIN_DIRECTORY_LOCATION"/jans-scim/pom.xml clean compile
mvn -q -f "$MAIN_DIRECTORY_LOCATION"/jans-config-api/pom.xml -DskipTests clean compile

# Move markdown files generated in respective modules by @DocFeatureFlag and @DocProperty annotations
mv -f "$MAIN_DIRECTORY_LOCATION"/jans-auth-server/model/target/classes/janssenauthserver-properties.md "$MAIN_DIRECTORY_LOCATION"/docs/admin/reference/json/properties
mv -f "$MAIN_DIRECTORY_LOCATION"/jans-auth-server/model/target/classes/janssenauthserver-feature-flags.md "$MAIN_DIRECTORY_LOCATION"/docs/admin/reference/json/feature-flags
mv -f "$MAIN_DIRECTORY_LOCATION"/jans-fido2/model/target/classes/fido2-properties.md "$MAIN_DIRECTORY_LOCATION"/docs/admin/reference/json/properties
mv -f "$MAIN_DIRECTORY_LOCATION"/jans-scim/model/target/classes/scim-properties.md "$MAIN_DIRECTORY_LOCATION"/docs/admin/reference/json/properties