Skip to content

Commit

Permalink
Merge pull request #391 from Raleksan/explain_maven_graddle
Browse files Browse the repository at this point in the history
#229 Explain repository compilation
  • Loading branch information
yegor256 authored Nov 4, 2024
2 parents 1eb1845 + 88d27cf commit f5a8223
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
17 changes: 13 additions & 4 deletions steps/jpeek-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,39 @@ fi
mkdir -p "${logs}"

build() {
failure_log="${TARGET}/temp/jpeek_failure.log"
success_log="${TARGET}/temp/jpeek_success.log"
if [ -e "${project}/gradlew" ]; then
echo "Building ${repo} (${pos}/${total}) with Gradlew..."
if ! timeout 1h "${project}/gradlew" classes -q -p "${project}" > "${logs}/gradlew.log" 2>&1; then
echo "Failed to compile ${repo} using Gradlew$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Failure ${repo} Gradlew" >> "${failure_log}"
exit
fi
echo "Сompiled ${repo} using Gradlew$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Compiled ${repo} using Gradlew$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Success ${repo} Gradlew" >> "${success_log}"
elif [ -e "${project}/build.gradle" ]; then
echo "Building ${repo} (${pos}/${total}) with Gradle..."
echo "apply plugin: 'java'" >> "${project}/build.gradle"
if ! timeout 1h gradle classes -q -p "${project}" > "${logs}/gradle.log" 2>&1; then
echo "Failed to compile ${repo} using Gradle$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Failed to compile ${repo} using Gradle$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Failure ${repo} Gradle" >> "${failure_log}"
exit
fi
echo "Сompiled ${repo} using Gradle$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Compiled ${repo} using Gradle$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Success ${repo} Gradle" >> "${success_log}"
elif [ -e "${project}/pom.xml" ]; then
echo "Building ${repo} (${pos}/${total}) with Maven..."
if ! timeout 1h mvn compile -quiet -DskipTests -f "${project}" -U > "${logs}/maven.log" 2>&1; then
echo "Failed to compile ${repo} using Maven$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Failure ${repo} Maven" >> "${failure_log}"
exit
fi
echo "Сompiled ${repo} using Maven$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Compiled ${repo} using Maven$("${LOCAL}/help/tdiff.sh" "${start}")"
echo "Success ${repo} Maven" >> "${success_log}"
else
echo "Could not build classes in ${repo} (${pos}/${total}) (neither Maven nor Gradle project)"
echo "Failure ${repo} Non-build" >> "${failure_log}"
exit
fi
}
Expand Down
2 changes: 2 additions & 0 deletions steps/jpeek.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ touch "${jobs}"
repos=$(find "${TARGET}/github" -maxdepth 2 -mindepth 2 -type d -print)
total=$(echo "${repos}" | wc -l | xargs)

: > "${TARGET}/temp/jpeek_failure.log"
: > "${TARGET}/temp/jpeek_success.log"
dir=${TARGET}/temp/jpeek/all
mkdir -p "${dir}"

Expand Down
1 change: 1 addition & 0 deletions tests/steps/test-jpeek-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ echo "👍🏻 jPeek dependencies are installed"
test ! "${value}" = 'NaN'
test -e "${TARGET}/measurements/${repo}/src/main/java/com/yegor256/Jaxec.java.m.NHD-cvc"
test ! -e "${TARGET}/measurements/${repo}/src/main/java/com/yegor256/Jaxec.java.m.NHD-cvc-cvc"
test "$(grep -Ec 'Success.*Maven' "${TARGET}/temp/jpeek_success.log")" = '1'
} > "${stdout}" 2>&1
echo "👍🏻 A simple repo analyzed with jpeek correctly"

Expand Down
2 changes: 2 additions & 0 deletions tests/steps/test-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ echo "👍🏻 Dependencies are available"
mkdir -p "${TARGET}/data"
mkdir -p "${TARGET}/github"
echo "\\item foo" > "${TARGET}/temp/reports/foo.tex"
: > "${TARGET}/temp/jpeek_failure.log"
: > "${TARGET}/temp/jpeek_success.log"
"${LOCAL}/steps/report.sh"
test -e "${TARGET}/report.pdf"
pdftotext "${TARGET}/report.pdf" "${TARGET}/report.txt"
Expand Down
13 changes: 13 additions & 0 deletions tex/report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ \section{Results}\label{sec:results}

\end{itemize}

Some repositories require compilation prior to analysis.
Below is a summary of the build systems used and the status of their builds:
\begin{itemize}
\item Gradlew: successful builds: \iexec{grep -E 'Success.*Gradlew' "${TARGET}/temp/jpeek_success.log" | wc -l},
failed builds: \iexec{grep -E 'Failure.*Gradlew' "${TARGET}/temp/jpeek_failure.log" | wc -l}.
\item Gradle: successful builds: \iexec{grep -E 'Success.*Gradle' "${TARGET}/temp/jpeek_success.log" | wc -l},
failed builds: \iexec{grep -E 'Failure.*Gradle' "${TARGET}/temp/jpeek_failure.log" | wc -l}.
\item Maven: successful builds: \iexec{grep -E 'Success.*Maven' "${TARGET}/temp/jpeek_success.log" | wc -l},
failed builds: \iexec{grep -E 'Failure.*Maven' "${TARGET}/temp/jpeek_failure.log" | wc -l}.
\item Other: successful builds: \iexec{grep -E 'Success.*Non-build' "${TARGET}/temp/jpeek_success.log" | wc -l},
failed builds: \iexec{grep -E 'Failure.*Non-build' "${TARGET}/temp/jpeek_failure.log" | wc -l}.
\end{itemize}

The following
\iexec{cat "${TARGET}/temp/list-of-metrics.tex" | wc -l}\unskip{}
metrics were
Expand Down

0 comments on commit f5a8223

Please sign in to comment.