2 # Copyright (C) 2009, Google Inc.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Eclipse Public License 2.0
6 # which accompanies this distribution, and is available at
7 # https://www.eclipse.org/legal/epl-2.0/
9 # SPDX-License-Identifier: EPL-2.0
11 # Update all pom.xml with new build number
13 # TODO(spearce) This should be converted to some sort of
14 # Java based Maven plugin so its fully portable.
24 V
=$
(echo "$1" | perl
-pe 's/^--snapshot=//')
27 echo >&2 "usage: $0 --snapshot=0.n.0"
38 V
=$
(git describe HEAD
) ||
exit
48 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release} [--jgit=0.n.0]"
54 v
*) V
=$
(echo "$V" | perl
-pe s
/^v
//) ;;
56 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release}"
63 OSGI_V
="${V%%-SNAPSHOT}.qualifier"
66 POM_V
=$
(echo "$V" | perl
-pe 's/-(\d+-g.*)$/.$1/')
68 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?-(\d+)-g(.*)$/;
69 my ($a, $b, $c, $p, $r) = ($1, $2, $3, $4, $5);
70 $b = '0' unless defined $b;
71 $c = '0' unless defined $c;
73 printf "%s.%s.%s.%6.6i_g%s\n", $a, $b, $c, $p, $r;
84 $ARGV[0] =~ /^(\d+(?:\.\d+(?:\.\d+)?)?)/;
91 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/;
92 my ($a, $b) = ($1, $2);
93 $b = 0 unless defined $b;
99 EGIT_V
=$
(to_version
"$V")
100 EGIT_N
=$
(next_version
"$EGIT_V")
103 JGIT_V
=$
(to_version
"$J")
104 JGIT_N
=$
(next_version
"$JGIT_V")
107 s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/;
108 s/(org.eclipse.egit.*;version=")[^"[(]*(")/${1}'"$EGIT_V"'${2}/;
109 s/(org.eclipse.egit.*;version="\[)[^"]*(\)")/${1}'"$EGIT_V,$EGIT_N"'${2}/;
110 s/(org.eclipse.egit.*;bundle-version="\[)[^"]*(\)")/${1}'"$EGIT_V,$EGIT_N"'${2}/;
111 s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$JGIT_V,$JGIT_N"'${2}/;
112 s/(org.eclipse.jgit;bundle-version="\[)[^"]*(\)")/${1}'"$JGIT_V,$JGIT_N"'${2}/;
113 ' $
(git ls-files |
grep META-INF
/MANIFEST.MF
)
115 # Replace version numbers in feature.xml files. The first version is replaced by the full OSGi version.
116 # Versions in dependencies in the <requires> section for EGit/JGit features or plugins are set to the
117 # simple version numbers.
120 if ($ARGV ne $old_argv) {
124 if (!$seen_version) {
125 $seen_version = 1 if (!/<\?xml/ &&
126 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
128 s/(feature="org.eclipse.jgit[^"]*" version=")[^"]*(")/${1}'"$JGIT_V"'${2}/;
129 s/(plugin="org.eclipse.jgit[^"]*" version=")[^"]*(")/${1}'"$JGIT_V"'${2}/;
130 s/(feature="org.eclipse.egit[^"]*" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
131 s/(plugin="org.eclipse.egit[^"]*" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
132 ' $
(git ls-files |
grep feature.xml
)
135 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
136 ' org.eclipse.egit-feature
/pom.xml
139 if ($ARGV ne $old_argv) {
143 if (!$seen_version) {
145 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
147 s{<(egit-version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
151 if ($ARGV ne $old_argv) {
155 if ($seen_version < 2) {
157 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
159 ' org.eclipse.egit.repository
/pom.xml
162 if ($ARGV ne $old_argv) {
167 if (!$seen_version) {
169 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
171 if ($seen_version2 < 2) {
173 s|(<version\>)([\.\d]*)(\</version\>)|${1}'$EGIT_V'${3}|;
175 ' org.eclipse.egit.ui.test
/pom.xml
178 if ($ARGV ne $old_argv) {
182 if (!$seen_version) {
184 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
186 s{<(jgit-version)>[^<]*</\1>}{<${1}>'"$J"'</${1}>};
187 ' $
(git ls-files |
grep pom.xml
)
189 find .
-name '*~' |
xargs rm -f