|
6 | 6 |
|
7 | 7 | die () { echo "$*" >&2; exit 1; }
|
8 | 8 |
|
| 9 | +changed () { ! diff $@ >/dev/null; } |
| 10 | + |
9 | 11 | sectionStart() {
|
10 | 12 | startTime=$(date +%s)
|
11 | 13 | echo
|
@@ -117,6 +119,7 @@ test "$(grep -F "[ERROR]" "$meltingPotLog" | grep -v "using default branch")" &&
|
117 | 119 | die 'Melting pot generation failed!'
|
118 | 120 |
|
119 | 121 | buildScript="$meltingPotDir/build.sh"
|
| 122 | +versionPins="$meltingPotDir/version-pins.xml" |
120 | 123 |
|
121 | 124 | echo
|
122 | 125 | echo 'Hacking in any changed components...'
|
|
196 | 199 | if [ -f gav ]
|
197 | 200 | then
|
198 | 201 | mv gav gav.prehacks
|
199 |
| - sed -E "s;:[^:]*$;:999;" gav.prehacks > gav || { |
| 202 | + sed -E "s;:[^:]*$;:999;" gav.prehacks > gav && changed gav.prehacks gav || { |
200 | 203 | touch "$failFile"
|
201 | 204 | die "$g:$a: failed to adjust gav version"
|
202 | 205 | }
|
|
210 | 213 | }
|
211 | 214 | printf .
|
212 | 215 |
|
213 |
| - # Adjust component version to 999 in melting pot's build.sh. |
| 216 | + # Adjust component version to 999 in melting pot's version-pins.xml. |
214 | 217 | cd "$meltingPotDir"
|
215 |
| - test -f "$buildScript.prehacks" || cp "$buildScript" "$buildScript.prehacks" || { |
| 218 | + test -f "$versionPins.prehacks" || cp "$versionPins" "$versionPins.prehacks" || { |
216 | 219 | touch "$failFile"
|
217 |
| - die "$g:$a: failed to back up $buildScript" |
| 220 | + die "$g:$a: failed to back up $versionPins" |
218 | 221 | }
|
219 | 222 | printf .
|
220 |
| - mv -f "$buildScript" "$buildScript.tmp" && |
221 |
| - sed -E "s;(-D($g\\.)?$a\\.version)=[^ ]*;\1=999;g" "$buildScript.tmp" > "$buildScript" || { |
| 223 | + echo "$a" | grep -q '^[0-9]' && aa="_$a" || aa="$a" |
| 224 | + mv -f "$versionPins" "$versionPins.tmp" && |
| 225 | + sed -E "s;<\($g\\.$a\|$aa\)\\.version>[^<]*;<\1.version>999;g" "$versionPins.tmp" > "$versionPins" && |
| 226 | + changed "$versionPins.tmp" "$versionPins" || |
| 227 | + { |
222 | 228 | touch "$failFile"
|
223 |
| - die "$g:$a: failed to adjust component version in $buildScript" |
| 229 | + die "$g:$a: failed to adjust component version in $versionPins" |
224 | 230 | }
|
225 | 231 | printf .
|
226 | 232 |
|
|
235 | 241 | }
|
236 | 242 | printf ".\n"
|
237 | 243 | done
|
238 |
| -rm -f "$buildScript.tmp" "$meltScript.tmp" |
| 244 | +rm -f "$versionPins.tmp" "$meltScript.tmp" |
239 | 245 | test ! -f "$failFile" ||
|
240 | 246 | die "Failed to hack in changed components!"
|
241 | 247 |
|
242 |
| -sectionStart 'Adjusting the melting pot: build.sh script' |
| 248 | +sectionStart 'Adjusting the melting pot: version-pins.xml configuration' |
243 | 249 |
|
244 |
| -cp "$buildScript" "$buildScript.original" && |
| 250 | +cp "$versionPins" "$versionPins.original" && |
245 | 251 |
|
246 | 252 | # HACK: Remove known-duplicate short version properties, keeping
|
247 | 253 | # the short version declaration only for the more common groupId.
|
248 | 254 | # E.g.: org.antlr:antlr is preferred over antlr:antlr, so we set
|
249 | 255 | # antlr.version to match org.antlr:antlr, not antlr:antlr.
|
250 |
| -mv -f "$buildScript" "$buildScript.tmp" && |
251 |
| -sed -E 's;(-D('"$shortVersionClashes"').version=[^ ]*) -D[^ ]*;\1;' "$buildScript.tmp" > "$buildScript" && |
252 |
| - |
253 |
| -# HACK: Add leading underscore to version properties that start with a digit. |
254 |
| -mv -f "$buildScript" "$buildScript.tmp" && |
255 |
| -sed -E 's; -D([0-9][^ ]*);& -D_\1;' "$buildScript.tmp" > "$buildScript" && |
| 256 | +mv -f "$versionPins" "$versionPins.tmp" && |
| 257 | +sed -E 's;(<('"$shortVersionClashes"')\.version>[^ ]*) <[^ ]*;\1;' "$versionPins.tmp" > "$versionPins" && |
| 258 | + changed "$versionPins.tmp" "$versionPins" || |
| 259 | + die 'Error adjusting melting pot version pins! [1]' |
256 | 260 |
|
257 | 261 | # HACK: Add non-standard version properties used prior to
|
258 | 262 | # pom-scijava 32.0.0-beta-1; see d0bf752070d96a2613c42e4e1ab86ebdd07c29ee.
|
259 |
| -mv -f "$buildScript" "$buildScript.tmp" && |
260 |
| -sed -E 's; -Dsc.fiji.3D_Blob_Segmentation\.version=([^ ]*);& -DFiji_3D_Blob_Segmentation.version=\1;' "$buildScript.tmp" > "$buildScript" && |
261 |
| -mv -f "$buildScript" "$buildScript.tmp" && |
262 |
| -sed -E 's; -Dsc.fiji.(3D_Objects_Counter|3D_Viewer)\.version=([^ ]*);& -DImageJ_\1.version=\2;' "$buildScript.tmp" > "$buildScript" && |
| 263 | +mv -f "$versionPins" "$versionPins.tmp" && |
| 264 | +sed -E 's; <sc.fiji.3D_Blob_Segmentation\.version>([^<]*)</sc.fiji.3D_Blob_Segmentation.version>;& <Fiji_3D_Blob_Segmentation.version>\1</Fiji_3D_Blob_Segmentation.version>;' "$versionPins.tmp" > "$versionPins" && |
| 265 | + changed "$versionPins.tmp" "$versionPins" && |
| 266 | +mv -f "$versionPins" "$versionPins.tmp" && |
| 267 | +sed -E 's; <sc.fiji.(3D_Objects_Counter|3D_Viewer)\.version>([^<]*)</sc.fiji.(3D_Objects_Counter|3D_Viewer).version>;& <ImageJ_\1.version>\2</ImageJ_\1.version>;' "$versionPins.tmp" > "$versionPins" && |
| 268 | + changed "$versionPins.tmp" "$versionPins" || |
| 269 | + die 'Error adjusting melting pot version pins! [2]' |
263 | 270 |
|
264 | 271 | # HACK: Add non-standard net.imagej:ij version property used prior to
|
265 | 272 | # pom-scijava 28.0.0; see 7d2cc442b107b3ac2dcb799d282f2c0b5822649d.
|
266 |
| -mv -f "$buildScript" "$buildScript.tmp" && |
267 |
| -sed -E 's; -Dij\.version=([^ ]*);& -Dimagej1.version=\1;' "$buildScript.tmp" > "$buildScript" && |
| 273 | +mv -f "$versionPins" "$versionPins.tmp" && |
| 274 | +sed -E 's; <ij\.version>([^<]*)</ij\.version>;& <imagej1.version>\1</imagej1.version>;' "$versionPins.tmp" > "$versionPins" && |
| 275 | + changed "$versionPins.tmp" "$versionPins" || |
| 276 | + die 'Error adjusting melting pot version pins! [3]' |
| 277 | + |
| 278 | +rm "$versionPins.tmp" || |
| 279 | + die 'Error adjusting melting pot version pins! [4]' |
| 280 | + |
| 281 | +sectionEnd # Adjusting the melting pot: version-pins.xml configuration |
| 282 | + |
| 283 | +sectionStart 'Adjusting the melting pot: build.sh script' |
| 284 | + |
| 285 | +cp "$buildScript" "$buildScript.original" && |
268 | 286 |
|
269 | 287 | # HACK: Add explicit kotlin.version to match our pom-scijava-base.
|
270 | 288 | # Otherwise, components built on older pom-scijava-base will have
|
@@ -294,7 +312,8 @@ enforcerVersion=$(
|
294 | 312 | -Dexec.args='${maven-enforcer-plugin.version}' --non-recursive validate exec:exec 2>&1 |
|
295 | 313 | head -n1 | sed 's;\(.\[[0-9]m\)*;;') &&
|
296 | 314 | mv -f "$buildScript" "$buildScript.tmp" &&
|
297 |
| -sed -E "s;mvn -Denforcer.skip;& -Dmaven-enforcer-plugin.version=$enforcerVersion -Dkotlin.version=$kotlinVersion;" "$buildScript.tmp" > "$buildScript" && |
| 315 | +sed -E "s;mvn .*-Denforcer.skip;& -Dmaven-enforcer-plugin.version=$enforcerVersion -Dkotlin.version=$kotlinVersion;" "$buildScript.tmp" > "$buildScript" && |
| 316 | + changed "$buildScript.tmp" "$buildScript" && |
298 | 317 |
|
299 | 318 | chmod +x "$buildScript" &&
|
300 | 319 | rm "$buildScript.tmp" ||
|
|
0 commit comments