Skip to content

Commit 0114410

Browse files
committed
Integrate git log import into analysis preparation
1 parent 59a35a7 commit 0114410

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Find Java types not covered by git data for git log data import troubleshooting/testing.
2+
3+
MATCH (type:Java&Type&!PrimitiveType&!Void&!JavaType&!ResolvedDuplicateType&!ExternalType)
4+
WHERE NOT EXISTS { (type)<-[:RESOLVES_TO]-(git_file:Git&File) }
5+
AND NOT type.fqn contains '$' // Inner classes are contained in the outer file
6+
RETURN type.fqn, count(*)
7+
LIMIT 50

scripts/analysis/analyze.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Coordinates the end-to-end analysis process, encompassing tool installation, graph generation, and report generation.
44
# - Download and setup Neo4j and JQAssistant
5-
# - Scan and analyze the contents of the artifacts directory to create the graph
5+
# - Scan and analyze the contents of the artifacts and source directory to create the graph
66
# - Trigger all requested reports
77

88
# Note: Everything is done in the current (=working) directory and one directory above (shared downloads).
9-
# It is recommended to create an empty directory (preferrable "temp") and
9+
# It is recommended to create an empty directory (preferable "temp") and
1010
# within that another one for the analysis (e.g. "MyCodebaseName-Version")
1111
# and change into it prior to starting this script.
1212

scripts/downloader/downloadAxonFramework.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ SCRIPT_FILE_NAME="$(basename -- "${BASH_SOURCE[0]}")"
1515
SCRIPT_FILE_NAME_WITHOUT_EXTENSION="${SCRIPT_FILE_NAME%%.*}"
1616
SCRIPT_FILE_NAME_WITHOUT_PREFIX_AND_EXTENSION="${SCRIPT_FILE_NAME_WITHOUT_EXTENSION##download}"
1717
ANALYSIS_NAME="${SCRIPT_FILE_NAME_WITHOUT_PREFIX_AND_EXTENSION}"
18+
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-"source"} # Get the source repository directory (defaults to "source")
1819

1920
echo "download${ANALYSIS_NAME}: SCRIPT_FILE_NAME=${SCRIPT_FILE_NAME}"
2021
echo "download${ANALYSIS_NAME}: SCRIPT_FILE_NAME_WITHOUT_EXTENSION=${SCRIPT_FILE_NAME_WITHOUT_EXTENSION}"
2122
echo "download${ANALYSIS_NAME}: ANALYSIS_NAME=${ANALYSIS_NAME}"
2223

2324
# Read the first input argument containing the version(s) of the artifact(s)
2425
if [ "$#" -ne 1 ]; then
25-
echo "Error (download${ANALYSIS_NAME}): Usage: $0 <version>" >&2
26+
echo "Error (download${ANALYSIS_NAME}): Usage: $0 <version> (e.g. 4.9.3)" >&2
2627
exit 1
2728
fi
2829
ARTIFACTS_VERSION=$1
@@ -41,12 +42,15 @@ echo "download${ANALYSIS_NAME}: SCRIPTS_DIR=${SCRIPTS_DIR}"
4142

4243
################################################################
4344
# Download Artifacts that will be analyzed
44-
################################################################
4545
ARTIFACTS_GROUP="org.axonframework"
4646
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-configuration -v ${ARTIFACTS_VERSION} || exit 2
4747
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-disruptor -v ${ARTIFACTS_VERSION} || exit 2
4848
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-eventsourcing -v ${ARTIFACTS_VERSION} || exit 2
4949
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-messaging -v ${ARTIFACTS_VERSION} || exit 2
5050
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-modelling -v ${ARTIFACTS_VERSION} || exit 2
5151
source "${SCRIPTS_DIR}/downloadMavenArtifact.sh" -g ${ARTIFACTS_GROUP} -a axon-test -v ${ARTIFACTS_VERSION} || exit 2
52+
53+
# Download the git history (bare clone without working tree) into the "source" folder.
54+
# This makes it possible to additionally import the git log into the graph
55+
git clone --bare https://github.com/AxonFramework/AxonFramework.git --branch "axon-${ARTIFACTS_VERSION}" "${SOURCE_DIRECTORY}/.git"
5256
################################################################

scripts/downloader/downloadReactRouter.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
# Note: react-router uses pnpm as package manager which needs to be installed
1313

14-
# Requires downloadMavenArtifact.sh
15-
1614
# Fail on any error (errexit = exit on first error, errtrace = error inherited from sub-shell ,pipefail exist on errors within piped commands)
1715
set -o errexit -o errtrace -o pipefail
1816

