Bump asciidoctor-maven-plugin to 2.2.6
[odlparent.git] / odlparent-dependency-check / update-dependencies
1 #!/bin/sh
2
3 # Copyright © 2017 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 \
12 -o " scope=" -v maven:scope -o " version=" -v maven:version -n \
13 ../odlparent/pom.xml |
14 sort |
15 awk '
16 BEGIN { predeps = 1 }
17 FNR == NR && predeps && /<dependencies>/ {
18   print
19   predeps = 0
20 }
21 FNR == NR && !predeps && /<\/dependencies>/ {
22   postdeps=1
23 }
24 FNR == NR && predeps
25 FNR == NR && postdeps {
26   footer=footer "\n" $0
27 }
28 FNR < NR && !/org.opendaylight/ {
29   printf "        <dependency>\n"
30   printf "            <groupId>%s</groupId>\n", $1
31   printf "            <artifactId>%s</artifactId>\n", $2
32   needversion = 0
33   for (i = 3; i <= NF; i++) {
34     equalidx = index($i, "=")
35     if (equalidx != length($i)) {
36       element = substr($i, 1, equalidx - 1)
37       value = substr($i, equalidx + 1)
38       if (element == "scope") {
39         if (value == "import") {
40           # Scope import dependencies need to have their version mentioned explicitly
41           needversion = 1
42         }
43       } else if (element != "version" || needversion) {
44         printf "            <%s>%s</%s>\n", element, value, element
45       }
46     }
47   }
48   printf "        </dependency>\n"
49 }
50 END { print footer }
51 ' pom.xml - > pom.xml.new
52 mv pom.xml.new pom.xml