Bump versions to 0.18.1-SNAPSHOT
[aaa.git] / dependency-check / update-dependencies
1 #!/bin/sh
2
3 # Copyright © 2017, 2018 Red Hat, Inc. and others.
4 #
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 # and is available at http://www.eclipse.org/legal/epl-v10.html
8
9 xmlstarlet sel -N "maven=http://maven.apache.org/POM/4.0.0" -t \
10 -m "maven:project/maven:dependencyManagement/maven:dependencies/maven:dependency" \
11 -v maven:groupId -o " " -v maven:artifactId -o " classifier=" -v maven:classifier -o " type=" -v maven:type -n \
12 ../artifacts/pom.xml |
13 sort |
14 awk '
15 BEGIN { predeps = 1 }
16 FNR == NR && predeps && /<dependencies>/ {
17   print
18   predeps = 0
19 }
20 FNR == NR && !predeps && /<\/dependencies>/ {
21   postdeps=1
22 }
23 FNR == NR && predeps
24 FNR == NR && postdeps {
25   footer=footer "\n" $0
26 }
27 FNR < NR && !/org.opendaylight/ {
28   printf "        <dependency>\n"
29   printf "            <groupId>%s</groupId>\n", $1
30   printf "            <artifactId>%s</artifactId>\n", $2
31   for (i = 3; i <= NF; i++) {
32     equalidx = index($i, "=")
33     if (equalidx != length($i)) {
34       element = substr($i, 1, equalidx - 1)
35       value = substr($i, equalidx + 1)
36       printf "            <%s>%s</%s>\n", element, value, element
37     }
38   }
39   printf "        </dependency>\n"
40 }
41 END { print footer }
42 ' pom.xml - > pom.xml.new
43 mv pom.xml.new pom.xml