@@ -21,6 +19,7 @@ SCRIPT_FILE_NAME="$(basename -- "${BASH_SOURCE[0]}")"
2119
SCRIPT_FILE_NAME_WITHOUT_EXTENSION="${SCRIPT_FILE_NAME%%.*}"
2220
SCRIPT_FILE_NAME_WITHOUT_PREFIX_AND_EXTENSION="${SCRIPT_FILE_NAME_WITHOUT_EXTENSION##download}"
2321
ANALYSIS_NAME="${SCRIPT_FILE_NAME_WITHOUT_PREFIX_AND_EXTENSION}"
22+
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-"source"} # Get the source repository directory (defaults to "source")
2423

2524
echo "download${ANALYSIS_NAME}: SCRIPT_FILE_NAME=${SCRIPT_FILE_NAME}"
2625
echo "download${ANALYSIS_NAME}: SCRIPT_FILE_NAME_WITHOUT_EXTENSION=${SCRIPT_FILE_NAME_WITHOUT_EXTENSION}"
@@ -40,13 +39,13 @@ mkdir -p ./runtime/logs
4039
################################################################
4140
# Download react-router source files to be analyzed
4241
################################################################
43-
git clone https://github.com/remix-run/react-router.git source
42+
git clone https://github.com/remix-run/react-router.git "${SOURCE_DIRECTORY}"
4443
(
45-
cd source || exit
44+
cd "${SOURCE_DIRECTORY}" || exit
4645
git checkout "react-router@${PROJECT_VERSION}" || exit
4746
pnpm install --frozen-lockfile || exit
4847
npx --yes @jqassistant/ts-lce >./../runtime/logs/jqassostant-typescript-scan.log 2>&1 || exit
4948
)
5049
mkdir -p artifacts
51-
mv -nv "source/.reports/jqa/ts-output.json" "artifacts/ts-react-router-${PROJECT_VERSION}.json"
50+
mv -nv "${SOURCE_DIRECTORY}/.reports/jqa/ts-output.json" "artifacts/ts-react-router-${PROJECT_VERSION}.json"
5251
################################################################

scripts/prepareAnalysis.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Prepares and validates the graph database before analysis
44

5-
# Requires executeQueryFunctions.sh, parseCsvFunctions.sh
5+
# Requires executeQueryFunctions.sh, parseCsvFunctions.sh, importGitLog.sh, importAggregatedGitLog
66

77
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
88
set -o errexit -o pipefail
@@ -24,10 +24,10 @@ fi
2424
CYPHER_DIR=${CYPHER_DIR:-"${SCRIPTS_DIR}/../cypher"} # Repository directory containing the cypher queries
2525
echo "prepareAnalysis: CYPHER_DIR=${CYPHER_DIR}"
2626

27-
# Define functions to execute a cypher query from within the given file (first and only argument)
27+
# Define functions (like execute_cypher) to execute a cypher query from within the given file (first and only argument)
2828
source "${SCRIPTS_DIR}/executeQueryFunctions.sh"
2929

30-
# Define function(s) (e.g. is_csv_column_greater_zero) to parse CSV format strings from Cypher query results.
30+
# Define functions (like is_csv_column_greater_zero) to parse CSV format strings from Cypher query results.
3131
source "${SCRIPTS_DIR}/parseCsvFunctions.sh"
3232

3333
# Local Constants
@@ -38,13 +38,18 @@ ARTIFACT_DEPENDENCIES_CYPHER_DIR="$CYPHER_DIR/Artifact_Dependencies"
3838
TYPES_CYPHER_DIR="$CYPHER_DIR/Types"
3939
TYPESCRIPT_CYPHER_DIR="$CYPHER_DIR/Typescript_Enrichment"
4040

41-
# Preparation - Data verification: DEPENDS_ON releationships
41+
# Preparation - Data verification: DEPENDS_ON relationships
4242
dataVerificationResult=$( execute_cypher "${CYPHER_DIR}/Data_verification_DEPENDS_ON_relationships.cypher" "${@}")
4343
if ! is_csv_column_greater_zero "${dataVerificationResult}" "sourceNodeCount"; then
4444
echo "prepareAnalysis: Error: Data verification failed. At least one DEPENDS_ON relationship required. Check if the artifacts directory is empty or if the scan failed."
4545
exit 1
4646
fi
4747

48+
# Preparation - Import git log if source or history is available
49+
# TODO move into separate analysis compilation/part that is selectable
50+
source "${SCRIPTS_DIR}/importGitLog.sh"
51+
source "${SCRIPTS_DIR}/importAggregatedGitLog.sh"
52+
4853
# Preparation - Create indices
4954
execute_cypher "${CYPHER_DIR}/Create_Java_Type_index_for_full_qualified_name.cypher"
5055
execute_cypher "${CYPHER_DIR}/Create_Typescript_index_for_full_qualified_name.cypher"

0 commit comments

Comments
 (0)