Skip to content

Commit 9058af7

Browse files
committed
mega-melt: prune short properties in a better way
We now only prune the duplicate short property from the inferior component's groupId, rather than pruning *all* properties for matching artifactIds. This commit also generalizes the logic into a loop, for DRYness.
1 parent 95e1fef commit 9058af7

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

tests/run.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ meltingPotDir="$megaMeltDir/melting-pot"
4141
skipTestsFile="$meltingPotDir/skipTests.txt"
4242
meltScript="$meltingPotDir/melt.sh"
4343

44+
# HACK: List of artifacts with known-duplicate short version properties.
45+
shortVersionClashes=\
46+
'net.sourceforge.findbugs.annotations'\
47+
'|antr.antlr'\
48+
'|org.jogamp.jocl.jocl'\
49+
'|net.sf.opencsv.opencsv'\
50+
'|org.jetbrains.intellij.deps.trove4j'
51+
4452
rm -rf "$megaMeltDir" && mkdir -p "$megaMeltDir" || die "Creation of $megaMeltDir failed!"
4553
cp "$pom" "$pomParent" &&
4654
mvn -B -f "$pomParent" versions:set -DnewVersion=999-mega-melt > "$versionSwapLog" ||
@@ -106,28 +114,33 @@ grep -qF "[ERROR]" "$meltingPotLog" &&
106114

107115
sectionStart 'Adjusting the melting pot'
108116

109-
# HACK: Remove known-duplicate artifactIds from version property overrides.
110-
# The plan is for this step to become unnecessary once the melting pot has
111-
# been improved to include a strategy for dealing with components with same
112-
# artifactId but different groupIds. For now, we just prune these overrides.
113117
buildScript="$meltingPotDir/build.sh"
114118
buildScriptTemp="$buildScript.tmp"
115119
cp "$buildScript" "$buildScript.original" &&
120+
121+
# HACK: Remove known-duplicate short version properties, keeping
122+
# the short version declaration only for the more common groupId.
123+
# E.g.: org.antlr:antlr is preferred over antlr:antlr, so we set
124+
# antlr.version to match org.antlr:antlr, not antlr:antlr.
116125
mv -f "$buildScript" "$buildScriptTemp" &&
117-
awk '!/-D(annotations|antlr|jocl|opencsv|trove4j)\.version/' "$buildScriptTemp" > "$buildScript" &&
126+
sed -E 's;(-D('"$shortVersionClashes"').version=[^ ]*) -D[^ ]*;\1;' "$buildScriptTemp" > "$buildScript" &&
127+
118128
# HACK: Add leading underscore to version properties that start with a digit.
119129
mv -f "$buildScript" "$buildScriptTemp" &&
120130
sed -E 's; -D([0-9][^ ]*);& -D_\1;' "$buildScriptTemp" > "$buildScript" &&
131+
121132
# HACK: Add non-standard version properties used prior to
122133
# pom-scijava 32.0.0-beta-1; see d0bf752070d96a2613c42e4e1ab86ebdd07c29ee.
123134
mv -f "$buildScript" "$buildScriptTemp" &&
124135
sed -E 's; -Dsc.fiji.3D_Blob_Segmentation\.version=([^ ]*);& -DFiji_3D_Blob_Segmentation.version=\1;' "$buildScriptTemp" > "$buildScript" &&
125136
mv -f "$buildScript" "$buildScriptTemp" &&
126137
sed -E 's; -Dsc.fiji.(3D_Objects_Counter|3D_Viewer)\.version=([^ ]*);& -DImageJ_\1.version=\2;' "$buildScriptTemp" > "$buildScript" &&
138+
127139
# HACK: Add non-standard net.imagej:ij version property used prior to
128140
# pom-scijava 28.0.0; see 7d2cc442b107b3ac2dcb799d282f2c0b5822649d.
129141
mv -f "$buildScript" "$buildScriptTemp" &&
130142
sed -E 's; -Dij\.version=([^ ]*);& -Dimagej1.version=\1;' "$buildScriptTemp" > "$buildScript" &&
143+
131144
chmod +x "$buildScript" &&
132145
rm "$buildScriptTemp" ||
133146
die 'Error adjusting melting pot build script!'

0 commit comments

Comments
 (0)