Debian Codegraph @

update_version

raw
1 #!/bin/sh
2 #
3 # Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
4 #
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v. 2.0, which is available at
7 # http://www.eclipse.org/legal/epl-2.0.
8 #
9 # This Source Code may also be made available under the following Secondary
10 # Licenses when the conditions for such availability set forth in the
11 # Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12 # version 2 with the GNU Classpath Exception, which is available at
13 # https://www.gnu.org/software/classpath/license.html.
14 #
15 # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16 #
17
18 #
19 # update version number in pom files, e.g., to change to release
20 # version number in preparation for release, or to change back to
21 # snapshot version number after release.
22 #
23 # Usage: update_version new-version
24 #
25 new=$1
26 # find the second version string in pom.xml, which is the old version
27 # this is almost the same as "mvn versions:set -DnewVersion=$1"
28 # except that misses mbox/native/pom.xml
29 old=`grep '<version>.*</version>' pom.xml | sed -n 2p | \
30 sed -e 's:.*<version>\(.*\)</version>.*:\1:'`
31 # skip the spec directory, which is versioned separately
32 for file in `find * -name spec -prune -o -name 'pom.xml' -print`
33 do
34 ed - "$file" <<-EOF
35 g:<version>$old</version>:s::<version>$new</version>:
36 w
37 q
38 EOF
39 done
40 ed - pom.xml <<-EOF
41 g:<mail.version>$old</mail.version>:s::<mail.version>$new</mail.version>:
42 w
43 q
44 EOF