Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
set -e

get-install() {
  wget https://raw.githubusercontent.com/folio-org/platform-complete/master/install.json -O install.json
}

modules() {
  MODULES=`
  cat install.json \
    | jq '.[].id' \
    | sed '/^"folio_/d;        # remove front-end modules
           s/"//;              # remove heading quote
           s/-[[:digit:]].*//  # remove the version number suffix '
  `
}

pull() {
  ln -s Net-Z3950-FOLIO mod-z3950 >/dev/null 2>&1  || true
  for MODULE in $MODULES ; do
    echo $MODULE
    cd $MODULE
    git checkout master
    git pull
    cd ..
  done
}

dependencytrees() {
  for MODULE in $MODULES ; do
    cd $MODULE
    if [ -e pom.xml ]
    then
      echo "$MODULE" >&2
      mvn dependency:tree -B -DoutputType=dot -Dincludes=org.folio,org.folio.okapi,org.olf
    fi
    cd ..
  done
}

convert  convert() {
  grep -E '"(org.folio|org.folio.okapi|org.olf):.* -> "(org.folio|org.folio.okapi|org.olf):' \
    | sed -E 's/"org.folio:(cql2pgjson|cql2pgjson-cli|dbschema|domain-models-api-aspects|domain-models-api-interfaces|domain-models-interface-extensions|domain-models-maven-plugin|domain-models-runtime|domain-models-runtime-it|postgres-runner|postgres-testing|rules|testing|util):/"org.folio:RMB:/g' \
    | sed -E 's/:okapi-[^:]+:/:okapi:/g' \
    | sed -E 's/:([^:]+)-(server|client):/:\1:/g' \
    | sed -E 's/:(mod-erm-usage-counter|mod-erm-usage-harvester|folio-service-tools)[^:]+:/:\1:/g' \
    | sed -E -n '/^[^:]+:([^:]+)+:.* "[^:]+:([^:]+):.*/s//"\1" -> "\2"/p' \
    | grep -v -E '"([^"]+)" -> "\1"' \
    | sed 's/"data-import-processing-core"/"data-import-\\nprocessing-core"/g' \
    | sed 's/"data-import-utils"/"data-import-\\nutils"/g' \
    | sed 's/"folio-custom-fields"/"folio-custom-\\nfields"/g' \
    | sed 's/"folio-di-support"/"folio-di-\\nsupport"/g' \
    | sed 's/"folio-holdingsiq"/"folio-\\nholdingsiq"/g' \
    | sed 's/"folio-kafka-wrapper"/"folio-kafka-\\nwrapper"/g' \
    | sed 's/"folio-liquibase-util"/"folio-liquibase-\\nutil"/g' \
    | sed 's/"folio-service-tools"/"folio-service-\\ntools"/g' \
    | sed 's/"mod-data-import-converter-storage"/"mod-data-import-\\nconverter-storage"/g' \
    | sed 's/"mod-source-record-storage"/"mod-source-\\nrecord-storage"/g' \
    | sed 's/"mod-source-record-manager"/"mod-source-\\nrecord-manager"/g' \
    | sort -u
}

# Filter reused libraries, we don't want modules that are not used by any other module
filter() {
  DEPENDENCIES=`cat`
  LIBRARIES=`echo "$DEPENDENCIES" | sed -E 's/.* -> ("[^"]+").*/\1 ->/' | sort -u`
  echo "$DEPENDENCIES" | grep -F -f <(echo "$LIBRARIES")
}

wrap() {
  echo "digraph {"
  echo "graph [ rankdir=TB ]"
  echo "node [ shape=rectagle ]"
  cat
  echo "}"
}

get-install
modules
pull
dependencytrees > dependencytrees
cat dependencytrees | convert | filter | wrap > complete.graphviz

...