Skip to content

Commit f3c1b6a

Browse files
hinermdscho
authored andcommitted
bump-pom-scijava: set profile properties
When bumping pom properties, also bump the corresponding properties in any profile sections to the latest SNAPSHOT versions. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent bbbfd69 commit f3c1b6a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

bump-pom-scijava.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ else
207207

208208
p="$(sed_quote "$property")"
209209
v="$(sed_quote "$value")"
210+
# Set the primary property version
210211
sed \
211212
-e "/^ <properties>/,/^ <\/properties>/s/\(<$p>\)[^<]*\(<\/$p>\)/\1$v\2/" \
212213
$pom > $pom.new &&
@@ -221,6 +222,22 @@ else
221222
mv $pom.new $pom ||
222223
die "Failed to set property $property = $value"
223224

225+
# Set the profile snapshot version
226+
value="$(sh "$maven_helper" latest-version "$ga:SNAPSHOT")"
227+
v="$(sed_quote "$value")"
228+
sed -e "/<profiles>/,/<\/profiles>/s/\(<$p>\)[^<]*\(<\/$p>\)/\1$v\2/" \
229+
$pom > $pom.new &&
230+
if ! cmp $pom $pom.new
231+
then
232+
message="$(printf '%s\n\t%s = %s%s' \
233+
"$message" "$property" "$value" "$latest_message")"
234+
elif test -n "$must_change"
235+
then
236+
die "Profile property $property not found in $pom"
237+
fi &&
238+
mv $pom.new $pom ||
239+
die "Failed to set profile property $property = $value"
240+
224241
shift
225242
shift
226243
done

0 commit comments

Comments
 (0)