33# Executes selected "Artifact_Dependencies" Cypher queries for GraphViz visualization.
44# It contains lists of dependencies across artifacts and their build levels (topologically sorted).
55# It requires an already running Neo4j graph database with already scanned and analyzed artifacts.
6- # The reports (csv, dot and svg files) will be written into the sub directory reports/artifact -dependencies-visualization.
6+ # The reports (csv, dot and svg files) will be written into the sub directory reports/internal -dependencies-visualization.
77
88# Requires executeQueryFunctions.sh, cleanupAfterReportGeneration.sh
99
@@ -32,6 +32,8 @@ echo "InternalDependenciesVisualization VISUALIZATION_SCRIPTS_DIR=${VISUALIZATIO
3232CYPHER_DIR=${CYPHER_DIR:- " ${REPORTS_SCRIPT_DIR} /../../cypher" }
3333echo " InternalDependenciesVisualization CYPHER_DIR=${CYPHER_DIR} "
3434
35+ INTERNAL_DEPENDENCIES_CYPHER_DIR=" ${CYPHER_DIR} /Internal_Dependencies"
36+
3537if ! command -v " npx" & > /dev/null ; then
3638 echo " InternalDependenciesVisualization: Error: Command npx (run npm locally) not found. It's needed for Graph visualization with GraphViz." >&2
3739 exit 1
@@ -45,30 +47,27 @@ REPORT_NAME="internal-dependencies-visualization"
4547FULL_REPORT_DIRECTORY=" ${REPORTS_DIRECTORY} /${REPORT_NAME} "
4648mkdir -p " ${FULL_REPORT_DIRECTORY} "
4749
48- # Local Constants
49- INTERNAL_DEPENDENCIES_CYPHER_DIR=" ${CYPHER_DIR} /Internal_Dependencies"
50-
5150visualizeGraphAndGenerateSvg () {
52- if [ -f " ${reportName} .gv" ]; then
51+ local name=" ${1} "
52+ echo " InternalDependenciesVisualization: Generating Visualization ${name} ..."
53+ source " ${VISUALIZATION_SCRIPTS_DIR} /convertQueryResultCsvToGraphVizDotFile.sh" --filename " ${name} .csv"
54+
55+ if [ -f " ${name} .gv" ]; then
5356 # Run GraphViz command line interface (CLI) wrapped utilizing WASM (WebAssembly)
5457 # to convert the DOT file to SVG operating system independently.
55- npx --yes @hpcc-js/
[email protected] -T svg
" ${reportName } .gv" > " ${reportName } .svg" 58+ npx --yes @hpcc-js/
[email protected] -T svg
" ${name } .gv" > " ${name } .svg" 5659 fi
5760}
5861
5962# Java Artifacts: Dependencies Visualization
6063reportName=" ${FULL_REPORT_DIRECTORY} /JavaArtifactBuildLevels"
61- echo " InternalDependenciesVisualization Generating ${reportName} ..."
6264execute_cypher " ${INTERNAL_DEPENDENCIES_CYPHER_DIR} /Java_Artifact_build_levels_for_graphviz.cypher" > " ${reportName} .csv"
63- source " ${VISUALIZATION_SCRIPTS_DIR} /convertQueryResultCsvToGraphVizDotFile.sh" --filename " ${reportName} .csv"
64- visualizeGraphAndGenerateSvg
65+ visualizeGraphAndGenerateSvg " ${reportName} "
6566
6667# TypeScript Modules: Dependencies Visualization
6768reportName=" ${FULL_REPORT_DIRECTORY} /TypeScriptModuleBuildLevels"
68- echo " InternalDependenciesVisualization Generating ${reportName} ..."
6969execute_cypher " ${INTERNAL_DEPENDENCIES_CYPHER_DIR} /Typescript_Module_build_levels_for_graphviz.cypher" > " ${reportName} .csv"
70- source " ${VISUALIZATION_SCRIPTS_DIR} /convertQueryResultCsvToGraphVizDotFile.sh" --filename " ${reportName} .csv"
71- visualizeGraphAndGenerateSvg
70+ visualizeGraphAndGenerateSvg " ${reportName} "
7271
7372# Clean-up after report generation. Empty reports will be deleted.
7473source " ${SCRIPTS_DIR} /cleanupAfterReportGeneration.sh" " ${FULL_REPORT_DIRECTORY} "
0 commit comments