2 ##############################################################################
3 # Copyright (c) 2015, 2016 The Linux Foundation. All rights reserved.
4 ##############################################################################
7 ROOT=`git rev-parse --show-toplevel`/autorelease
14 # MAP of path to a parent pom from the perspective of hosting directory
15 # starting from the autorelease repo root.
17 # Format: <groupId>:<artifactId>:<path>
21 echo -e "\nScanning $pom"
22 pomPath=`dirname $pom`
24 projectPath=${pomPath#*/} # Path to pom file from the perspective of hosting repo
26 relativePath="$projectPath" # Calculated relative path to parent pom
28 # Update any existing project names
29 xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \
30 -u "/x:project/x:name" -v "$relativePath" \
32 mv "${pom}.new" "${pom}"
35 xmlstarlet ed -P -N x=http://maven.apache.org/POM/4.0.0 \
36 -s "/x:project[count(x:name)=0]" -t elem -n name -v "$relativePath" \
38 mv "${pom}.new" "${pom}"
41 # Find all project poms ignoring the /src/ paths (We don't want to scan code)
42 find . -name pom.xml -not -path "*/src/*" | xargs -I^ -P8 bash -c "$(declare -f fix_name); fix_name ^"