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