Skip to content

Commit e2a7601

Browse files
committed
mega-melt: time each step of mega-melt generation
1 parent c17811b commit e2a7601

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

tests/run.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@
66

77
die () { echo "$*" >&2; exit 1; }
88

9-
echo &&
10-
printf 'Generating mega-melt project... ' &&
9+
sectionStart() {
10+
startTime=$(date +%s)
11+
echo
12+
printf "$1... "
13+
}
14+
15+
sectionEnd() {
16+
endTime=$(date +%s)
17+
echo "Done! [$((endTime-startTime))s]"
18+
}
19+
20+
sectionStart 'Generating mega-melt project'
1121

1222
dir=$(dirname "$0")
1323
pom="$dir/../pom.xml"
@@ -36,21 +46,20 @@ cp "$pom" "$pomParent" &&
3646
mvn -B -f "$pomParent" versions:set -DnewVersion=999-mega-melt > "$versionSwapLog" ||
3747
die "pom-scijava version update failed:\n$(cat "$versionSwapLog")"
3848
python "$generateMegaMeltScript" "$megaMeltDir" || die 'Generation failed!'
39-
echo 'Done!'
49+
sectionEnd # Generating mega-melt project
4050

4151
# Ensure the mega-melt dependency structure validates.
4252
# In particular, this runs our enforcer rules: the build
4353
# will fail if there are any snapshot dependencies, or
4454
# any duplicate classes across artifacts on the classpath.
45-
echo &&
46-
printf 'Validating mega-melt project... ' &&
55+
sectionStart 'Validating mega-melt project'
4756
mvn -B -f "$megaMeltPOM" dependency:tree > "$dependencyTreeLog" ||
4857
die "Invalid dependency tree:\n$(cat "$dependencyTreeLog")"
4958
mvn -B -f "$megaMeltPOM" -U clean package > "$validationLog" || {
5059
python "$filterBuildLogScript" "$validationLog" > "$validationErrorsLog"
5160
die "Validation build failed!\n\nDependency tree:\n$(cat "$dependencyTreeLog")\n\nBuild log:\n$(cat "$validationErrorsLog")"
5261
}
53-
echo 'Done!'
62+
sectionEnd # Validating mega-melt project
5463

5564
# Run mega-melt through the melting pot, with all SciJava-affiliated groupIds,
5665
# minus excluded artifacts (see ignoredArtifacts in generate-mega-melt.py).
@@ -95,14 +104,14 @@ chmod +x "$meltingPotScript" &&
95104
grep -qF "[ERROR]" "$meltingPotLog" &&
96105
die 'Melting pot generation failed!'
97106

107+
sectionStart 'Adjusting the melting pot'
108+
98109
# HACK: Remove known-duplicate artifactIds from version property overrides.
99110
# The plan is for this step to become unnecessary once the melting pot has
100111
# been improved to include a strategy for dealing with components with same
101112
# artifactId but different groupIds. For now, we just prune these overrides.
102113
buildScript="$meltingPotDir/build.sh"
103114
buildScriptTemp="$buildScript.tmp"
104-
echo &&
105-
printf 'Adjusting melting pot build script... ' &&
106115
cp "$buildScript" "$buildScript.original" &&
107116
mv -f "$buildScript" "$buildScriptTemp" &&
108117
awk '!/-D(annotations|antlr|jocl|kryo|minlog|opencsv|trove4j)\.version/' "$buildScriptTemp" > "$buildScript" &&
@@ -122,24 +131,18 @@ sed -E 's; -Dij\.version=([^ ]*);& -Dimagej1.version=\1;' "$buildScriptTemp" > "
122131
chmod +x "$buildScript" &&
123132
rm "$buildScriptTemp" ||
124133
die 'Error adjusting melting pot build script!'
125-
echo 'Done!'
126134

127135
# HACK: Adjust component POMs to satisfy Maven HTTPS strictness.
128-
echo &&
129-
printf 'Adjusting melting pot project POMs... ' &&
130136
find "$meltingPotDir" -name pom.xml | while read pom
131137
do
132138
mv "$pom" "$pom.original" &&
133139
sed -E -e 's_(https?://maven.imagej.net|http://maven.scijava.org)_https://maven.scijava.org_g' \
134140
-e 's_http://maven.apache.org/xsd_https://maven.apache.org/xsd_g' "$pom.original" > "$pom" ||
135141
die "Failed to adjust $pom"
136142
done
137-
echo 'Done!'
138143

139144
# HACK: Skip tests for projects with known problems.
140145

141-
echo &&
142-
printf 'Adjusting melting pot melt script... ' &&
143146
mv "$meltScript" "$meltScript.original" &&
144147
sed 's_\s*"$dir/build.sh"_\
145148
# HACK: If project is on the skipTests list, then skip the tests.\
@@ -149,7 +152,6 @@ grep -qxF "$f" $dir/skipTests.txt \&\& buildFlags=-DskipTests\
149152
& $buildFlags_' "$meltScript.original" > "$meltScript" &&
150153
chmod +x "$meltScript" ||
151154
die "Failed to adjust $meltScript"
152-
echo 'Done!'
153155

154156
# com.amazonaws.services.s3.model.AmazonS3Exception: The specified bucket does
155157
# not exist (Service: Amazon S3; Status Code: 404; Error Code: NoSuchBucket;
@@ -164,6 +166,8 @@ echo "org.janelia.saalfeldlab/n5-zarr" >> "$skipTestsFile" &&
164166
echo "sc.fiji/labkit-pixel-classification" >> "$skipTestsFile" ||
165167
die "Failed to generate $skipTestsFile"
166168

169+
sectionEnd # Adjusting the melting pot
170+
167171
# Run the melting pot now, unless -s flag was given.
168172
doMelt=t
169173
for arg in "$@"

0 commit comments

Comments
 (0)