Update git submodules
[releng/autorelease.git] / scripts / list-project-dependencies.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 The Linux Foundation.  All rights reserved.
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
10 # This script searches all projects that autorelease builds and outputs the
11 # dependencies it detects for each project into a log file.
12
13 LOG_FILE=dependencies.log
14
15 modules=`xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' pom.xml`
16
17 for module in $modules; do
18     module_dependencies=""
19     for pom in `find $module -name pom.xml ! -path "*/src/*" ! -path "*/target/*"`; do
20         dependencies=`xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 \
21                                      -t \
22                                      -m '//x:dependencies' \
23                                      -n -v "x:dependency/x:groupId" $pom | \
24                       grep org.opendaylight | \
25                       sed -e 's/org.opendaylight.//' \
26                           -e 's/\..*$//' \
27                           -e "s/$module//" | \
28                       sort | uniq`
29         module_dependencies=`echo $module_dependencies $dependencies | tr " " "\n" | sort | uniq`
30     done
31     module_dependencies=`echo $module_dependencies | tr " " ","`
32     echo "$module:$module_dependencies" >> $LOG_FILE
33 done
34