Skip to content

Commit afcae7f

Browse files
committed
Merge branch 'developer-profiles'
This topic branch teaches bump-pom-scijava to update the developer profiles, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents f421dba + 5e81b86 commit afcae7f

2 files changed

Lines changed: 33 additions & 10 deletions

File tree

bump-pom-scijava.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ set imagej1.version --latest \
107107
imagej-launcher.version --latest \
108108
imagej-maven-plugin.version --latest \
109109
imglib2.version --latest \
110+
imglib2-ij.version --latest \
110111
junit-benchmarks.version --latest \
111112
minimaven.version --latest \
112113
nar.version --latest \
@@ -171,8 +172,8 @@ else
171172
imagej-maven-plugin.version)
172173
ga=net.imagej:imagej-maven-plugin
173174
;;
174-
imglib2.version)
175-
ga=net.imglib2:imglib2
175+
imglib2.version|imglib2-ij.version)
176+
ga=net.imglib2:${property%.version}
176177
;;
177178
junit-benchmarks.version)
178179
ga=org.scijava:junit-benchmarks
@@ -208,8 +209,9 @@ else
208209

209210
p="$(sed_quote "$property")"
210211
v="$(sed_quote "$value")"
212+
# Set the primary property version
211213
sed \
212-
-e "/<properties>/,/<\/properties>/s/\(<$p>\)[^<]*\(<\/$p>\)/\1$v\2/" \
214+
-e "/^ <properties>/,/^ <\/properties>/s/\(<$p>\)[^<]*\(<\/$p>\)/\1$v\2/" \
213215
$pom > $pom.new &&
214216
if ! cmp $pom $pom.new
215217
then
@@ -222,6 +224,22 @@ else
222224
mv $pom.new $pom ||
223225
die "Failed to set property $property = $value"
224226

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

maven-helper.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ set -e
88

99
root_url () {
1010
test snapshots != "$2" || {
11-
echo http://maven.imagej.net/content/repositories/snapshots
11+
if curl -fs http://maven.imagej.net/content/repositories/snapshots/"$1"/ > /dev/null 2>&1
12+
then
13+
echo http://maven.imagej.net/content/repositories/snapshots
14+
else
15+
echo http://maven.imagej.net/content/repositories/sonatype-snapshots
16+
fi
1217
return
1318
}
1419
echo http://maven.imagej.net/content/groups/public
@@ -108,17 +113,17 @@ project_url () {
108113
version="$(version "$gav")"
109114
case "$version" in
110115
*SNAPSHOT)
111-
echo "$(root_url $artifactId snapshots)/$infix"
116+
echo "$(root_url $infix snapshots)/$infix"
112117
;;
113118
*)
114119
# Release could be in either releases or thirdparty; try releases first
115-
project_url="$(root_url $artifactId releases)/$infix"
120+
project_url="$(root_url $infix releases)/$infix"
116121
header=$(curl -Is "$project_url/")
117122
case "$header" in
118123
HTTP/1.?" 200 OK"*)
119124
;;
120125
*)
121-
project_url="$(root_url $artifactId thirdparty)/$infix"
126+
project_url="$(root_url $infix thirdparty)/$infix"
122127
;;
123128
esac
124129
echo "$project_url"
@@ -135,15 +140,15 @@ jar_url () {
135140
infix="$(groupId "$gav" | tr . /)/$artifactId/$version"
136141
case "$version" in
137142
*-SNAPSHOT)
138-
url="$(root_url $artifactId snapshots)/$infix/maven-metadata.xml"
143+
url="$(root_url $infix snapshots)/$infix/maven-metadata.xml"
139144
metadata="$(curl -s "$url")"
140145
timestamp="$(extract_tag timestamp "$metadata")"
141146
buildNumber="$(extract_tag buildNumber "$metadata")"
142147
version=${version%-SNAPSHOT}-$timestamp-$buildNumber
143-
echo "$(root_url $artifactId snapshots)/$infix/$artifactId-$version.jar"
148+
echo "$(root_url $infix snapshots)/$infix/$artifactId-$version.jar"
144149
;;
145150
*)
146-
echo "$(root_url $artifactId releases)/$infix/$artifactId-$version.jar"
151+
echo "$(root_url $infix releases)/$infix/$artifactId-$version.jar"
147152
;;
148153
esac
149154
}

0 commit comments

Comments
 (0)